package parkup.entities; import javax.persistence.*; import java.util.ArrayList; import java.util.List; @Entity @Table(name = "parking_zone") public class ParkingZone { @Id @SequenceGenerator( name="parking_zone_generator", sequenceName = "parking_zone_sequence", allocationSize = 1, initialValue = 500 ) @GeneratedValue( //za postgres treba sequence da se namesti i ime na generator mi ga davamo kako od gore sto e strategy = GenerationType.SEQUENCE, generator = "parking_zone_sequence_generator" ) @Column(name = "parking_zone_id") private int pzId; @Column(name = "pz_name") private String pzName; @Column(name = "price") private int price; @Column(name = "capacity") private int capacity; @Column(name = "work_hours") private String workHours; @Column(name = "location") private String location; @Column(name = "zafateniMesta") private int zafateniMesta; @OneToMany(cascade = {CascadeType.ALL}) @JoinColumn(name = "parkingSpaces", nullable = false) private List parkingSpaces; public ParkingZone() { this.zafateniMesta = 0; this.parkingSpaces = new ArrayList(); } public ParkingZone(int pzId, String pzName, int price, int capacity, String workHours, String location, List parkingSpaces) { this.pzId = pzId; this.pzName = pzName; this.price = price; this.capacity = capacity; this.workHours = workHours; this.location = location; this.zafateniMesta = 0; this.parkingSpaces = parkingSpaces; } public ParkingZone(String pzName, int price, int capacity, String workHours, String location, List parkingSpaces) { this.pzName = pzName; this.price = price; this.capacity = capacity; this.workHours = workHours; this.location = location; this.zafateniMesta = 0; this.parkingSpaces = parkingSpaces; } public int getId() { return this.pzId; } public void setId(int pzId) { this.pzId = pzId; } public String getPzName() { return this.pzName; } public void setPzName(String pzName) { this.pzName = pzName; } public int getPrice() { return this.price; } public void setPrice(int price) { this.price = price; } public int getCapacity() { return this.capacity; } public void setCapacity(int capacity) { this.capacity = capacity; } public String getWorkHours() { return this.workHours; } public void setWorkHours(String workHours) { this.workHours = workHours; } public String getLocation() { return this.location; } public void setLocation(String location) { this.location = location; } public int getZafateniMesta() {return zafateniMesta;} public void setZafateniMesta(int zafateniMesta) {this.zafateniMesta = zafateniMesta;} public List getParkingSpaces() {return parkingSpaces;} public void setParkingSpaces(List parkingSpaces) {this.parkingSpaces = parkingSpaces;} }