Search in sources :

Example 1 with PtConsequencesStructure

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

the class ServiceAlertsHelperV2 method handleConsequences.

private void handleConsequences(ServiceAlertBean serviceAlert, PtSituationElementStructure ptSituation) {
    if (serviceAlert == null)
        return;
    List<SituationConsequenceBean> consequences = serviceAlert.getConsequences();
    if (consequences == null || consequences.isEmpty())
        return;
    PtConsequencesStructure ptConsequences = new PtConsequencesStructure();
    ptSituation.setConsequences(ptConsequences);
    for (SituationConsequenceBean consequence : consequences) {
        EEffect effect = consequence.getEffect();
        PtConsequenceStructure ptConsequenceStructure = new PtConsequenceStructure();
        ServiceConditionEnumeration serviceCondition = getEFfectAsCondition(effect);
        ptConsequenceStructure.getCondition().add(serviceCondition);
        String detourPath = consequence.getDetourPath();
        if (!StringUtils.isBlank(detourPath)) {
            ExtensionsStructure extensionStructure = new ExtensionsStructure();
            OneBusAwayConsequence oneBusAwayConsequence = new OneBusAwayConsequence();
            oneBusAwayConsequence.setDiversionPath(detourPath);
            extensionStructure.setAny(oneBusAwayConsequence);
            ptConsequenceStructure.setExtensions(extensionStructure);
        }
        ptConsequences.getConsequence().add(ptConsequenceStructure);
    }
}
Also used : PtConsequenceStructure(uk.org.siri.siri_2.PtConsequenceStructure) OneBusAwayConsequence(org.onebusaway.siri.OneBusAwayConsequence) PtConsequencesStructure(uk.org.siri.siri_2.PtConsequencesStructure) ExtensionsStructure(uk.org.siri.siri_2.ExtensionsStructure) SituationConsequenceBean(org.onebusaway.transit_data.model.service_alerts.SituationConsequenceBean) ServiceConditionEnumeration(uk.org.siri.siri_2.ServiceConditionEnumeration) EEffect(org.onebusaway.transit_data.model.service_alerts.EEffect)

Aggregations

OneBusAwayConsequence (org.onebusaway.siri.OneBusAwayConsequence)1 EEffect (org.onebusaway.transit_data.model.service_alerts.EEffect)1 SituationConsequenceBean (org.onebusaway.transit_data.model.service_alerts.SituationConsequenceBean)1 ExtensionsStructure (uk.org.siri.siri_2.ExtensionsStructure)1 PtConsequenceStructure (uk.org.siri.siri_2.PtConsequenceStructure)1 PtConsequencesStructure (uk.org.siri.siri_2.PtConsequencesStructure)1 ServiceConditionEnumeration (uk.org.siri.siri_2.ServiceConditionEnumeration)1