[ce6ad22] | 1 | package parkup.entities;
|
---|
| 2 |
|
---|
[97fbc67] | 3 | import parkup.data.ParkingZoneLocation;
|
---|
| 4 |
|
---|
[ce6ad22] | 5 | import javax.persistence.*;
|
---|
| 6 | import java.util.ArrayList;
|
---|
| 7 | import java.util.List;
|
---|
| 8 |
|
---|
| 9 | @Entity
|
---|
| 10 | @Table(name = "parking_zone")
|
---|
| 11 | public class ParkingZone {
|
---|
| 12 | @Id
|
---|
| 13 | @SequenceGenerator(
|
---|
[97fbc67] | 14 | name="parking_zone_sequence_generator",
|
---|
[ce6ad22] | 15 | sequenceName = "parking_zone_sequence",
|
---|
| 16 | allocationSize = 1,
|
---|
[97fbc67] | 17 | initialValue = 600
|
---|
[ce6ad22] | 18 | )
|
---|
| 19 | @GeneratedValue( //za postgres treba sequence da se namesti i ime na generator mi ga davamo kako od gore sto e
|
---|
| 20 | strategy = GenerationType.SEQUENCE,
|
---|
| 21 | generator = "parking_zone_sequence_generator"
|
---|
| 22 | )
|
---|
| 23 | @Column(name = "parking_zone_id")
|
---|
| 24 | private int pzId;
|
---|
| 25 |
|
---|
| 26 | @Column(name = "pz_name")
|
---|
| 27 | private String pzName;
|
---|
| 28 |
|
---|
| 29 | @Column(name = "price")
|
---|
| 30 | private int price;
|
---|
| 31 |
|
---|
[9ff45d6] | 32 | @Transient
|
---|
[ce6ad22] | 33 | @Column(name = "capacity")
|
---|
| 34 | private int capacity;
|
---|
[97fbc67] | 35 | @Column(name = "time_from") //za rabotni casovi od:
|
---|
| 36 | private int from;
|
---|
| 37 |
|
---|
| 38 | @Column(name = "time_to") //za rabotni casovi do:
|
---|
| 39 | private int to;
|
---|
[ce6ad22] | 40 |
|
---|
[9ff45d6] | 41 | @Column(name = "address")
|
---|
| 42 | private String address;
|
---|
[ce6ad22] | 43 |
|
---|
[9ff45d6] | 44 | @Transient
|
---|
[9dd526f] | 45 | @Column(name = "takenSpaces")
|
---|
[9ff45d6] | 46 | private int takenSpaces;
|
---|
[ce6ad22] | 47 |
|
---|
[97fbc67] | 48 | @Column(name = "color")
|
---|
| 49 | private String color;
|
---|
| 50 |
|
---|
[9dd526f] | 51 | @OneToMany(cascade = {CascadeType.ALL})
|
---|
[ce6ad22] | 52 | private List<ParkingSpace> parkingSpaces;
|
---|
| 53 |
|
---|
[80ddcae] | 54 | @Transient
|
---|
| 55 | private List<String> responsibleWorkers;
|
---|
| 56 |
|
---|
[97fbc67] | 57 | @OneToOne(cascade = {CascadeType.ALL})
|
---|
| 58 | private ParkingZoneLocation parkingZoneLocation;
|
---|
| 59 |
|
---|
| 60 | public ParkingZone() {
|
---|
[9ff45d6] | 61 | this.takenSpaces = 0;
|
---|
[97fbc67] | 62 | this.parkingSpaces = new ArrayList<ParkingSpace>();
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | public ParkingZone(String pzName) {
|
---|
| 66 | this.pzName = pzName;
|
---|
[9ff45d6] | 67 | this.takenSpaces = 0;
|
---|
[ce6ad22] | 68 | this.parkingSpaces = new ArrayList<ParkingSpace>();
|
---|
| 69 | }
|
---|
| 70 |
|
---|
[9ff45d6] | 71 | public ParkingZone(int pzId, String pzName, int price, int capacity, String address, List<ParkingSpace> parkingSpaces, String color, int from, int to) {
|
---|
[ce6ad22] | 72 | this.pzId = pzId;
|
---|
| 73 | this.pzName = pzName;
|
---|
| 74 | this.price = price;
|
---|
| 75 | this.capacity = capacity;
|
---|
[9ff45d6] | 76 | this.address = address;
|
---|
| 77 | this.takenSpaces = 0;
|
---|
[ce6ad22] | 78 | this.parkingSpaces = parkingSpaces;
|
---|
[97fbc67] | 79 | this.color = color;
|
---|
| 80 | this.from = from;
|
---|
| 81 | this.to = to;
|
---|
[ce6ad22] | 82 | }
|
---|
| 83 |
|
---|
[9ff45d6] | 84 | public ParkingZone(String pzName, int price, int capacity, String address, List<ParkingSpace> parkingSpaces, String color, int from, int to) {
|
---|
[ce6ad22] | 85 | this.pzName = pzName;
|
---|
| 86 | this.price = price;
|
---|
| 87 | this.capacity = capacity;
|
---|
[9ff45d6] | 88 | this.address = address;
|
---|
| 89 | this.takenSpaces = 0;
|
---|
[ce6ad22] | 90 | this.parkingSpaces = parkingSpaces;
|
---|
[97fbc67] | 91 | this.color = color;
|
---|
| 92 | this.from = from;
|
---|
| 93 | this.to = to;
|
---|
[ce6ad22] | 94 | }
|
---|
| 95 |
|
---|
| 96 | public int getId() {
|
---|
| 97 | return this.pzId;
|
---|
| 98 | }
|
---|
| 99 |
|
---|
| 100 | public void setId(int pzId) {
|
---|
| 101 | this.pzId = pzId;
|
---|
| 102 | }
|
---|
| 103 |
|
---|
| 104 | public String getPzName() {
|
---|
| 105 | return this.pzName;
|
---|
| 106 | }
|
---|
| 107 |
|
---|
| 108 | public void setPzName(String pzName) {
|
---|
| 109 | this.pzName = pzName;
|
---|
| 110 | }
|
---|
| 111 |
|
---|
| 112 | public int getPrice() {
|
---|
| 113 | return this.price;
|
---|
| 114 | }
|
---|
| 115 |
|
---|
| 116 | public void setPrice(int price) {
|
---|
| 117 | this.price = price;
|
---|
| 118 | }
|
---|
[80ddcae] | 119 | public List<String> getResponsibleWorkers() {
|
---|
| 120 | return responsibleWorkers;
|
---|
| 121 | }
|
---|
[ce6ad22] | 122 |
|
---|
[80ddcae] | 123 | public void setResponsibleWorkers(List<String> responsibleWorkers) {
|
---|
| 124 | this.responsibleWorkers = responsibleWorkers;
|
---|
| 125 | }
|
---|
[ce6ad22] | 126 | public int getCapacity() {
|
---|
| 127 | return this.capacity;
|
---|
| 128 | }
|
---|
| 129 |
|
---|
| 130 | public void setCapacity(int capacity) {
|
---|
| 131 | this.capacity = capacity;
|
---|
| 132 | }
|
---|
| 133 |
|
---|
[9ff45d6] | 134 | public String getAddress() {
|
---|
| 135 | return this.address;
|
---|
[ce6ad22] | 136 | }
|
---|
| 137 |
|
---|
[9ff45d6] | 138 | public void setAddress(String location) {
|
---|
| 139 | this.address = location;
|
---|
[ce6ad22] | 140 | }
|
---|
| 141 |
|
---|
[9ff45d6] | 142 | public int getTakenSpaces() {return takenSpaces;}
|
---|
[ce6ad22] | 143 |
|
---|
[9ff45d6] | 144 | public void setTakenSpaces(int takenSpaces) {this.takenSpaces = takenSpaces;}
|
---|
[ce6ad22] | 145 |
|
---|
| 146 | public List<ParkingSpace> getParkingSpaces() {return parkingSpaces;}
|
---|
| 147 |
|
---|
| 148 | public void setParkingSpaces(List<ParkingSpace> parkingSpaces) {this.parkingSpaces = parkingSpaces;}
|
---|
[97fbc67] | 149 |
|
---|
| 150 | public String getColor() {
|
---|
| 151 | return color;
|
---|
| 152 | }
|
---|
| 153 |
|
---|
| 154 | public void setColor(String color) {
|
---|
| 155 | this.color = color;
|
---|
| 156 | }
|
---|
| 157 |
|
---|
| 158 | public int getFrom() {
|
---|
| 159 | return from;
|
---|
| 160 | }
|
---|
| 161 |
|
---|
| 162 | public void setFrom(int from) {
|
---|
| 163 | this.from = from;
|
---|
| 164 | }
|
---|
| 165 |
|
---|
| 166 | public int getTo() {
|
---|
| 167 | return to;
|
---|
| 168 | }
|
---|
| 169 |
|
---|
| 170 | public void setTo(int to) {
|
---|
| 171 | this.to = to;
|
---|
| 172 | }
|
---|
| 173 |
|
---|
| 174 | public ParkingZoneLocation getParkingZoneLocation() {
|
---|
| 175 | return parkingZoneLocation;
|
---|
| 176 | }
|
---|
| 177 |
|
---|
| 178 | public void setParkingZoneLocation(ParkingZoneLocation parkingZoneLocation) {
|
---|
| 179 | this.parkingZoneLocation = parkingZoneLocation;
|
---|
| 180 | }
|
---|
| 181 |
|
---|
[9ff45d6] | 182 | // public List<Vraboten> getOdgovorniLica() {
|
---|
| 183 | // return odgovorniLica;
|
---|
| 184 | // }
|
---|
| 185 | //
|
---|
| 186 | // public void setOdgovorniLica(List<Vraboten> odgovorniLica) {
|
---|
| 187 | // this.odgovorniLica = odgovorniLica;
|
---|
| 188 | // }
|
---|
[ce6ad22] | 189 | }
|
---|