Package org.onebusaway.transit_data_federation.services.service_alerts.ServiceAlerts

Examples of org.onebusaway.transit_data_federation.services.service_alerts.ServiceAlerts.Id


  private Affects.Builder getEntitySelectorAsAffects(EntitySelector selector) {
    Affects.Builder affects = Affects.newBuilder();
    if (selector.hasAgencyId())
      affects.setAgencyId(selector.getAgencyId());
    if (selector.hasRouteId()) {
      Id routeId = _entitySource.getRouteId(selector.getRouteId());
      affects.setRouteId(routeId);
    }
    if (selector.hasStopId()) {
      Id stopId = _entitySource.getStopId(selector.getStopId());
      affects.setStopId(stopId);
    }
    if (selector.hasTrip()) {
      TripDescriptor trip = selector.getTrip();
      if (trip.hasTripId())
View Full Code Here


        ServiceAlertLibrary.id("3", "tripId"));

    ServiceAlert.Builder serviceAlert = _library.getAlertAsServiceAlert(
        alertId, alert.build());

    Id id = serviceAlert.getId();
    assertEquals("1", id.getAgencyId());
    assertEquals("A1", id.getId());

    assertEquals(1, serviceAlert.getAffectsCount());
    Affects affects = serviceAlert.getAffects(0);
    assertEquals("agencyId", affects.getAgencyId());
    assertEquals("1", affects.getRouteId().getAgencyId());
View Full Code Here

    RouteEntryImpl route = new RouteEntryImpl();
    route.setId(new AgencyAndId("2", "R10"));
    route.setParent(routeCollection);

    Mockito.when(_dao.getRouteForId(route.getId())).thenReturn(route);
    Id routeId = _source.getRouteId("R10");
    assertEquals("2", routeId.getAgencyId());
    assertEquals("R10C", routeId.getId());

    routeId = _source.getRouteId("R11");
    assertEquals("1", routeId.getAgencyId());
    assertEquals("R11", routeId.getId());
  }
View Full Code Here

    TripEntryImpl trip = new TripEntryImpl();
    trip.setId(new AgencyAndId("2", "T10"));
    Mockito.when(_dao.getTripEntryForId(trip.getId())).thenReturn(trip);

    Id tripId = _source.getTripId("T10");
    assertEquals("2", tripId.getAgencyId());
    assertEquals("T10", tripId.getId());

    tripId = _source.getTripId("T11");
    assertEquals("1", tripId.getAgencyId());
    assertEquals("T11", tripId.getId());
  }
View Full Code Here

  public void testGetStopId() {

    StopEntryImpl stop = new StopEntryImpl(new AgencyAndId("2", "S10"), 0, 0);
    Mockito.when(_dao.getStopEntryForId(stop.getId())).thenReturn(stop);

    Id stopId = _source.getStopId("S10");
    assertEquals("2", stopId.getAgencyId());
    assertEquals("S10", stopId.getId());

    stopId = _source.getStopId("S11");
    assertEquals("1", stopId.getAgencyId());
    assertEquals("S11", stopId.getId());
  }
View Full Code Here

      for (AffectedStopPointStructure stopPoint : stopPoints.getAffectedStopPoint()) {
        StopPointRefStructure stopRef = stopPoint.getStopPointRef();
        if (stopRef == null || stopRef.getValue() == null)
          continue;
        AgencyAndId stopId = AgencyAndIdLibrary.convertFromString(stopRef.getValue());
        Id id = ServiceAlertLibrary.id(stopId);
        Affects.Builder affects = Affects.newBuilder();
        affects.setStopId(id);
        serviceAlert.addAffects(affects);
      }
    }

    VehicleJourneys vjs = affectsStructure.getVehicleJourneys();
    if (vjs != null
        && !CollectionsLibrary.isEmpty(vjs.getAffectedVehicleJourney())) {

      for (AffectedVehicleJourneyStructure vj : vjs.getAffectedVehicleJourney()) {

        Affects.Builder affects = Affects.newBuilder();
        if (vj.getLineRef() != null) {
          AgencyAndId routeId = AgencyAndIdLibrary.convertFromString(vj.getLineRef().getValue());
          Id id = ServiceAlertLibrary.id(routeId);
          affects.setRouteId(id);
        }

        if (vj.getDirectionRef() != null)
          affects.setDirectionId(vj.getDirectionRef().getValue());
View Full Code Here

        if (consequence.getDetourPath() != null)
          builder.setDetourPath(consequence.getDetourPath());
        if (!CollectionsLibrary.isEmpty(consequence.getDetourStopIds())) {
          List<Id> detourStopIds = new ArrayList<Id>();
          for (String detourStopId : consequence.getDetourStopIds()) {
            Id id = ServiceAlertLibrary.id(AgencyAndId.convertFromString(detourStopId));
            detourStopIds.add(id);
          }
          builder.addAllDetourStopIds(detourStopIds);
        }
        consequences.add(builder.build());
View Full Code Here

  public synchronized ServiceAlert createOrUpdateServiceAlert(
      ServiceAlert.Builder builder, String defaultAgencyId) {

    if (!builder.hasId()) {
      UUID uuid = UUID.randomUUID();
      Id id = ServiceAlertLibrary.id(defaultAgencyId, uuid.toString());
      builder.setId(id);
    }

    if (!builder.hasCreationTime())
      builder.setCreationTime(System.currentTimeMillis());
View Full Code Here

TOP

Related Classes of org.onebusaway.transit_data_federation.services.service_alerts.ServiceAlerts.Id

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.