use of org.onebusaway.transit_data.model.service_alerts.NaturalLanguageStringBean 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);
}
}
use of org.onebusaway.transit_data.model.service_alerts.NaturalLanguageStringBean in project onebusaway-application-modules by camsys.
the class ServiceAlertsTestSupport method createServiceAlertBean.
public static ServiceAlertBean createServiceAlertBean(String id) {
ServiceAlertBean serviceAlertBean = new ServiceAlertBean();
serviceAlertBean.setId(id);
List<NaturalLanguageStringBean> summaries = new ArrayList<NaturalLanguageStringBean>();
summaries.add(createNaturalLanguageStringBean("summary"));
serviceAlertBean.setSummaries(summaries);
List<NaturalLanguageStringBean> descriptions = new ArrayList<NaturalLanguageStringBean>();
descriptions.add(createNaturalLanguageStringBean("description"));
serviceAlertBean.setDescriptions(descriptions);
List<SituationAffectsBean> allAffects = new ArrayList<SituationAffectsBean>();
serviceAlertBean.setAllAffects(allAffects);
allAffects.add(addAffects("1_100277", "0"));
allAffects.add(addAffects("1_100277", "1"));
allAffects.add(addAffects("1_100194", "0"));
allAffects.add(addAffects("1_100194", "1"));
return serviceAlertBean;
}
use of org.onebusaway.transit_data.model.service_alerts.NaturalLanguageStringBean in project onebusaway-application-modules by camsys.
the class ServiceAlertsTestSupport method createNaturalLanguageStringBean.
public static NaturalLanguageStringBean createNaturalLanguageStringBean(String string) {
NaturalLanguageStringBean n = new NaturalLanguageStringBean();
n.setValue(string);
n.setLang("EN");
return n;
}
use of org.onebusaway.transit_data.model.service_alerts.NaturalLanguageStringBean in project onebusaway-application-modules by camsys.
the class ServiceAlertAction method getSummary.
public String getSummary() {
List<NaturalLanguageStringBean> summaries = _model.getSummaries();
if (summaries == null || summaries.isEmpty()) {
return null;
}
NaturalLanguageStringBean nls = summaries.get(0);
return nls.getValue();
}
use of org.onebusaway.transit_data.model.service_alerts.NaturalLanguageStringBean in project onebusaway-application-modules by camsys.
the class ServiceAlertAction method getDescription.
public String getDescription() {
List<NaturalLanguageStringBean> descriptions = _model.getDescriptions();
if (descriptions == null || descriptions.isEmpty()) {
return null;
}
NaturalLanguageStringBean nls = descriptions.get(0);
return nls.getValue();
}
Aggregations