Reformat Implementations
This commit is contained in:
parent
37b60c4eeb
commit
a0b099cbc3
@ -4,86 +4,87 @@ import dst.ass1.jpa.model.*;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
@Entity
|
||||
public class Driver implements IDriver {
|
||||
@Id
|
||||
private Long id;
|
||||
@Id @GeneratedValue private Long id;
|
||||
private String name;
|
||||
@NotNull
|
||||
private String tel;
|
||||
@NotNull private String tel;
|
||||
private Double avgRating;
|
||||
|
||||
@OneToMany
|
||||
private Collection<IMatch> matches;
|
||||
@ManyToOne
|
||||
@OneToMany(targetEntity = Match.class)
|
||||
private Collection<IMatch> matches = new ArrayList<>();
|
||||
|
||||
@ManyToOne(targetEntity = Vehicle.class)
|
||||
private IVehicle vehicle;
|
||||
@ManyToMany
|
||||
private Collection<IOrganization> organizations;
|
||||
|
||||
@OneToMany(targetEntity = Employment.class)
|
||||
private Collection<IEmployment> employments;
|
||||
|
||||
@Override
|
||||
public Collection<IEmployment> getEmployments() {
|
||||
return null;
|
||||
return employments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEmployments(Collection<IEmployment> employments) {
|
||||
|
||||
this.employments = employments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEmployment(IEmployment employment) {
|
||||
|
||||
this.employments.add(employment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVehicle getVehicle() {
|
||||
return null;
|
||||
return vehicle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVehicle(IVehicle vehicle) {
|
||||
|
||||
this.vehicle = vehicle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return null;
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(Long id) {
|
||||
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return null;
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTel() {
|
||||
return null;
|
||||
return tel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTel(String tel) {
|
||||
|
||||
this.tel = tel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getAvgRating() {
|
||||
return null;
|
||||
return avgRating;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAvgRating(Double avgRating) {
|
||||
|
||||
this.avgRating = avgRating;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,19 +3,16 @@ package dst.ass1.jpa.model.impl;
|
||||
import dst.ass1.jpa.model.ILocation;
|
||||
import dst.ass1.jpa.model.ITrip;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.*;
|
||||
import java.util.Collection;
|
||||
|
||||
@Entity
|
||||
public class Location implements ILocation {
|
||||
@Id
|
||||
private Long id;
|
||||
@Id @GeneratedValue private Long id;
|
||||
private String name;
|
||||
private Long locationId;
|
||||
|
||||
@ManyToMany(mappedBy = "stops")
|
||||
@ManyToMany(targetEntity = Trip.class)
|
||||
private Collection<ITrip> trips;
|
||||
|
||||
@Override
|
||||
|
||||
@ -7,17 +7,17 @@ import java.util.Date;
|
||||
|
||||
@Entity
|
||||
public class Match implements IMatch {
|
||||
@Id
|
||||
private Long id;
|
||||
@Id @GeneratedValue private Long id;
|
||||
private Date date;
|
||||
@Embedded
|
||||
private IMoney fare;
|
||||
@Embedded private IMoney fare;
|
||||
|
||||
@OneToOne
|
||||
@OneToOne(targetEntity = Trip.class)
|
||||
private ITrip trip;
|
||||
@ManyToOne
|
||||
|
||||
@ManyToOne(targetEntity = Vehicle.class)
|
||||
private IVehicle vehicle;
|
||||
@ManyToOne
|
||||
|
||||
@ManyToOne(targetEntity = Driver.class)
|
||||
private IDriver driver;
|
||||
|
||||
@Override
|
||||
|
||||
@ -2,16 +2,13 @@ package dst.ass1.jpa.model.impl;
|
||||
|
||||
import dst.ass1.jpa.model.*;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.*;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
@Entity
|
||||
public class Trip implements ITrip {
|
||||
@Id
|
||||
private Long id;
|
||||
@Id @GeneratedValue private Long id;
|
||||
private Date created;
|
||||
private Date updated;
|
||||
private TripState state;
|
||||
|
||||
@ -21,7 +21,7 @@ public class TripInfo implements ITripInfo {
|
||||
private Integer driverRating;
|
||||
private Integer riderRating;
|
||||
|
||||
@OneToOne
|
||||
@OneToOne(targetEntity = Trip.class)
|
||||
private ITrip trip;
|
||||
|
||||
@Override
|
||||
|
||||
@ -17,11 +17,11 @@ public class Vehicle implements IVehicle {
|
||||
private String color;
|
||||
private String type;
|
||||
|
||||
@OneToMany
|
||||
@OneToMany(targetEntity = Driver.class)
|
||||
private Collection<IDriver> driver;
|
||||
@OneToMany
|
||||
@OneToMany(targetEntity = Match.class)
|
||||
private Collection<IMatch> match;
|
||||
@ManyToMany
|
||||
@ManyToMany(mappedBy = "vehicles", targetEntity = Organization.class)
|
||||
private Collection<IOrganization> organization;
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user