File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
src/main/java/no/entur/mummu Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -466,4 +466,14 @@ public ScheduledStopPoint getScheduledStopPointById(@PathVariable String id) {
466466 public JAXBElement <ScheduledStopPoint > getJAXBElementScheduledStopPointById (@ PathVariable String id ) {
467467 return netexObjectFactory .createScheduledStopPoint (netexEntitiesService .getScheduledStopPoint (id ));
468468 }
469+
470+ @ GetMapping (value = "/scheduled-stop-points/{id}/stop-place" , produces = "application/json" )
471+ public StopPlace getStopPlaceByScheduledStopPointId (@ PathVariable String id ) {
472+ return netexEntitiesService .getStopPlaceByScheduledStopPointId (id );
473+ }
474+
475+ @ GetMapping (value = "/scheduled-stop-points/{id}/stop-place" , produces = "application/xml" )
476+ public JAXBElement <StopPlace > getJAXBElementStopPlacesByScheduledStopPointId (@ PathVariable String id ) {
477+ return netexObjectFactory .createStopPlace (netexEntitiesService .getStopPlaceByScheduledStopPointId (id ));
478+ }
469479}
Original file line number Diff line number Diff line change 2929import java .util .ArrayList ;
3030import java .util .Collection ;
3131import java .util .List ;
32+ import java .util .Objects ;
3233import java .util .Optional ;
3334import java .util .stream .Collectors ;
3435
@@ -336,4 +337,18 @@ public Collection<ScheduledStopPoint> getScheduledStopPointsForStopPlaceWithId(S
336337 public ScheduledStopPoint getScheduledStopPoint (String id ) {
337338 return netexEntitiesIndex .getScheduledStopPointIndex ().getLatestVersion (id );
338339 }
340+
341+ public StopPlace getStopPlaceByScheduledStopPointId (String id ) {
342+ return netexEntitiesIndex .getPassengerStopAssignmentsByStopPointRefIndex ().get (id ).stream ()
343+ .filter (Objects ::nonNull )
344+ .filter (passengerStopAssignment -> passengerStopAssignment .getStopPlaceRef () != null )
345+ .map (
346+ passengerStopAssignment ->
347+ netexEntitiesIndex .getStopPlaceIndex ().getVersion (
348+ passengerStopAssignment .getStopPlaceRef ().getRef (),
349+ passengerStopAssignment .getStopPlaceRef ().getVersion ()
350+ )
351+
352+ ).findFirst ().orElseThrow (NotFoundException ::new );
353+ }
339354}
You can’t perform that action at this time.
0 commit comments