Changeset f6bc52d for sources/app/src/main/java/parkup/entities
- Timestamp:
- 11/04/21 16:59:49 (3 years ago)
- Branches:
- master
- Children:
- 9504a09
- Parents:
- ce6ad22
- Location:
- sources/app/src/main/java/parkup/entities
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/app/src/main/java/parkup/entities/ParkingSession.java
rce6ad22 rf6bc52d 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
rce6ad22 rf6bc52d 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 … … 29 29 private boolean isHandicaped; 30 30 31 @Column(name = "latitude") 32 private float lat; 33 34 @Column(name = "longitude") 35 private float lng; 36 37 @OneToOne(cascade = {CascadeType.ALL}) 38 @JoinColumn(name = "parking_zona") 39 private ParkingZone parkingZone; 40 31 41 public ParkingSpace() {} 32 42 33 public ParkingSpace(int psId, String psName, boolean isTaken, boolean isHandicaped ) {43 public ParkingSpace(int psId, String psName, boolean isTaken, boolean isHandicaped, float lat, float lng) { 34 44 this.psId = psId; 35 45 this.psName = psName; 36 46 this.isTaken = isTaken; 37 47 this.isHandicaped = isHandicaped; 48 this.lat = lat; 49 this.lng = lng; 38 50 } 39 51 40 public ParkingSpace(String psName, boolean isTaken, boolean isHandicaped ) {52 public ParkingSpace(String psName, boolean isTaken, boolean isHandicaped, float lat, float lng) { 41 53 this.psName = psName; 42 54 this.isTaken = isTaken; 43 55 this.isHandicaped = isHandicaped; 56 this.lat = lat; 57 this.lng = lng; 44 58 } 45 59 … … 75 89 this.isHandicaped = isHandicaped; 76 90 } 91 92 public float getLat() { 93 return lat; 94 } 95 96 public void setLat(float lat) { 97 this.lat = lat; 98 } 99 100 public float getLng() { 101 return lng; 102 } 103 104 public void setLng(float lng) { 105 this.lng = lng; 106 } 77 107 } 78 108 -
sources/app/src/main/java/parkup/entities/ParkingZone.java
rce6ad22 rf6bc52d 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 = "vreme_od") //za rabotni casovi od: 36 private int from; 35 37 36 @Column(name = "location") 38 @Column(name = "vreme_do") //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
rce6ad22 rf6bc52d 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
rce6ad22 rf6bc52d 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( … … 49 52 private String status; 50 53 51 @Column(name = "account") 52 private boolean account; 54 @Column(name="locked") 55 private boolean locked; 56 57 @Column(name = "enabled") 58 private boolean enabled; 59 53 60 54 61 public Vraboten() { 55 62 this.role = "ROLE_VRABOTEN"; 56 63 this.parkingZones = new ArrayList<ParkingZone>(); 57 this. account = true;64 this.enabled = false; 58 65 this.status = "neRaboti"; 59 66 } … … 68 75 this.parkingZones = parkingZones; 69 76 this.role = "ROLE_VRABOTEN"; 70 this. account = true;77 this.enabled = false; 71 78 this.status = "neRaboti"; 72 79 } … … 80 87 this.parkingZones = parkingZones; 81 88 this.role = "ROLE_VRABOTEN"; 82 this. account = true;89 this.enabled = false; 83 90 this.status = "neRaboti"; 91 } 92 93 public Vraboten(String firstName, String lastName, String email, String password, String mobile) { 94 this.firstName=firstName; 95 this.lastName=lastName; 96 this.email=email; 97 this.password=password; 98 this.mobile=mobile; 99 this.parkingZones=new ArrayList<>(); 100 this.enabled=false; 101 this.status="neRaboti"; 102 this.role="ROLE_VRABOTEN"; 84 103 } 85 104 … … 116 135 } 117 136 137 @Override 138 public Collection<? extends GrantedAuthority> getAuthorities() { 139 return null; 140 } 141 118 142 public String getPassword() { 119 143 return password; 120 144 } 121 145 146 @Override 147 public String getUsername() { 148 return email; 149 } 150 151 @Override 152 public boolean isAccountNonExpired() { 153 return true; 154 } 155 156 @Override 157 public boolean isAccountNonLocked() { 158 return !locked; 159 } 160 161 public void lockVraboten(){ 162 this.locked = !locked; 163 } 164 165 @Override 166 public boolean isCredentialsNonExpired() { 167 return true; 168 } 169 170 @Override 171 public boolean isEnabled() { 172 return enabled; 173 } 174 122 175 public void setPassword(String password) { 123 176 this.password = password; … … 144 197 public void setStatus(String status) {this.status = status;} 145 198 146 public boolean isAccount() {return account;}147 148 public void setAccount(boolean account) {this. account= account;}199 public boolean isAccount() {return enabled;} 200 201 public void setAccount(boolean account) {this.enabled = account;} 149 202 }
Note:
See TracChangeset
for help on using the changeset viewer.