Search in sources :

Example 1 with SituationRefStructure

use of uk.org.siri.siri_2.SituationRefStructure in project onebusaway-application-modules by camsys.

the class ServiceAlertsHelperV2 method addSituationElement.

/*
  public void addSituationExchangeToServiceDelivery(ServiceDelivery serviceDelivery,
      Map<String, ServiceAlertBean> currentServiceAlerts) {
    addSituationExchangeToServiceDelivery(serviceDelivery, currentServiceAlerts.values());
  }

  public void addClosedSituationExchangesToSiri(
      ServiceDelivery serviceDelivery, Collection<String> deletedIds) {
    Map<String, PtSituationElementStructure> ptSituationElements = new HashMap<String, PtSituationElementStructure>();

    for (String id : deletedIds) {
      PtSituationElementStructure ptSit = new PtSituationElementStructure();
      EntryQualifierStructure value = new EntryQualifierStructure();
      value.setValue(id);
      ptSit.setSituationNumber(value);
      ptSit.setProgress(WorkflowStatusEnumeration.CLOSED);
      ptSituationElements.put(id, ptSit);
    }

    addPtSituationElementsToServiceDelivery(serviceDelivery,
        ptSituationElements);

  }
*/
private void addSituationElement(TransitDataService transitDataService, Map<String, PtSituationElementStructure> ptSituationElements, List<SituationRefStructure> situationRefs) {
    if (situationRefs == null)
        return;
    for (SituationRefStructure situationRef : situationRefs) {
        String situationId = situationRef.getSituationSimpleRef().getValue();
        ServiceAlertBean serviceAlert = transitDataService.getServiceAlertForId(situationId);
        PtSituationElementStructure e = getServiceAlertBeanAsPtSituationElementStructure(serviceAlert);
        ptSituationElements.put(situationId, e);
    }
}
Also used : SituationRefStructure(uk.org.siri.siri_2.SituationRefStructure) PtSituationElementStructure(uk.org.siri.siri_2.PtSituationElementStructure) ServiceAlertBean(org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean)

Example 2 with SituationRefStructure

use of uk.org.siri.siri_2.SituationRefStructure in project onebusaway-application-modules by camsys.

the class SiriSupportV2 method fillSituations.

private static void fillSituations(MonitoredVehicleJourneyStructure monitoredVehicleJourney, TripStatusBean tripStatus) {
    if (tripStatus == null || tripStatus.getSituations() == null || tripStatus.getSituations().isEmpty()) {
        return;
    }
    List<SituationRefStructure> situationRef = monitoredVehicleJourney.getSituationRef();
    for (ServiceAlertBean situation : tripStatus.getSituations()) {
        SituationRefStructure sitRef = new SituationRefStructure();
        SituationSimpleRefStructure sitSimpleRef = new SituationSimpleRefStructure();
        sitSimpleRef.setValue(situation.getId());
        sitRef.setSituationSimpleRef(sitSimpleRef);
        situationRef.add(sitRef);
    }
}
Also used : SituationRefStructure(uk.org.siri.siri_2.SituationRefStructure) ServiceAlertBean(org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean) SituationSimpleRefStructure(uk.org.siri.siri_2.SituationSimpleRefStructure)

Aggregations

ServiceAlertBean (org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean)2 SituationRefStructure (uk.org.siri.siri_2.SituationRefStructure)2 PtSituationElementStructure (uk.org.siri.siri_2.PtSituationElementStructure)1 SituationSimpleRefStructure (uk.org.siri.siri_2.SituationSimpleRefStructure)1