Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix - made kcm suite non-agency specific #173

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void run(String[] args) throws IOException {
System.err.println(ex.getMessage());
System.exit(-1);
} catch (Exception ex) {
ex.printStackTrace();
ex.printStackTrace();
System.exit(-1);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public class TransformFactory {

private static final String ARG_COLLECTION = "collection";

private static final String ARG_PATH = "path";

private static final Set<String> _excludeForObjectSpec = new HashSet<String>(
Arrays.asList(ARG_FILE, ARG_CLASS));

Expand Down Expand Up @@ -301,26 +303,8 @@ else if (opType.equals("add_omny_bus_data")) {
else if (opType.equals("verify_route_ids")) {
handleTransformOperation(line, json, new VerifyRouteIds());
}
else if (opType.equals("KCMSuite")){
String baseUrl = "https://raw.github.com/wiki/camsys/onebusaway-application-modules";

handleTransformOperation(line, json, new RemoveMergedTripsStrategy());
handleTransformOperation(line, json, new RemoveRepeatedStopTimesStrategy());
handleTransformOperation(line, json, new RemoveEmptyBlockTripsStrategy());
handleTransformOperation(line, json, new EnsureStopTimesIncreaseUpdateStrategy());

configureStopNameUpdates(_transformer, baseUrl
+ "/KingCountyMetroStopNameModifications.md");


try {
GtfsTransformerLibrary.configureTransformation(_transformer, baseUrl
+ "/KingCountyMetroModifications.md");
} catch (TransformSpecificationException e) {
throw new RuntimeException(e);
}

_transformer.addTransform(new LocalVsExpressUpdateStrategy());
else if (opType.equals("configure_stop_name_updates")){
configureStopNameUpdates(_transformer, json.getString(ARG_PATH));
}
else if (opType.equals("transform")) {
handleTransformOperation(line, json);
Expand Down Expand Up @@ -867,8 +851,10 @@ public Object create() {

private void configureStopNameUpdates(GtfsTransformer transformer, String path) {

if (path == null)
if (path == null) {
_log.error("missing path to configure stop names");
return;
}

try {
StopNameUpdateFactoryStrategy factory = new StopNameUpdateFactoryStrategy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,20 @@
import org.onebusaway.gtfs_transformer.services.GtfsTransformStrategy;
import org.onebusaway.gtfs_transformer.services.TransformContext;
import org.onebusaway.gtfs_transformer.updates.UpdateLibrary;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class NoTripsWithBlockIdAndFrequenciesStrategy implements
EntityTransformStrategy {
public class NoTripsWithBlockIdAndFrequenciesStrategy implements GtfsTransformStrategy {

private static Logger _log = LoggerFactory.getLogger(org.onebusaway.gtfs_transformer.updates.DeduplicateServiceIdsStrategy.class);

@Override
public String getName() {
return this.getClass().getSimpleName();
}

@Override
public void run(TransformContext context, GtfsMutableRelationalDao dao,
Object entity) {
public void run(TransformContext context, GtfsMutableRelationalDao dao) {

for (Trip trip : dao.getAllTrips()) {
List<Frequency> frequencies = dao.getFrequenciesForTrip(trip);
Expand Down