use of org.onebusaway.gtfs_transformer.updates.TrimTripTransformStrategy in project onebusaway-gtfs-modules by OneBusAway.
the class TransformFactory method handleTrimOperation.
private void handleTrimOperation(String line, JSONObject json) throws JSONException, TransformSpecificationException {
TypedEntityMatch match = getMatch(line, json);
if (match.getType() != Trip.class) {
throw new TransformSpecificationException("the trim_trip op only supports matching against trips", line);
}
TrimTripTransformStrategy strategy = getStrategy(TrimTripTransformStrategy.class);
TrimOperation operation = new TrimTripTransformStrategy.TrimOperation();
operation.setMatch(match);
if (json.has("to_stop_id")) {
operation.setToStopId(json.getString("to_stop_id"));
}
if (json.has("from_stop_id")) {
operation.setFromStopId(json.getString("from_stop_id"));
}
if (operation.getToStopId() == null && operation.getFromStopId() == null) {
throw new TransformSpecificationMissingArgumentException(line, new String[] { "to_stop_id", "from_stop_id" });
}
strategy.addOperation(operation);
}
Aggregations