Skip to content

Commit

Permalink
Merge pull request #361 from HSLdevcom/revert-parkandride-changes
Browse files Browse the repository at this point in the history
Revert parkandride changes
  • Loading branch information
vesameskanen authored Jun 15, 2021
2 parents 8cef2dc + 5fa8a22 commit f27ddf6
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 100 deletions.
12 changes: 0 additions & 12 deletions src/main/java/org/opentripplanner/index/IndexGraphQLSchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -2448,12 +2448,6 @@ public IndexGraphQLSchema(GraphIndex index) {
.type(Scalars.GraphQLFloat)
.dataFetcher(environment -> ((BikePark) environment.getSource()).y)
.build())
.field(GraphQLFieldDefinition.newFieldDefinition()
.name("tags")
.description("Additional information labels (tags) for the Bike park")
.type(new GraphQLList(GraphQLNonNull.nonNull(Scalars.GraphQLString)))
.dataFetcher(environment -> ((BikePark) environment.getSource()).tags)
.build())
.build();

ticketType = GraphQLObjectType.newObject()
Expand Down Expand Up @@ -2557,12 +2551,6 @@ public IndexGraphQLSchema(GraphIndex index) {
.type(Scalars.GraphQLFloat)
.dataFetcher(environment -> ((CarPark) environment.getSource()).y)
.build())
.field(GraphQLFieldDefinition.newFieldDefinition()
.name("tags")
.description("Additional information labels (tags) for the car park")
.type(new GraphQLList(GraphQLNonNull.nonNull(Scalars.GraphQLString)))
.dataFetcher(environment -> ((CarPark) environment.getSource()).tags)
.build())
.build();

GraphQLInputObjectType filterInputType = GraphQLInputObjectType.newInputObject()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package org.opentripplanner.routing.bike_park;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import javax.xml.bind.annotation.XmlAttribute;
Expand Down Expand Up @@ -41,9 +39,6 @@ public class BikePark implements Serializable {
@JsonSerialize
public boolean realTimeData = true;

@JsonSerialize
public List<String> tags;

public boolean equals(Object o) {
if (!(o instanceof BikePark)) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ the License, or (at your option) any later version.

import javax.xml.bind.annotation.XmlAttribute;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;


Expand Down Expand Up @@ -62,9 +60,6 @@ public class CarPark implements Serializable {

public Geometry geometry;

@JsonSerialize
public List<String> tags;

public boolean equals(Object o) {
if (!(o instanceof CarPark)) {
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package org.opentripplanner.updater.bike_park;

import java.util.ArrayList;
import java.util.List;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
Expand Down Expand Up @@ -47,21 +43,6 @@ public BikePark makeBikePark(JsonNode node) {
} else {
station.spacesAvailable = node.path("builtCapacity").path("BICYCLE").asInt();
}
List<String> tags = new ArrayList<String>();
ArrayNode servicesArray = (ArrayNode) node.get("services");
if (servicesArray.isArray()) {
for (JsonNode jsonNode : servicesArray) {
tags.add("SERVICE_" + jsonNode.asText());
}
}
ArrayNode authenticationMethods = (ArrayNode) node.get("authenticationMethods");
if (authenticationMethods.isArray()) {
for (JsonNode jsonNode : authenticationMethods) {
tags.add("AUTHENTICATION_METHOD_" + jsonNode.asText());
}
}
tags.add("PRICING_METHOD_" + node.path("pricingMethod").asText());
station.tags = tags;
return station;
} catch (Exception e) {
log.warn("Error parsing bike rental station " + station.id, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
Expand All @@ -19,10 +18,8 @@

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

Expand Down Expand Up @@ -66,21 +63,6 @@ public CarPark makeCarPark(JsonNode node) {
} else {
station.spacesAvailable = station.maxCapacity;
}
List<String> tags = new ArrayList<String>();
ArrayNode servicesArray = (ArrayNode) node.get("services");
if (servicesArray.isArray()) {
for (JsonNode jsonNode : servicesArray) {
tags.add("SERVICE_" + jsonNode.asText());
}
}
ArrayNode authenticationMethods = (ArrayNode) node.get("authenticationMethods");
if (authenticationMethods.isArray()) {
for (JsonNode jsonNode : authenticationMethods) {
tags.add("AUTHENTICATION_METHOD_" + jsonNode.asText());
}
}
tags.add("PRICING_METHOD_" + node.path("pricingMethod").asText());
station.tags = tags;
return station;
} catch (Exception e) {
log.warn("Error parsing car park " + station.id, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ public void testHslCarParkDataSource() throws Exception {
assertEquals(60.4553, ainola.y, 0.0003);
assertEquals(46, ainola.maxCapacity);
assertEquals(46, ainola.spacesAvailable);
assertEquals(4, ainola.tags.size());
assertEquals("SERVICE_LIGHTING", ainola.tags.get(0));
assertEquals("SERVICE_BICYCLE_FRAME_LOCK", ainola.tags.get(1));
assertEquals("AUTHENTICATION_METHOD_HSL_TRAVEL_CARD", ainola.tags.get(2));
assertEquals("PRICING_METHOD_PARK_AND_RIDE_247_FREE", ainola.tags.get(3));

CarPark fake = carParks.get(2);
assertEquals("Asemakuja itäinen", fake.name.toString());
Expand Down
48 changes: 12 additions & 36 deletions src/test/resources/bike/hsl.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@
"usages":
[
"PARK_AND_RIDE"
],
"services": ["LIGHTING","BICYCLE_FRAME_LOCK"],
"authenticationMethods": ["HSL_TRAVEL_CARD"]
]
},

{
Expand Down Expand Up @@ -146,9 +144,7 @@
"usages":
[
"PARK_AND_RIDE"
],
"services": [],
"authenticationMethods": []
]
},

{
Expand Down Expand Up @@ -220,9 +216,7 @@
"usages":
[
"PARK_AND_RIDE"
],
"services": [],
"authenticationMethods": []
]
},

{
Expand Down Expand Up @@ -299,9 +293,7 @@
"usages":
[
"PARK_AND_RIDE"
],
"services": [],
"authenticationMethods": []
]
},

{
Expand Down Expand Up @@ -373,9 +365,7 @@
"usages":
[
"PARK_AND_RIDE"
],
"services": [],
"authenticationMethods": []
]
},

{
Expand Down Expand Up @@ -447,9 +437,7 @@
"usages":
[
"PARK_AND_RIDE"
],
"services": [],
"authenticationMethods": []
]
},

{
Expand Down Expand Up @@ -521,9 +509,7 @@
"usages":
[
"PARK_AND_RIDE"
],
"services": [],
"authenticationMethods": []
]
},

{
Expand Down Expand Up @@ -595,9 +581,7 @@
"usages":
[
"PARK_AND_RIDE"
],
"services": [],
"authenticationMethods": []
]
},

{
Expand Down Expand Up @@ -670,9 +654,7 @@
"usages":
[
"PARK_AND_RIDE"
],
"services": [],
"authenticationMethods": []
]
},

{
Expand Down Expand Up @@ -744,9 +726,7 @@
"usages":
[
"PARK_AND_RIDE"
],
"services": [],
"authenticationMethods": []
]
},

{
Expand Down Expand Up @@ -818,9 +798,7 @@
"usages":
[
"PARK_AND_RIDE"
],
"services": [],
"authenticationMethods": []
]
},

{
Expand Down Expand Up @@ -892,9 +870,7 @@
"usages":
[
"PARK_AND_RIDE"
],
"services": [],
"authenticationMethods": []
]
}
]
}

0 comments on commit f27ddf6

Please sign in to comment.