Search in sources :

Example 11 with TimeRangeBean

use of org.onebusaway.transit_data.model.service_alerts.TimeRangeBean in project onebusaway-application-modules by camsys.

the class ServiceAlertAction method setStartDate.

public void setStartDate(Date startDate) {
    List<TimeRangeBean> publicationWindows = _model.getPublicationWindows();
    if (publicationWindows == null) {
        publicationWindows = new ArrayList<TimeRangeBean>();
        _model.setPublicationWindows(publicationWindows);
    }
    if (publicationWindows.isEmpty()) {
        publicationWindows.add(new TimeRangeBean());
    }
    TimeRangeBean timeRangeBean = publicationWindows.get(0);
    if (startDate != null) {
        timeRangeBean.setFrom(startDate.getTime());
    } else {
        timeRangeBean.setFrom(0);
    }
}
Also used : TimeRangeBean(org.onebusaway.transit_data.model.service_alerts.TimeRangeBean)

Example 12 with TimeRangeBean

use of org.onebusaway.transit_data.model.service_alerts.TimeRangeBean in project onebusaway-application-modules by camsys.

the class ServiceAlertEditAction method setStartDate.

public void setStartDate(Date startDate) {
    List<TimeRangeBean> publicationWindows = _model.getPublicationWindows();
    if (publicationWindows == null) {
        publicationWindows = new ArrayList<TimeRangeBean>();
        _model.setPublicationWindows(publicationWindows);
    }
    if (publicationWindows.isEmpty()) {
        publicationWindows.add(new TimeRangeBean());
    }
    TimeRangeBean timeRangeBean = publicationWindows.get(0);
    if (startDate != null) {
        timeRangeBean.setFrom(startDate.getTime());
    } else {
        timeRangeBean.setFrom(0);
    }
}
Also used : TimeRangeBean(org.onebusaway.transit_data.model.service_alerts.TimeRangeBean)

Example 13 with TimeRangeBean

use of org.onebusaway.transit_data.model.service_alerts.TimeRangeBean in project onebusaway-application-modules by camsys.

the class ServiceAlertEditAction method getEndDate.

public String getEndDate() {
    List<TimeRangeBean> publicationWindows = _model.getPublicationWindows();
    if (publicationWindows == null || publicationWindows.isEmpty() || publicationWindows.get(0).getTo() == 0) {
        return null;
    }
    Date date = new Date(publicationWindows.get(0).getTo());
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    return sdf.format(date);
}
Also used : TimeRangeBean(org.onebusaway.transit_data.model.service_alerts.TimeRangeBean) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 14 with TimeRangeBean

use of org.onebusaway.transit_data.model.service_alerts.TimeRangeBean in project onebusaway-application-modules by camsys.

the class ServiceAlertEditAction method setEndDate.

public void setEndDate(Date endDate) {
    List<TimeRangeBean> publicationWindows = _model.getPublicationWindows();
    if (publicationWindows == null) {
        publicationWindows = new ArrayList<TimeRangeBean>();
        _model.setPublicationWindows(publicationWindows);
    }
    if (publicationWindows.isEmpty()) {
        publicationWindows.add(new TimeRangeBean());
    }
    TimeRangeBean timeRangeBean = publicationWindows.get(0);
    if (endDate != null) {
        timeRangeBean.setTo(endDate.getTime());
    } else {
        timeRangeBean.setTo(0);
    }
}
Also used : TimeRangeBean(org.onebusaway.transit_data.model.service_alerts.TimeRangeBean)

Example 15 with TimeRangeBean

use of org.onebusaway.transit_data.model.service_alerts.TimeRangeBean in project onebusaway-application-modules by camsys.

the class ServiceAlertEditAction method getStartDate.

public String getStartDate() {
    List<TimeRangeBean> publicationWindows = _model.getPublicationWindows();
    if (publicationWindows == null || publicationWindows.isEmpty() || publicationWindows.get(0).getFrom() == 0) {
        return null;
    }
    Date date = new Date(publicationWindows.get(0).getFrom());
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    return sdf.format(date);
}
Also used : TimeRangeBean(org.onebusaway.transit_data.model.service_alerts.TimeRangeBean) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Aggregations

TimeRangeBean (org.onebusaway.transit_data.model.service_alerts.TimeRangeBean)15 Date (java.util.Date)5 SimpleDateFormat (java.text.SimpleDateFormat)4 ArrayList (java.util.ArrayList)4 ServiceAlertBean (org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean)3 SituationAffectsBean (org.onebusaway.transit_data.model.service_alerts.SituationAffectsBean)3 Alert (com.google.transit.realtime.GtfsRealtime.Alert)2 EntitySelector (com.google.transit.realtime.GtfsRealtime.EntitySelector)2 FeedEntity (com.google.transit.realtime.GtfsRealtime.FeedEntity)2 TimeRange (com.google.transit.realtime.GtfsRealtime.TimeRange)2 NaturalLanguageStringBean (org.onebusaway.transit_data.model.service_alerts.NaturalLanguageStringBean)2 FeedMessage (com.google.transit.realtime.GtfsRealtime.FeedMessage)1 TranslatedString (com.google.transit.realtime.GtfsRealtime.TranslatedString)1 Translation (com.google.transit.realtime.GtfsRealtime.TranslatedString.Translation)1 TripDescriptor (com.google.transit.realtime.GtfsRealtime.TripDescriptor)1 Test (org.junit.Test)1 ResponseBean (org.onebusaway.api.model.ResponseBean)1 SituationAffectsV2Bean (org.onebusaway.api.model.transit.service_alerts.SituationAffectsV2Bean)1 SituationConsequenceV2Bean (org.onebusaway.api.model.transit.service_alerts.SituationConsequenceV2Bean)1 SituationV2Bean (org.onebusaway.api.model.transit.service_alerts.SituationV2Bean)1