Skip to content

Commit

Permalink
Transmodel GraphQL API - Clean code, cleanup TransmodelMappingUtil.
Browse files Browse the repository at this point in the history
  - Rename mapping methods to mapToApi, mapToDomain...
  - Move `getMonoOrMultiModalStation` method to Graph where this kind of functionality should be.
  • Loading branch information
t2gran committed Aug 10, 2020
1 parent ee76517 commit dc0a6c6
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
public class LegacyGraphQLAPI {

@SuppressWarnings("unused")
private static final Logger LOG = LoggerFactory.getLogger(org.opentripplanner.ext.transmodelapi.TransmodelIndexAPI.class);
private static final Logger LOG = LoggerFactory.getLogger(LegacyGraphQLAPI.class);

private final Router router;
private final ObjectMapper deserializer = new ObjectMapper();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private GenericLocation toGenericLocation(Map<String, Object> m) {
}

String placeRef = (String) m.get("place");
FeedScopedId stopId = placeRef == null ? null : mappingUtil.fromIdString(placeRef);
FeedScopedId stopId = placeRef == null ? null : mappingUtil.mapIdToDomain(placeRef);
String name = (String) m.get("name");
name = name == null ? "" : name;

Expand Down Expand Up @@ -302,7 +302,7 @@ private RoutingRequest createRequest(DataFetchingEnvironment environment) {
}

private HashMap<FeedScopedId, BannedStopSet> toBannedTrips(Collection<String> serviceJourneyIds) {
Map<FeedScopedId, BannedStopSet> bannedTrips = serviceJourneyIds.stream().map(mappingUtil::fromIdString).collect(Collectors.toMap(Function.identity(), id -> BannedStopSet.ALL));
Map<FeedScopedId, BannedStopSet> bannedTrips = serviceJourneyIds.stream().map(mappingUtil::mapIdToDomain).collect(Collectors.toMap(Function.identity(), id -> BannedStopSet.ALL));
return new HashMap<>(bannedTrips);
}

Expand Down
Loading

0 comments on commit dc0a6c6

Please sign in to comment.