david_implement_trip_controller #1
@@ -10,3 +10,4 @@ services:
|
||||
- POSTGRES_DB=sumoc
|
||||
ports:
|
||||
- "5432:5432"
|
||||
restart: always
|
||||
|
||||
@@ -50,6 +50,10 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -2,7 +2,6 @@ package SuMoC.backend.controller;
|
||||
|
||||
import SuMoC.backend.models.dto.MinimalUserDTO;
|
||||
import SuMoC.backend.models.enums.VisibilityPrivacy;
|
||||
import SuMoC.backend.security.services.Userservice;
|
||||
import SuMoC.backend.service.UserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
|
||||
@@ -25,17 +25,17 @@ public class Friendship {
|
||||
private FriendShipStatus status;
|
||||
|
||||
@Column(nullable = false)
|
||||
private LocalDateTime createAt;
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
public Friendship() {
|
||||
}
|
||||
|
||||
public Friendship(Long id, User user, User friend, FriendShipStatus status, LocalDateTime createAt) {
|
||||
public Friendship(Long id, User user, User friend, FriendShipStatus status, LocalDateTime createdAt) {
|
||||
this.id = id;
|
||||
this.user = user;
|
||||
this.friend = friend;
|
||||
this.status = status;
|
||||
this.createAt = createAt;
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
@@ -70,11 +70,11 @@ public class Friendship {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreateAt() {
|
||||
return createAt;
|
||||
public LocalDateTime getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreateAt(LocalDateTime createAt) {
|
||||
this.createAt = createAt;
|
||||
public void setCreatedAt(LocalDateTime createAt) {
|
||||
this.createdAt = createAt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package SuMoC.backend.models;
|
||||
|
||||
|
||||
import SuMoC.backend.models.enums.Modality;
|
||||
import SuMoC.backend.trip.models.Trip;
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -28,16 +29,16 @@ public class TripSegment {
|
||||
* Distance of the segment in meters.
|
||||
*/
|
||||
@Column(nullable = false)
|
||||
private Long distance;
|
||||
private Long distanceMeters;
|
||||
|
||||
public TripSegment() {}
|
||||
|
||||
public TripSegment(Long id, Trip trip, Modality modality, LocalDateTime startTime, Long distance) {
|
||||
public TripSegment(Long id, Trip trip, Modality modality, LocalDateTime startTime, Long distanceMeters) {
|
||||
this.id = id;
|
||||
this.trip = trip;
|
||||
this.modality = modality;
|
||||
this.startTime = startTime;
|
||||
this.distance = distance;
|
||||
this.distanceMeters = distanceMeters;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
@@ -72,11 +73,11 @@ public class TripSegment {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public Long getDistance() {
|
||||
return distance;
|
||||
public Long getDistanceMeters() {
|
||||
return distanceMeters;
|
||||
}
|
||||
|
||||
public void setDistance(Long distance) {
|
||||
this.distance = distance;
|
||||
public void setDistanceMeters(Long distance) {
|
||||
this.distanceMeters = distance;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package SuMoC.backend.models;
|
||||
|
||||
import SuMoC.backend.models.enums.RoleName;
|
||||
import SuMoC.backend.models.enums.VisibilityPrivacy;
|
||||
import SuMoC.backend.trip.models.Trip;
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
@@ -88,6 +88,7 @@ public class SecurityConfiguration {
|
||||
auth.requestMatchers("/auth/user/**").permitAll();
|
||||
auth.requestMatchers("/admin/**").hasRole("ADMIN"); //looks for "ROLE_ADMIN" //alternative: hasAuthoritiy("ADMIN")
|
||||
auth.requestMatchers("/user/**").hasAnyRole("ADMIN", "USER");
|
||||
auth.requestMatchers("/trip/**").hasAnyRole( "USER", "ADMIN");
|
||||
auth.requestMatchers(AUTH_WHITELIST).permitAll();
|
||||
//auth.requestMatchers("/error").permitAll();
|
||||
auth.anyRequest().authenticated();
|
||||
|
||||
+8
-2
@@ -15,7 +15,7 @@ import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class Userservice implements UserDetailsService {
|
||||
public class UserSecurityService implements UserDetailsService {
|
||||
|
||||
private PasswordEncoder encoder;
|
||||
|
||||
@@ -23,11 +23,17 @@ public class Userservice implements UserDetailsService {
|
||||
|
||||
|
||||
@Autowired
|
||||
public Userservice(PasswordEncoder encoder, UserRepository userRepository){
|
||||
public UserSecurityService(PasswordEncoder encoder, UserRepository userRepository){
|
||||
this.encoder = encoder;
|
||||
this.userRepository = userRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads user based on email address.
|
||||
* @param email
|
||||
* @return
|
||||
* @throws UsernameNotFoundException
|
||||
*/
|
||||
@Override
|
||||
public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException {
|
||||
// Jetzt suchen wir nach der E-Mail-Adresse
|
||||
@@ -0,0 +1,46 @@
|
||||
package SuMoC.backend.trip;
|
||||
|
||||
|
||||
import SuMoC.backend.trip.dtos.NewTripDTO;
|
||||
import SuMoC.backend.trip.dtos.TripDTO;
|
||||
import SuMoC.backend.trip.models.Trip;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import jakarta.validation.Valid;
|
||||
import org.apache.commons.lang3.NotImplementedException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/trip")
|
||||
public class TripController {
|
||||
private TripService tripService;
|
||||
|
||||
@Autowired
|
||||
public TripController(TripService tripService) {
|
||||
this.tripService = tripService;
|
||||
}
|
||||
|
||||
@Operation(summary = "User uploads a new trip from the App.")
|
||||
@PostMapping("/uploadTrip")
|
||||
public ResponseEntity<Void> uploadTrip(@Valid @RequestBody NewTripDTO newTripDTO) {
|
||||
String userEmail = SecurityContextHolder.getContext().getAuthentication().getName();
|
||||
|
||||
tripService.addTrip(userEmail, newTripDTO);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).build();
|
||||
}
|
||||
|
||||
@Operation(summary = "Retrieve all trips of the authenticated user.")
|
||||
@GetMapping("/getAllUserTrips")
|
||||
public ResponseEntity<List<TripDTO>> getAllUserTrips() {
|
||||
String userEmail = SecurityContextHolder.getContext().getAuthentication().getName();
|
||||
|
||||
List<TripDTO> userTrips = tripService.getAllTripsOfUser(userEmail);
|
||||
return ResponseEntity.ok(userTrips);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package SuMoC.backend.trip;
|
||||
|
||||
import SuMoC.backend.trip.dtos.NewTripDTO;
|
||||
import SuMoC.backend.trip.dtos.TripDTO;
|
||||
import SuMoC.backend.trip.models.Trip;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper(componentModel = "spring", uses = TripSegmentMapper.class)
|
||||
public interface TripMapper {
|
||||
@Mapping(source = "id", target = "tripId")
|
||||
@Mapping(source = "user.id", target = "userId")
|
||||
TripDTO toTripDTO(Trip trip);
|
||||
|
||||
List<TripDTO> toTripDTOs(List<Trip> trips);
|
||||
|
||||
@Mapping(source = "tripSegments", target = "tripSegments")
|
||||
Trip toTrip(NewTripDTO newTripDTO);
|
||||
}
|
||||
+5
-2
@@ -1,10 +1,13 @@
|
||||
package SuMoC.backend.repositories;
|
||||
package SuMoC.backend.trip;
|
||||
|
||||
import SuMoC.backend.models.Trip;
|
||||
import SuMoC.backend.models.User;
|
||||
import SuMoC.backend.trip.models.Trip;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface TripRepository extends JpaRepository<Trip,Long> {
|
||||
Optional<Trip> findTripById(Long id);
|
||||
Optional<List<Trip>> findAllByUser(User user);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package SuMoC.backend.trip;
|
||||
|
||||
import SuMoC.backend.models.TripSegment;
|
||||
import SuMoC.backend.trip.dtos.NewTripSegmentDTO;
|
||||
import SuMoC.backend.trip.dtos.TripSegmentDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface TripSegmentMapper {
|
||||
@Mapping(source = "id", target = "tripSegmentId")
|
||||
@Mapping(source = "trip.id", target = "tripId")
|
||||
TripSegmentDTO toTripSegmentDTO(TripSegment tripSegment);
|
||||
|
||||
List<TripSegmentDTO> toTripSegmentDTOs(List<TripSegment> tripSegments);
|
||||
|
||||
TripSegment toTripSegment(NewTripSegmentDTO newTripSegmentDTO);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package SuMoC.backend.trip;
|
||||
|
||||
|
||||
import SuMoC.backend.repositories.UserRepository;
|
||||
import SuMoC.backend.trip.dtos.NewTripDTO;
|
||||
import SuMoC.backend.trip.dtos.TripDTO;
|
||||
import SuMoC.backend.trip.models.Trip;
|
||||
import jakarta.transaction.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class TripService {
|
||||
private final TripRepository tripRepository;
|
||||
private final TripMapper tripMapper;
|
||||
private final UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
public TripService(TripRepository tripRepository,
|
||||
TripMapper tripMapper,
|
||||
UserRepository userRepository
|
||||
) {
|
||||
this.tripRepository = tripRepository;
|
||||
this.tripMapper = tripMapper;
|
||||
this.userRepository = userRepository;
|
||||
}
|
||||
|
||||
public void addTrip(String email, NewTripDTO newTripDTO) {
|
||||
var user = userRepository.findByEmail(email).orElseThrow();
|
||||
Trip trip = tripMapper.toTrip(newTripDTO);
|
||||
trip.setUser(user);
|
||||
trip.getTripSegments().forEach(tripSegment -> tripSegment.setTrip(trip));
|
||||
tripRepository.save(trip);
|
||||
}
|
||||
|
||||
public List<TripDTO> getAllTripsOfUser(String email) {
|
||||
var user = userRepository.findByEmail(email).orElseThrow();
|
||||
List<Trip> trips = tripRepository.findAllByUser(user).orElseThrow();
|
||||
return tripMapper.toTripDTOs(trips);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package SuMoC.backend.trip.dtos;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* DTO representing a trip submitted from the App which is not yet persisted in the database.
|
||||
* TODO assumption is that cost of trip is calculated server-side
|
||||
*/
|
||||
@Schema(description = "DTO for creating a new Trip")
|
||||
public class NewTripDTO {
|
||||
private String startPlace; // High level description of the trip's starting location
|
||||
private String endPlace; // High level description of the trip's ending location
|
||||
private LocalDateTime startTime;
|
||||
private LocalDateTime endTime;
|
||||
private float mobilityScore;
|
||||
@NotNull
|
||||
@Size(min = 1, message = "Trip must contain at least one segment.")
|
||||
private Set<NewTripSegmentDTO> tripSegments;
|
||||
|
||||
public NewTripDTO() {}
|
||||
|
||||
public NewTripDTO (String startPlace, String endPlace, LocalDateTime startTime, LocalDateTime endTime, float mobilityScore, Set<NewTripSegmentDTO> tripSegments) {
|
||||
this.startPlace = startPlace;
|
||||
this.endPlace = endPlace;
|
||||
this.startTime = startTime;
|
||||
this.endTime = endTime;
|
||||
this.mobilityScore = mobilityScore;
|
||||
this.tripSegments = tripSegments;
|
||||
}
|
||||
|
||||
public String getStartPlace() {
|
||||
return startPlace;
|
||||
}
|
||||
|
||||
public void setStartPlace(String startPlace) {
|
||||
this.startPlace = startPlace;
|
||||
}
|
||||
|
||||
public String getEndPlace() {
|
||||
return endPlace;
|
||||
}
|
||||
|
||||
public void setEndPlace(String endPlace) {
|
||||
this.endPlace = endPlace;
|
||||
}
|
||||
|
||||
public LocalDateTime getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(LocalDateTime startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(LocalDateTime endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public float getMobilityScore() {
|
||||
return mobilityScore;
|
||||
}
|
||||
|
||||
public void setMobilityScore(float mobilityScore) {
|
||||
this.mobilityScore = mobilityScore;
|
||||
}
|
||||
|
||||
public Set<NewTripSegmentDTO> getTripSegments() {
|
||||
return tripSegments;
|
||||
}
|
||||
|
||||
public void setTripSegments(Set<NewTripSegmentDTO> tripSegments) {
|
||||
this.tripSegments = tripSegments;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package SuMoC.backend.trip.dtos;
|
||||
|
||||
import SuMoC.backend.models.enums.Modality;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* DTO representing a trip segment submitted from the App which is not yet persisted in the database.
|
||||
*/
|
||||
public class NewTripSegmentDTO {
|
||||
private Modality modality;
|
||||
private LocalDateTime startTime;
|
||||
private float distanceMeters;
|
||||
|
||||
public NewTripSegmentDTO() { }
|
||||
|
||||
public NewTripSegmentDTO(Modality modality, LocalDateTime startTime, float distanceMeters) {
|
||||
this.modality = modality;
|
||||
this.startTime = startTime;
|
||||
this.distanceMeters = distanceMeters;
|
||||
}
|
||||
|
||||
public Modality getModality() {
|
||||
return modality;
|
||||
}
|
||||
|
||||
public LocalDateTime getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public float getDistanceMeters() {
|
||||
return distanceMeters;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package SuMoC.backend.trip.dtos;
|
||||
|
||||
import SuMoC.backend.models.TripSegment;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* DTO representing a trip already persisted in the database.
|
||||
*/
|
||||
public class TripDTO {
|
||||
private long tripId;
|
||||
private int userId;
|
||||
private String startPlace;
|
||||
private String endPlace;
|
||||
private LocalDateTime startTime;
|
||||
private LocalDateTime endTime;
|
||||
private float mobilityScore;
|
||||
private List<TripSegmentDTO> tripSegments;
|
||||
|
||||
public TripDTO() {}
|
||||
|
||||
public TripDTO(int userId, String startPlace, String endPlace, LocalDateTime startTime, LocalDateTime endTime, float mobilityScore, List<TripSegmentDTO> tripSegmentDTOS) {
|
||||
this.userId = userId;
|
||||
this.startPlace = startPlace;
|
||||
this.endPlace = endPlace;
|
||||
this.startTime = startTime;
|
||||
this.endTime = endTime;
|
||||
this.mobilityScore = mobilityScore;
|
||||
this.tripSegments = tripSegmentDTOS;
|
||||
}
|
||||
|
||||
public long getTripId() {
|
||||
return tripId;
|
||||
}
|
||||
|
||||
public void setTripId(long tripId) {
|
||||
this.tripId = tripId;
|
||||
}
|
||||
|
||||
public int getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(int userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getStartPlace() {
|
||||
return startPlace;
|
||||
}
|
||||
|
||||
public void setStartPlace(String startPlace) {
|
||||
this.startPlace = startPlace;
|
||||
}
|
||||
|
||||
public String getEndPlace() {
|
||||
return endPlace;
|
||||
}
|
||||
|
||||
public void setEndPlace(String endPlace) {
|
||||
this.endPlace = endPlace;
|
||||
}
|
||||
|
||||
public LocalDateTime getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(LocalDateTime startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(LocalDateTime endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public float getMobilityScore() {
|
||||
return mobilityScore;
|
||||
}
|
||||
|
||||
public void setMobilityScore(float mobilityScore) {
|
||||
this.mobilityScore = mobilityScore;
|
||||
}
|
||||
|
||||
public List<TripSegmentDTO> getTripSegments() {
|
||||
return tripSegments;
|
||||
}
|
||||
|
||||
public void setTripSegments(List<TripSegmentDTO> tripSegments) {
|
||||
this.tripSegments = tripSegments;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package SuMoC.backend.trip.dtos;
|
||||
|
||||
import SuMoC.backend.models.enums.Modality;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* DTO representing a trip segment already persisted in the database.
|
||||
*/
|
||||
public class TripSegmentDTO {
|
||||
private long tripSegmentId;
|
||||
private long tripId;
|
||||
private Modality modality;
|
||||
private LocalDateTime startTime;
|
||||
private float distanceMeters;
|
||||
|
||||
public TripSegmentDTO() {}
|
||||
|
||||
public TripSegmentDTO(long tripSegmentId, long tripId, Modality modality, LocalDateTime startTime, float distanceMeters) {
|
||||
this.tripSegmentId = tripSegmentId;
|
||||
this.tripId = tripId;
|
||||
this.modality = modality;
|
||||
this.startTime = startTime;
|
||||
this.distanceMeters = distanceMeters;
|
||||
}
|
||||
|
||||
public long getTripSegmentId() {
|
||||
return tripSegmentId;
|
||||
}
|
||||
|
||||
public void setTripSegmentId(long tripSegmentId) {
|
||||
this.tripSegmentId = tripSegmentId;
|
||||
}
|
||||
|
||||
public long getTripId() {
|
||||
return tripId;
|
||||
}
|
||||
|
||||
public void setTripId(long tripId) {
|
||||
this.tripId = tripId;
|
||||
}
|
||||
|
||||
public Modality getModality() {
|
||||
return modality;
|
||||
}
|
||||
|
||||
public void setModality(Modality modality) {
|
||||
this.modality = modality;
|
||||
}
|
||||
|
||||
public LocalDateTime getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(LocalDateTime startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public float getDistanceMeters() {
|
||||
return distanceMeters;
|
||||
}
|
||||
|
||||
public void setDistanceMeters(float distanceMeters) {
|
||||
this.distanceMeters = distanceMeters;
|
||||
}
|
||||
}
|
||||
+16
-14
@@ -1,6 +1,8 @@
|
||||
package SuMoC.backend.models;
|
||||
package SuMoC.backend.trip.models;
|
||||
|
||||
|
||||
import SuMoC.backend.models.TripSegment;
|
||||
import SuMoC.backend.models.User;
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.util.HashSet;
|
||||
@@ -34,27 +36,27 @@ public class Trip {
|
||||
* Mobilityscore for the trip. TODO determine if this needs an own data type
|
||||
*/
|
||||
@Column(nullable = false)
|
||||
private float score;
|
||||
private float mobilityScore;
|
||||
|
||||
@Column(nullable = true)
|
||||
private float cost;
|
||||
|
||||
@OneToMany(mappedBy = "trip", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private Set<TripSegment> segments = new HashSet<>();
|
||||
private Set<TripSegment> tripSegments = new HashSet<>();
|
||||
|
||||
|
||||
public Trip() {}
|
||||
|
||||
public Trip(Long id, User user, String startPlace, String endPlace, LocalDateTime startTime, LocalDateTime endTime, float score, float cost, Set<TripSegment> segments) {
|
||||
public Trip(Long id, User user, String startPlace, String endPlace, LocalDateTime startTime, LocalDateTime endTime, float mobilityScore, float cost, Set<TripSegment> tripSegments) {
|
||||
this.id = id;
|
||||
this.user = user;
|
||||
this.startPlace = startPlace;
|
||||
this.endPlace = endPlace;
|
||||
this.startTime = startTime;
|
||||
this.endTime = endTime;
|
||||
this.score = score;
|
||||
this.mobilityScore = mobilityScore;
|
||||
this.cost = cost;
|
||||
this.segments = segments;
|
||||
this.tripSegments = tripSegments;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
@@ -105,12 +107,12 @@ public class Trip {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public float getScore() {
|
||||
return score;
|
||||
public float getMobilityScore() {
|
||||
return mobilityScore;
|
||||
}
|
||||
|
||||
public void setScore(float score) {
|
||||
this.score = score;
|
||||
public void setMobilityScore(float mobilityScore) {
|
||||
this.mobilityScore = mobilityScore;
|
||||
}
|
||||
|
||||
public float getCost() {
|
||||
@@ -121,11 +123,11 @@ public class Trip {
|
||||
this.cost = cost;
|
||||
}
|
||||
|
||||
public Set<TripSegment> getSegments() {
|
||||
return segments;
|
||||
public Set<TripSegment> getTripSegments() {
|
||||
return tripSegments;
|
||||
}
|
||||
|
||||
public void setSegments(Set<TripSegment> segments) {
|
||||
this.segments = segments;
|
||||
public void setTripSegments(Set<TripSegment> segments) {
|
||||
this.tripSegments = segments;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user