[ce6ad22] | 1 | package parkup.entities;
|
---|
| 2 |
|
---|
| 3 | import javax.persistence.*;
|
---|
| 4 | import java.util.ArrayList;
|
---|
| 5 | import java.util.List;
|
---|
| 6 |
|
---|
| 7 | @Entity
|
---|
| 8 | @Table(name = "parking_zone")
|
---|
| 9 | public class ParkingZone {
|
---|
| 10 | @Id
|
---|
| 11 | @SequenceGenerator(
|
---|
| 12 | name="parking_zone_generator",
|
---|
| 13 | sequenceName = "parking_zone_sequence",
|
---|
| 14 | allocationSize = 1,
|
---|
| 15 | initialValue = 500
|
---|
| 16 | )
|
---|
| 17 | @GeneratedValue( //za postgres treba sequence da se namesti i ime na generator mi ga davamo kako od gore sto e
|
---|
| 18 | strategy = GenerationType.SEQUENCE,
|
---|
| 19 | generator = "parking_zone_sequence_generator"
|
---|
| 20 | )
|
---|
| 21 | @Column(name = "parking_zone_id")
|
---|
| 22 | private int pzId;
|
---|
| 23 |
|
---|
| 24 | @Column(name = "pz_name")
|
---|
| 25 | private String pzName;
|
---|
| 26 |
|
---|
| 27 | @Column(name = "price")
|
---|
| 28 | private int price;
|
---|
| 29 |
|
---|
| 30 | @Column(name = "capacity")
|
---|
| 31 | private int capacity;
|
---|
| 32 |
|
---|
| 33 | @Column(name = "work_hours")
|
---|
| 34 | private String workHours;
|
---|
| 35 |
|
---|
| 36 | @Column(name = "location")
|
---|
| 37 | private String location;
|
---|
| 38 |
|
---|
| 39 | @Column(name = "zafateniMesta")
|
---|
| 40 | private int zafateniMesta;
|
---|
| 41 |
|
---|
| 42 | @OneToMany(cascade = {CascadeType.ALL})
|
---|
| 43 | @JoinColumn(name = "parkingSpaces", nullable = false)
|
---|
| 44 | private List<ParkingSpace> parkingSpaces;
|
---|
| 45 |
|
---|
| 46 | public ParkingZone() {
|
---|
| 47 | this.zafateniMesta = 0;
|
---|
| 48 | this.parkingSpaces = new ArrayList<ParkingSpace>();
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | public ParkingZone(int pzId, String pzName, int price, int capacity, String workHours, String location, List<ParkingSpace> parkingSpaces) {
|
---|
| 52 | this.pzId = pzId;
|
---|
| 53 | this.pzName = pzName;
|
---|
| 54 | this.price = price;
|
---|
| 55 | this.capacity = capacity;
|
---|
| 56 | this.workHours = workHours;
|
---|
| 57 | this.location = location;
|
---|
| 58 | this.zafateniMesta = 0;
|
---|
| 59 | this.parkingSpaces = parkingSpaces;
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | public ParkingZone(String pzName, int price, int capacity, String workHours, String location, List<ParkingSpace> parkingSpaces) {
|
---|
| 63 | this.pzName = pzName;
|
---|
| 64 | this.price = price;
|
---|
| 65 | this.capacity = capacity;
|
---|
| 66 | this.workHours = workHours;
|
---|
| 67 | this.location = location;
|
---|
| 68 | this.zafateniMesta = 0;
|
---|
| 69 | this.parkingSpaces = parkingSpaces;
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | public int getId() {
|
---|
| 73 | return this.pzId;
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | public void setId(int pzId) {
|
---|
| 77 | this.pzId = pzId;
|
---|
| 78 | }
|
---|
| 79 |
|
---|
| 80 | public String getPzName() {
|
---|
| 81 | return this.pzName;
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | public void setPzName(String pzName) {
|
---|
| 85 | this.pzName = pzName;
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 | public int getPrice() {
|
---|
| 89 | return this.price;
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | public void setPrice(int price) {
|
---|
| 93 | this.price = price;
|
---|
| 94 | }
|
---|
| 95 |
|
---|
| 96 | public int getCapacity() {
|
---|
| 97 | return this.capacity;
|
---|
| 98 | }
|
---|
| 99 |
|
---|
| 100 | public void setCapacity(int capacity) {
|
---|
| 101 | this.capacity = capacity;
|
---|
| 102 | }
|
---|
| 103 |
|
---|
| 104 | public String getWorkHours() {
|
---|
| 105 | return this.workHours;
|
---|
| 106 | }
|
---|
| 107 |
|
---|
| 108 | public void setWorkHours(String workHours) {
|
---|
| 109 | this.workHours = workHours;
|
---|
| 110 | }
|
---|
| 111 |
|
---|
| 112 | public String getLocation() {
|
---|
| 113 | return this.location;
|
---|
| 114 | }
|
---|
| 115 |
|
---|
| 116 | public void setLocation(String location) {
|
---|
| 117 | this.location = location;
|
---|
| 118 | }
|
---|
| 119 |
|
---|
| 120 | public int getZafateniMesta() {return zafateniMesta;}
|
---|
| 121 |
|
---|
| 122 | public void setZafateniMesta(int zafateniMesta) {this.zafateniMesta = zafateniMesta;}
|
---|
| 123 |
|
---|
| 124 | public List<ParkingSpace> getParkingSpaces() {return parkingSpaces;}
|
---|
| 125 |
|
---|
| 126 | public void setParkingSpaces(List<ParkingSpace> parkingSpaces) {this.parkingSpaces = parkingSpaces;}
|
---|
| 127 | }
|
---|