All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opentripplanner.netex.validation.JourneyPatternNotFoundInSJ Maven / Gradle / Ivy

There is a newer version: 2.6.0
Show newest version
package org.opentripplanner.netex.validation;

import org.opentripplanner.graph_builder.DataImportIssue;
import org.opentripplanner.netex.issues.ObjectNotFound;
import org.rutebanken.netex.model.ServiceJourney;

class JourneyPatternNotFoundInSJ extends AbstractHMapValidationRule {

  @Override
  public Status validate(ServiceJourney sj) {
    return index.getJourneyPatternsById().lookup(getPatternId(sj)) == null
      ? Status.DISCARD
      : Status.OK;
  }

  @Override
  public DataImportIssue logMessage(String key, ServiceJourney sj) {
    return new ObjectNotFound("ServiceJourney", sj.getId(), "JourneyPattern", getPatternId(sj));
  }

  private String getPatternId(ServiceJourney sj) {
    return sj.getJourneyPatternRef().getValue().getRef();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy