[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
|
---|
[ce6ad22] | 45 | @Column(name = "zafateniMesta")
|
---|
[9ff45d6] | 46 | private int takenSpaces;
|
---|
[ce6ad22] | 47 |
|
---|
[97fbc67] | 48 | @Column(name = "color")
|
---|
| 49 | private String color;
|
---|
| 50 |
|
---|
[9ff45d6] | 51 | // @ManyToMany(cascade = {CascadeType.ALL})
|
---|
| 52 | // private List<Vraboten> odgovorniLica;
|
---|
[97fbc67] | 53 |
|
---|
[9ff45d6] | 54 | @OneToMany(cascade = {CascadeType.MERGE})
|
---|
[ce6ad22] | 55 | private List<ParkingSpace> parkingSpaces;
|
---|
| 56 |
|
---|
[9ff45d6] | 57 |
|
---|
| 58 |
|
---|
[97fbc67] | 59 | @OneToOne(cascade = {CascadeType.ALL})
|
---|
| 60 | private ParkingZoneLocation parkingZoneLocation;
|
---|
| 61 |
|
---|
| 62 | public ParkingZone() {
|
---|
[9ff45d6] | 63 | this.takenSpaces = 0;
|
---|
[97fbc67] | 64 | this.parkingSpaces = new ArrayList<ParkingSpace>();
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | public ParkingZone(String pzName) {
|
---|
| 68 | this.pzName = pzName;
|
---|
[9ff45d6] | 69 | this.takenSpaces = 0;
|
---|
[ce6ad22] | 70 | this.parkingSpaces = new ArrayList<ParkingSpace>();
|
---|
| 71 | }
|
---|
| 72 |
|
---|
[9ff45d6] | 73 | public ParkingZone(int pzId, String pzName, int price, int capacity, String address, List<ParkingSpace> parkingSpaces, String color, int from, int to) {
|
---|
[ce6ad22] | 74 | this.pzId = pzId;
|
---|
| 75 | this.pzName = pzName;
|
---|
| 76 | this.price = price;
|
---|
| 77 | this.capacity = capacity;
|
---|
[9ff45d6] | 78 | this.address = address;
|
---|
| 79 | this.takenSpaces = 0;
|
---|
[ce6ad22] | 80 | this.parkingSpaces = parkingSpaces;
|
---|
[97fbc67] | 81 | this.color = color;
|
---|
| 82 | this.from = from;
|
---|
| 83 | this.to = to;
|
---|
[ce6ad22] | 84 | }
|
---|
| 85 |
|
---|
[9ff45d6] | 86 | public ParkingZone(String pzName, int price, int capacity, String address, List<ParkingSpace> parkingSpaces, String color, int from, int to) {
|
---|
[ce6ad22] | 87 | this.pzName = pzName;
|
---|
| 88 | this.price = price;
|
---|
| 89 | this.capacity = capacity;
|
---|
[9ff45d6] | 90 | this.address = address;
|
---|
| 91 | this.takenSpaces = 0;
|
---|
[ce6ad22] | 92 | this.parkingSpaces = parkingSpaces;
|
---|
[97fbc67] | 93 | this.color = color;
|
---|
| 94 | this.from = from;
|
---|
| 95 | this.to = to;
|
---|
[ce6ad22] | 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 |
|
---|
[9ff45d6] | 130 | public String getAddress() {
|
---|
| 131 | return this.address;
|
---|
[ce6ad22] | 132 | }
|
---|
| 133 |
|
---|
[9ff45d6] | 134 | public void setAddress(String location) {
|
---|
| 135 | this.address = location;
|
---|
[ce6ad22] | 136 | }
|
---|
| 137 |
|
---|
[9ff45d6] | 138 | public int getTakenSpaces() {return takenSpaces;}
|
---|
[ce6ad22] | 139 |
|
---|
[9ff45d6] | 140 | public void setTakenSpaces(int takenSpaces) {this.takenSpaces = takenSpaces;}
|
---|
[ce6ad22] | 141 |
|
---|
| 142 | public List<ParkingSpace> getParkingSpaces() {return parkingSpaces;}
|
---|
| 143 |
|
---|
| 144 | public void setParkingSpaces(List<ParkingSpace> parkingSpaces) {this.parkingSpaces = parkingSpaces;}
|
---|
[97fbc67] | 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 |
|
---|
[9ff45d6] | 178 | // public List<Vraboten> getOdgovorniLica() {
|
---|
| 179 | // return odgovorniLica;
|
---|
| 180 | // }
|
---|
| 181 | //
|
---|
| 182 | // public void setOdgovorniLica(List<Vraboten> odgovorniLica) {
|
---|
| 183 | // this.odgovorniLica = odgovorniLica;
|
---|
| 184 | // }
|
---|
[ce6ad22] | 185 | }
|
---|