source: sources/app/src/main/java/parkup/entities/ParkingZone.java@ 9ff45d6

Last change on this file since 9ff45d6 was 9ff45d6, checked in by andrejTavchioski <andrej.tavchioski@…>, 2 years ago

Fixed some functionalities related to parkingSessions and parkingZones

  • Property mode set to 100644
File size: 4.5 KB
Line 
1package parkup.entities;
2
3import parkup.data.ParkingZoneLocation;
4
5import javax.persistence.*;
6import java.util.ArrayList;
7import java.util.List;
8
9@Entity
10@Table(name = "parking_zone")
11public 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 = "zafateniMesta")
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.MERGE})
55 private List<ParkingSpace> parkingSpaces;
56
57
58
59 @OneToOne(cascade = {CascadeType.ALL})
60 private ParkingZoneLocation parkingZoneLocation;
61
62 public ParkingZone() {
63 this.takenSpaces = 0;
64 this.parkingSpaces = new ArrayList<ParkingSpace>();
65 }
66
67 public ParkingZone(String pzName) {
68 this.pzName = pzName;
69 this.takenSpaces = 0;
70 this.parkingSpaces = new ArrayList<ParkingSpace>();
71 }
72
73 public ParkingZone(int pzId, String pzName, int price, int capacity, String address, List<ParkingSpace> parkingSpaces, String color, int from, int to) {
74 this.pzId = pzId;
75 this.pzName = pzName;
76 this.price = price;
77 this.capacity = capacity;
78 this.address = address;
79 this.takenSpaces = 0;
80 this.parkingSpaces = parkingSpaces;
81 this.color = color;
82 this.from = from;
83 this.to = to;
84 }
85
86 public ParkingZone(String pzName, int price, int capacity, String address, List<ParkingSpace> parkingSpaces, String color, int from, int to) {
87 this.pzName = pzName;
88 this.price = price;
89 this.capacity = capacity;
90 this.address = address;
91 this.takenSpaces = 0;
92 this.parkingSpaces = parkingSpaces;
93 this.color = color;
94 this.from = from;
95 this.to = to;
96 }
97
98 public int getId() {
99 return this.pzId;
100 }
101
102 public void setId(int pzId) {
103 this.pzId = pzId;
104 }
105
106 public String getPzName() {
107 return this.pzName;
108 }
109
110 public void setPzName(String pzName) {
111 this.pzName = pzName;
112 }
113
114 public int getPrice() {
115 return this.price;
116 }
117
118 public void setPrice(int price) {
119 this.price = price;
120 }
121
122 public int getCapacity() {
123 return this.capacity;
124 }
125
126 public void setCapacity(int capacity) {
127 this.capacity = capacity;
128 }
129
130 public String getAddress() {
131 return this.address;
132 }
133
134 public void setAddress(String location) {
135 this.address = location;
136 }
137
138 public int getTakenSpaces() {return takenSpaces;}
139
140 public void setTakenSpaces(int takenSpaces) {this.takenSpaces = takenSpaces;}
141
142 public List<ParkingSpace> getParkingSpaces() {return parkingSpaces;}
143
144 public void setParkingSpaces(List<ParkingSpace> parkingSpaces) {this.parkingSpaces = parkingSpaces;}
145
146 public String getColor() {
147 return color;
148 }
149
150 public void setColor(String color) {
151 this.color = color;
152 }
153
154 public int getFrom() {
155 return from;
156 }
157
158 public void setFrom(int from) {
159 this.from = from;
160 }
161
162 public int getTo() {
163 return to;
164 }
165
166 public void setTo(int to) {
167 this.to = to;
168 }
169
170 public ParkingZoneLocation getParkingZoneLocation() {
171 return parkingZoneLocation;
172 }
173
174 public void setParkingZoneLocation(ParkingZoneLocation parkingZoneLocation) {
175 this.parkingZoneLocation = parkingZoneLocation;
176 }
177
178 // public List<Vraboten> getOdgovorniLica() {
179// return odgovorniLica;
180// }
181//
182// public void setOdgovorniLica(List<Vraboten> odgovorniLica) {
183// this.odgovorniLica = odgovorniLica;
184// }
185}
Note: See TracBrowser for help on using the repository browser.