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());