Changeset 97fbc67 for sources/app/src/main/java/parkup/entities
- Timestamp:
- 11/11/21 11:55:43 (3 years ago)
- Branches:
- master
- Children:
- 2ace8f0
- Parents:
- 3a58bd6
- Location:
- sources/app/src/main/java/parkup/entities
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/app/src/main/java/parkup/entities/ParkingSession.java
r3a58bd6 r97fbc67 1 1 package parkup.entities; 2 3 import parkup.data.Tablicka; 2 4 3 5 import javax.persistence.*; … … 9 11 @Column(name = "parking_session_id") 10 12 @SequenceGenerator( 11 name="parking_session_ generator",13 name="parking_session_sequence_generator", 12 14 sequenceName = "parking_session_sequence", 13 15 allocationSize = 1, 14 initialValue = 70016 initialValue = 800 15 17 ) 16 18 @GeneratedValue( //za postgres treba sequence da se namesti i ime na generator mi ga davamo kako od gore sto e … … 26 28 private String timeEnd; 27 29 30 @OneToOne(cascade = {CascadeType.ALL}) 31 @JoinColumn(name = "reg_tablicka", nullable = false) 32 private Tablicka tablica; 33 28 34 public ParkingSession() {} 29 35 30 public ParkingSession(int pssId, String timeStart, String timeEnd ) {36 public ParkingSession(int pssId, String timeStart, String timeEnd, Tablicka tablica) { 31 37 this.pssId = pssId; 32 38 this.timeStart = timeStart; 33 39 this.timeEnd = timeEnd; 40 this.tablica = tablica; 34 41 } 35 42 36 public ParkingSession(String timeStart, String timeEnd ) {43 public ParkingSession(String timeStart, String timeEnd, Tablicka tablica) { 37 44 this.timeStart = timeStart; 38 45 this.timeEnd = timeEnd; 46 this.tablica = tablica; 39 47 } 40 48 … … 62 70 this.timeEnd = timeEnd; 63 71 } 72 73 public Tablicka getTablica() { 74 return tablica; 75 } 76 77 public void setTablica(Tablicka tablica) { 78 this.tablica = tablica; 79 } 64 80 } -
sources/app/src/main/java/parkup/entities/ParkingSpace.java
r3a58bd6 r97fbc67 9 9 @Column(name = "parking_space_id") 10 10 @SequenceGenerator( 11 name="parking_space_ generator",11 name="parking_space_sequence_generator", 12 12 sequenceName = "parking_space_sequence", 13 13 allocationSize = 1, 14 initialValue = 60014 initialValue = 700 15 15 ) 16 16 @GeneratedValue( //za postgres treba sequence da se namesti i ime na generator mi ga davamo kako od gore sto e … … 24 24 25 25 @Column(name = "isTaken") 26 private boolean isTaken;26 private Boolean isTaken; 27 27 28 28 @Column(name = "isHandicaped") 29 private boolean isHandicaped;29 private Boolean isHandicaped; 30 30 31 public ParkingSpace() {} 31 @Column(name = "latitude") 32 private float lat; 32 33 33 public ParkingSpace(int psId, String psName, boolean isTaken, boolean isHandicaped) { 34 @Column(name = "longitude") 35 private float lng; 36 37 // @OneToOne(cascade = {CascadeType.ALL}) 38 // @JoinColumn(name = "parking_zona") 39 // private ParkingZone parkingZone; 40 41 public ParkingSpace() { 42 System.out.println("Default ParkingSpace constructor" + lat); 43 } 44 45 public ParkingSpace(int psId, String psName, boolean isTaken, boolean isHandicaped, float lat, float lng) { 34 46 this.psId = psId; 35 47 this.psName = psName; 36 48 this.isTaken = isTaken; 37 49 this.isHandicaped = isHandicaped; 50 this.lat = lat; 51 this.lng = lng; 38 52 } 39 53 40 public ParkingSpace(String psName, boolean isTaken, boolean isHandicaped ) {54 public ParkingSpace(String psName, boolean isTaken, boolean isHandicaped, float lat, float lng) { 41 55 this.psName = psName; 42 56 this.isTaken = isTaken; 43 57 this.isHandicaped = isHandicaped; 58 this.lat = lat; 59 this.lng = lng; 44 60 } 45 61 … … 75 91 this.isHandicaped = isHandicaped; 76 92 } 93 94 public float getLat() { 95 return lat; 96 } 97 98 public void setLat(float lat) { 99 this.lat = lat; 100 } 101 102 public float getLng() { 103 return lng; 104 } 105 106 public void setLng(float lng) { 107 this.lng = lng; 108 } 109 110 @Override 111 public String toString() { 112 return "ParkingSpace{" + 113 "psName='" + psName + '\'' + 114 ", isTaken=" + isTaken + 115 ", isHandicaped=" + isHandicaped + 116 ", lat=" + lat + 117 ", lng=" + lng+ 118 '}'; 119 } 77 120 } 78 121 -
sources/app/src/main/java/parkup/entities/ParkingZone.java
r3a58bd6 r97fbc67 1 1 package parkup.entities; 2 3 import parkup.data.ParkingZoneLocation; 2 4 3 5 import javax.persistence.*; … … 10 12 @Id 11 13 @SequenceGenerator( 12 name="parking_zone_ generator",14 name="parking_zone_sequence_generator", 13 15 sequenceName = "parking_zone_sequence", 14 16 allocationSize = 1, 15 initialValue = 50017 initialValue = 600 16 18 ) 17 19 @GeneratedValue( //za postgres treba sequence da se namesti i ime na generator mi ga davamo kako od gore sto e … … 31 33 private int capacity; 32 34 33 @Column(name = " work_hours")34 private String workHours;35 @Column(name = "time_from") //za rabotni casovi od: 36 private int from; 35 37 36 @Column(name = "location") 38 @Column(name = "time_to") //za rabotni casovi do: 39 private int to; 40 41 @Column(name = "lokacija") 37 42 private String location; 38 43 … … 40 45 private int zafateniMesta; 41 46 47 @Column(name = "color") 48 private String color; 49 50 @ManyToMany(cascade = {CascadeType.ALL}) 51 @JoinColumn(name="odgovorniLica",nullable = true) 52 private List<Vraboten> odgovorniLica; 53 42 54 @OneToMany(cascade = {CascadeType.ALL}) 43 @JoinColumn(name = "parkingSpaces", nullable = false)44 55 private List<ParkingSpace> parkingSpaces; 45 56 46 public ParkingZone() { 57 @OneToOne(cascade = {CascadeType.ALL}) 58 private ParkingZoneLocation parkingZoneLocation; 59 60 public ParkingZone() { 61 this.zafateniMesta = 0; 62 this.parkingSpaces = new ArrayList<ParkingSpace>(); 63 } 64 65 public ParkingZone(String pzName) { 66 this.pzName = pzName; 47 67 this.zafateniMesta = 0; 48 68 this.parkingSpaces = new ArrayList<ParkingSpace>(); 49 69 } 50 70 51 public ParkingZone(int pzId, String pzName, int price, int capacity, String workHours, String location, List<ParkingSpace> parkingSpaces) {71 public ParkingZone(int pzId, String pzName, int price, int capacity, String location, List<ParkingSpace> parkingSpaces, String color, int from, int to) { 52 72 this.pzId = pzId; 53 73 this.pzName = pzName; 54 74 this.price = price; 55 75 this.capacity = capacity; 56 this.workHours = workHours;57 76 this.location = location; 58 77 this.zafateniMesta = 0; 59 78 this.parkingSpaces = parkingSpaces; 79 this.color = color; 80 this.from = from; 81 this.to = to; 60 82 } 61 83 62 public ParkingZone(String pzName, int price, int capacity, String workHours, String location, List<ParkingSpace> parkingSpaces) {84 public ParkingZone(String pzName, int price, int capacity, String location, List<ParkingSpace> parkingSpaces, String color, int from, int to) { 63 85 this.pzName = pzName; 64 86 this.price = price; 65 87 this.capacity = capacity; 66 this.workHours = workHours;67 88 this.location = location; 68 89 this.zafateniMesta = 0; 69 90 this.parkingSpaces = parkingSpaces; 91 this.color = color; 92 this.from = from; 93 this.to = to; 70 94 } 71 95 … … 102 126 } 103 127 104 public String getWorkHours() {105 return this.workHours;106 }107 108 public void setWorkHours(String workHours) {109 this.workHours = workHours;110 }111 112 128 public String getLocation() { 113 129 return this.location; … … 125 141 126 142 public void setParkingSpaces(List<ParkingSpace> parkingSpaces) {this.parkingSpaces = parkingSpaces;} 143 144 public String getColor() { 145 return color; 146 } 147 148 public void setColor(String color) { 149 this.color = color; 150 } 151 152 public int getFrom() { 153 return from; 154 } 155 156 public void setFrom(int from) { 157 this.from = from; 158 } 159 160 public int getTo() { 161 return to; 162 } 163 164 public void setTo(int to) { 165 this.to = to; 166 } 167 168 public ParkingZoneLocation getParkingZoneLocation() { 169 return parkingZoneLocation; 170 } 171 172 public void setParkingZoneLocation(ParkingZoneLocation parkingZoneLocation) { 173 this.parkingZoneLocation = parkingZoneLocation; 174 } 175 176 public List<Vraboten> getOdgovorniLica() { 177 return odgovorniLica; 178 } 179 180 public void setOdgovorniLica(List<Vraboten> odgovorniLica) { 181 this.odgovorniLica = odgovorniLica; 182 } 127 183 } -
sources/app/src/main/java/parkup/entities/RegistriranParkirac.java
r3a58bd6 r97fbc67 2 2 3 3 import java.util.ArrayList; 4 import java.util.Collection; 5 import java.util.Collections; 4 6 import java.util.List; 5 7 import javax.persistence.*; 6 8 9 import org.springframework.security.core.GrantedAuthority; 10 import org.springframework.security.core.authority.SimpleGrantedAuthority; 11 import org.springframework.security.core.userdetails.UserDetails; 7 12 import parkup.data.Tablicka; 8 13 9 14 @Entity 10 15 @Table(name = "registriranParkirac") 11 public class RegistriranParkirac {16 public class RegistriranParkirac implements UserDetails { 12 17 @Id 13 18 @SequenceGenerator( … … 33 38 private String password; 34 39 35 @OneToMany 40 @OneToMany(cascade ={CascadeType.ALL}) 36 41 @Column(name = "regTablicki") 37 42 private List<Tablicka> regTablicki; … … 46 51 private String role; 47 52 53 private boolean locked; 54 55 private boolean enabled; 56 48 57 public RegistriranParkirac() { 49 50 58 this.regTablicki = new ArrayList<Tablicka>(); 51 this.role = "ROLE_REGIST IRAN_PARKIRAC";59 this.role = "ROLE_REGISTRIRAN_PARKIRAC"; 52 60 } 53 61 … … 60 68 this.email = email; 61 69 this.mobile = mobile; 62 this.role = "ROLE_REGIST IRAN_PARKIRAC";70 this.role = "ROLE_REGISTRIRAN_PARKIRAC"; 63 71 } 64 72 … … 70 78 this.email = email; 71 79 this.mobile = mobile; 72 this.role = "ROLE_REGISTIRAN_PARKIRAC"; 80 this.role = "ROLE_REGISTRIRAN_PARKIRAC"; 81 } 82 83 public RegistriranParkirac(String name, String surname, String email, String password, String mobile) { 84 this.name = name; 85 this.surname = surname; 86 this.password = password; 87 this.email = email; 88 this.mobile = mobile; 89 this.role = "ROLE_REGISTRIRAN_PARKIRAC"; 73 90 } 74 91 … … 95 112 public void setSurname(String surname) { 96 113 this.surname = surname; 97 }98 99 public String getPassword() {100 return password;101 }102 103 public void setPassword(String password) {104 this.password = password;105 114 } 106 115 … … 132 141 133 142 public void setRole(String role) {this.role = role;} 143 144 @Override 145 public Collection<? extends GrantedAuthority> getAuthorities() { 146 SimpleGrantedAuthority authority = new SimpleGrantedAuthority(role); 147 return Collections.singleton(authority); 148 } 149 150 public String getPassword() { 151 return password; 152 } 153 154 public void setPassword(String password) { 155 this.password = password; 156 } 157 158 @Override 159 public String getUsername() { 160 return email; 161 } 162 163 @Override 164 public boolean isAccountNonExpired() { 165 return true; 166 } 167 168 @Override 169 public boolean isAccountNonLocked() { 170 return !locked; 171 } 172 173 @Override 174 public boolean isCredentialsNonExpired() { 175 return true; 176 } 177 178 @Override 179 public boolean isEnabled() { 180 return enabled; 181 } 134 182 } 135 183 -
sources/app/src/main/java/parkup/entities/Vraboten.java
r3a58bd6 r97fbc67 1 1 package parkup.entities; 2 2 3 import parkup.data.Tablicka; 3 import org.springframework.security.core.GrantedAuthority; 4 import org.springframework.security.core.userdetails.UserDetails; 5 import parkup.data.VrabotenDemo; 4 6 5 7 import javax.persistence.*; 6 8 import java.util.ArrayList; 9 import java.util.Collection; 7 10 import java.util.List; 8 11 9 12 @Entity 10 13 @Table(name = "vraboten") 11 public class Vraboten {14 public class Vraboten implements UserDetails { 12 15 @Id 13 16 @SequenceGenerator( … … 24 27 private int vrabotenId; 25 28 29 @Override 30 public String toString() { 31 return "Vraboten{" + 32 "firstName='" + firstName + '\'' + 33 ", lastName='" + lastName + '\'' + 34 ", parkingZones=" + parkingZones + 35 ", locked=" + locked + 36 ", enabled=" + enabled + 37 '}'; 38 } 39 26 40 @Column(name = "firstName") 27 41 private String firstName; … … 49 63 private String status; 50 64 51 @Column(name = "account") 52 private boolean account; 65 @Column(name="locked") 66 private boolean locked; 67 68 @Column(name = "enabled") 69 private boolean enabled; 70 53 71 54 72 public Vraboten() { 55 73 this.role = "ROLE_VRABOTEN"; 56 74 this.parkingZones = new ArrayList<ParkingZone>(); 57 this. account = true;75 this.enabled = false; 58 76 this.status = "neRaboti"; 59 77 } … … 68 86 this.parkingZones = parkingZones; 69 87 this.role = "ROLE_VRABOTEN"; 70 this. account = true;88 this.enabled = false; 71 89 this.status = "neRaboti"; 72 90 } … … 80 98 this.parkingZones = parkingZones; 81 99 this.role = "ROLE_VRABOTEN"; 82 this. account = true;100 this.enabled = false; 83 101 this.status = "neRaboti"; 102 } 103 104 public Vraboten(String firstName, String lastName, String email, String password, String mobile) { 105 this.firstName=firstName; 106 this.lastName=lastName; 107 this.email=email; 108 this.password=password; 109 this.mobile=mobile; 110 this.parkingZones=new ArrayList<>(); 111 this.enabled=false; 112 this.status="neRaboti"; 113 this.role="ROLE_VRABOTEN"; 84 114 } 85 115 … … 116 146 } 117 147 148 @Override 149 public Collection<? extends GrantedAuthority> getAuthorities() { 150 return null; 151 } 152 118 153 public String getPassword() { 119 154 return password; 120 155 } 121 156 157 @Override 158 public String getUsername() { 159 return email; 160 } 161 162 @Override 163 public boolean isAccountNonExpired() { 164 return true; 165 } 166 167 @Override 168 public boolean isAccountNonLocked() { 169 return !locked; 170 } 171 172 public void lockVraboten(){ 173 this.locked = !locked; 174 } 175 176 @Override 177 public boolean isCredentialsNonExpired() { 178 return true; 179 } 180 181 @Override 182 public boolean isEnabled() { 183 return enabled; 184 } 185 122 186 public void setPassword(String password) { 123 187 this.password = password; … … 144 208 public void setStatus(String status) {this.status = status;} 145 209 146 public boolean isAccount() {return account;}147 148 public void setAccount(boolean account) {this. account= account;}210 public boolean isAccount() {return enabled;} 211 212 public void setAccount(boolean account) {this.enabled = account;} 149 213 }
Note:
See TracChangeset
for help on using the changeset viewer.