Search in sources :

Example 1 with InfoLinks

use of uk.org.siri.siri.RoadSituationElementStructure.InfoLinks in project onebusaway-application-modules by camsys.

the class ServiceAlertsHelper method handleOtherFields.

private void handleOtherFields(ServiceAlertBean serviceAlert, PtSituationElementStructure ptSituation) {
    if (serviceAlert == null) {
        return;
    }
    if (serviceAlert.getUrls() != null && !serviceAlert.getUrls().isEmpty()) {
        InfoLinks infoLinks = ptSituation.getInfoLinks();
        if (infoLinks == null) {
            infoLinks = new InfoLinks();
            ptSituation.setInfoLinks(infoLinks);
        }
        for (NaturalLanguageStringBean linkBean : serviceAlert.getUrls()) {
            InfoLinkStructure infoLinkStructure = new InfoLinkStructure();
            infoLinkStructure.setUri(linkBean.getValue());
            infoLinks.getInfoLink().add(infoLinkStructure);
        }
    }
    if (serviceAlert.getPublicationWindows() == null) {
        return;
    }
    // TODO Not handling severity yet.
    ptSituation.setSeverity(SeverityEnumeration.UNDEFINED);
    HalfOpenTimestampRangeStructure timestampRangeStructure = new HalfOpenTimestampRangeStructure();
    if (serviceAlert.getPublicationWindows() != null && !serviceAlert.getPublicationWindows().isEmpty()) {
        timestampRangeStructure.setStartTime(serviceAlertTimeToDate(serviceAlert.getPublicationWindows().get(0).getFrom()));
        timestampRangeStructure.setEndTime(serviceAlertTimeToDate(serviceAlert.getPublicationWindows().get(0).getTo()));
        ptSituation.setPublicationWindow(timestampRangeStructure);
    }
}
Also used : InfoLinks(uk.org.siri.siri.RoadSituationElementStructure.InfoLinks) HalfOpenTimestampRangeStructure(uk.org.siri.siri.HalfOpenTimestampRangeStructure) InfoLinkStructure(uk.org.siri.siri.InfoLinkStructure) NaturalLanguageStringBean(org.onebusaway.transit_data.model.service_alerts.NaturalLanguageStringBean)

Aggregations

NaturalLanguageStringBean (org.onebusaway.transit_data.model.service_alerts.NaturalLanguageStringBean)1 HalfOpenTimestampRangeStructure (uk.org.siri.siri.HalfOpenTimestampRangeStructure)1 InfoLinkStructure (uk.org.siri.siri.InfoLinkStructure)1 InfoLinks (uk.org.siri.siri.RoadSituationElementStructure.InfoLinks)1