1 | package parkup.entities;
|
---|
2 |
|
---|
3 | import parkup.data.ParkingZoneLocation;
|
---|
4 |
|
---|
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(
|
---|
14 | name="parking_zone_sequence_generator",
|
---|
15 | sequenceName = "parking_zone_sequence",
|
---|
16 | allocationSize = 1,
|
---|
17 | initialValue = 600
|
---|
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 |
|
---|
32 | @Transient
|
---|
33 | @Column(name = "capacity")
|
---|
34 | private int capacity;
|
---|
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;
|
---|
40 |
|
---|
41 | @Column(name = "address")
|
---|
42 | private String address;
|
---|
43 |
|
---|
44 | @Transient
|
---|
45 | @Column(name = "takenSpaces")
|
---|
46 | private int takenSpaces;
|
---|
47 |
|
---|
48 | @Column(name = "color")
|
---|
49 | private String color;
|
---|
50 |
|
---|
51 | // @ManyToMany(cascade = {CascadeType.ALL})
|
---|
52 | // private List<Vraboten> odgovorniLica;
|
---|
53 |
|
---|
54 | @OneToMany(cascade = {CascadeType.ALL})
|
---|
55 | private List<ParkingSpace> parkingSpaces;
|
---|
56 |
|
---|
57 | @Transient
|
---|
58 | private List<String> responsibleWorkers;
|
---|
59 |
|
---|
60 |
|
---|
61 |
|
---|
62 | @OneToOne(cascade = {CascadeType.ALL})
|
---|
63 | private ParkingZoneLocation parkingZoneLocation;
|
---|
64 |
|
---|
65 | public ParkingZone() {
|
---|
66 | this.takenSpaces = 0;
|
---|
67 | this.parkingSpaces = new ArrayList<ParkingSpace>();
|
---|
68 | }
|
---|
69 |
|
---|
70 | public ParkingZone(String pzName) {
|
---|
71 | this.pzName = pzName;
|
---|
72 | this.takenSpaces = 0;
|
---|
73 | this.parkingSpaces = new ArrayList<ParkingSpace>();
|
---|
74 | }
|
---|
75 |
|
---|
76 | public ParkingZone(int pzId, String pzName, int price, int capacity, String address, List<ParkingSpace> parkingSpaces, String color, int from, int to) {
|
---|
77 | this.pzId = pzId;
|
---|
78 | this.pzName = pzName;
|
---|
79 | this.price = price;
|
---|
80 | this.capacity = capacity;
|
---|
81 | this.address = address;
|
---|
82 | this.takenSpaces = 0;
|
---|
83 | this.parkingSpaces = parkingSpaces;
|
---|
84 | this.color = color;
|
---|
85 | this.from = from;
|
---|
86 | this.to = to;
|
---|
87 | }
|
---|
88 |
|
---|
89 | public ParkingZone(String pzName, int price, int capacity, String address, List<ParkingSpace> parkingSpaces, String color, int from, int to) {
|
---|
90 | this.pzName = pzName;
|
---|
91 | this.price = price;
|
---|
92 | this.capacity = capacity;
|
---|
93 | this.address = address;
|
---|
94 | this.takenSpaces = 0;
|
---|
95 | this.parkingSpaces = parkingSpaces;
|
---|
96 | this.color = color;
|
---|
97 | this.from = from;
|
---|
98 | this.to = to;
|
---|
99 | }
|
---|
100 |
|
---|
101 | public int getId() {
|
---|
102 | return this.pzId;
|
---|
103 | }
|
---|
104 |
|
---|
105 | public void setId(int pzId) {
|
---|
106 | this.pzId = pzId;
|
---|
107 | }
|
---|
108 |
|
---|
109 | public String getPzName() {
|
---|
110 | return this.pzName;
|
---|
111 | }
|
---|
112 |
|
---|
113 | public void setPzName(String pzName) {
|
---|
114 | this.pzName = pzName;
|
---|
115 | }
|
---|
116 |
|
---|
117 | public int getPrice() {
|
---|
118 | return this.price;
|
---|
119 | }
|
---|
120 |
|
---|
121 | public void setPrice(int price) {
|
---|
122 | this.price = price;
|
---|
123 | }
|
---|
124 | public List<String> getResponsibleWorkers() {
|
---|
125 | return responsibleWorkers;
|
---|
126 | }
|
---|
127 |
|
---|
128 | public void setResponsibleWorkers(List<String> responsibleWorkers) {
|
---|
129 | this.responsibleWorkers = responsibleWorkers;
|
---|
130 | }
|
---|
131 | public int getCapacity() {
|
---|
132 | return this.capacity;
|
---|
133 | }
|
---|
134 |
|
---|
135 | public void setCapacity(int capacity) {
|
---|
136 | this.capacity = capacity;
|
---|
137 | }
|
---|
138 |
|
---|
139 | public String getAddress() {
|
---|
140 | return this.address;
|
---|
141 | }
|
---|
142 |
|
---|
143 | public void setAddress(String location) {
|
---|
144 | this.address = location;
|
---|
145 | }
|
---|
146 |
|
---|
147 | public int getTakenSpaces() {return takenSpaces;}
|
---|
148 |
|
---|
149 | public void setTakenSpaces(int takenSpaces) {this.takenSpaces = takenSpaces;}
|
---|
150 |
|
---|
151 | public List<ParkingSpace> getParkingSpaces() {return parkingSpaces;}
|
---|
152 |
|
---|
153 | public void setParkingSpaces(List<ParkingSpace> parkingSpaces) {this.parkingSpaces = parkingSpaces;}
|
---|
154 |
|
---|
155 | public String getColor() {
|
---|
156 | return color;
|
---|
157 | }
|
---|
158 |
|
---|
159 | public void setColor(String color) {
|
---|
160 | this.color = color;
|
---|
161 | }
|
---|
162 |
|
---|
163 | public int getFrom() {
|
---|
164 | return from;
|
---|
165 | }
|
---|
166 |
|
---|
167 | public void setFrom(int from) {
|
---|
168 | this.from = from;
|
---|
169 | }
|
---|
170 |
|
---|
171 | public int getTo() {
|
---|
172 | return to;
|
---|
173 | }
|
---|
174 |
|
---|
175 | public void setTo(int to) {
|
---|
176 | this.to = to;
|
---|
177 | }
|
---|
178 |
|
---|
179 | public ParkingZoneLocation getParkingZoneLocation() {
|
---|
180 | return parkingZoneLocation;
|
---|
181 | }
|
---|
182 |
|
---|
183 | public void setParkingZoneLocation(ParkingZoneLocation parkingZoneLocation) {
|
---|
184 | this.parkingZoneLocation = parkingZoneLocation;
|
---|
185 | }
|
---|
186 |
|
---|
187 | // public List<Vraboten> getOdgovorniLica() {
|
---|
188 | // return odgovorniLica;
|
---|
189 | // }
|
---|
190 | //
|
---|
191 | // public void setOdgovorniLica(List<Vraboten> odgovorniLica) {
|
---|
192 | // this.odgovorniLica = odgovorniLica;
|
---|
193 | // }
|
---|
194 | }
|
---|