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 | @OneToMany(cascade = {CascadeType.ALL})
|
---|
52 | private List<ParkingSpace> parkingSpaces;
|
---|
53 |
|
---|
54 | @Transient
|
---|
55 | private List<String> responsibleWorkers;
|
---|
56 |
|
---|
57 | @OneToOne(cascade = {CascadeType.ALL})
|
---|
58 | private ParkingZoneLocation parkingZoneLocation;
|
---|
59 |
|
---|
60 | public ParkingZone() {
|
---|
61 | this.takenSpaces = 0;
|
---|
62 | this.parkingSpaces = new ArrayList<ParkingSpace>();
|
---|
63 | }
|
---|
64 |
|
---|
65 | public ParkingZone(String pzName) {
|
---|
66 | this.pzName = pzName;
|
---|
67 | this.takenSpaces = 0;
|
---|
68 | this.parkingSpaces = new ArrayList<ParkingSpace>();
|
---|
69 | }
|
---|
70 |
|
---|
71 | public ParkingZone(int pzId, String pzName, int price, int capacity, String address, List<ParkingSpace> parkingSpaces, String color, int from, int to) {
|
---|
72 | this.pzId = pzId;
|
---|
73 | this.pzName = pzName;
|
---|
74 | this.price = price;
|
---|
75 | this.capacity = capacity;
|
---|
76 | this.address = address;
|
---|
77 | this.takenSpaces = 0;
|
---|
78 | this.parkingSpaces = parkingSpaces;
|
---|
79 | this.color = color;
|
---|
80 | this.from = from;
|
---|
81 | this.to = to;
|
---|
82 | }
|
---|
83 |
|
---|
84 | public ParkingZone(String pzName, int price, int capacity, String address, List<ParkingSpace> parkingSpaces, String color, int from, int to) {
|
---|
85 | this.pzName = pzName;
|
---|
86 | this.price = price;
|
---|
87 | this.capacity = capacity;
|
---|
88 | this.address = address;
|
---|
89 | this.takenSpaces = 0;
|
---|
90 | this.parkingSpaces = parkingSpaces;
|
---|
91 | this.color = color;
|
---|
92 | this.from = from;
|
---|
93 | this.to = to;
|
---|
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 | }
|
---|
119 | public List<String> getResponsibleWorkers() {
|
---|
120 | return responsibleWorkers;
|
---|
121 | }
|
---|
122 |
|
---|
123 | public void setResponsibleWorkers(List<String> responsibleWorkers) {
|
---|
124 | this.responsibleWorkers = responsibleWorkers;
|
---|
125 | }
|
---|
126 | public int getCapacity() {
|
---|
127 | return this.capacity;
|
---|
128 | }
|
---|
129 |
|
---|
130 | public void setCapacity(int capacity) {
|
---|
131 | this.capacity = capacity;
|
---|
132 | }
|
---|
133 |
|
---|
134 | public String getAddress() {
|
---|
135 | return this.address;
|
---|
136 | }
|
---|
137 |
|
---|
138 | public void setAddress(String location) {
|
---|
139 | this.address = location;
|
---|
140 | }
|
---|
141 |
|
---|
142 | public int getTakenSpaces() {return takenSpaces;}
|
---|
143 |
|
---|
144 | public void setTakenSpaces(int takenSpaces) {this.takenSpaces = takenSpaces;}
|
---|
145 |
|
---|
146 | public List<ParkingSpace> getParkingSpaces() {return parkingSpaces;}
|
---|
147 |
|
---|
148 | public void setParkingSpaces(List<ParkingSpace> parkingSpaces) {this.parkingSpaces = parkingSpaces;}
|
---|
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 |
|
---|
182 | // public List<Vraboten> getOdgovorniLica() {
|
---|
183 | // return odgovorniLica;
|
---|
184 | // }
|
---|
185 | //
|
---|
186 | // public void setOdgovorniLica(List<Vraboten> odgovorniLica) {
|
---|
187 | // this.odgovorniLica = odgovorniLica;
|
---|
188 | // }
|
---|
189 | }
|
---|