public SituationAffectsV2Bean getSituationAffects(SituationAffectsBean affects) { SituationAffectsV2Bean bean = new SituationAffectsV2Bean(); bean.setAgencyId(affects.getAgencyId()); bean.setApplicationId(affects.getApplicationId()); bean.setDirectionId(affects.getDirectionId()); bean.setRouteId(affects.getRouteId()); bean.setStopId(affects.getStopId()); bean.setTripId(affects.getTripId()); return bean; }
public static SituationAffectsBean addAffects(String route, String direction) { SituationAffectsBean sab = new SituationAffectsBean(); sab.setRouteId(route); sab.setDirectionId(direction); return sab; }
VehicleJourneys vehicleJourneys = new VehicleJourneys(); for (SituationAffectsBean affects : serviceAlert.getAllAffects()) { String agencyId = affects.getAgencyId(); if (agencyId != null) { Operators operators = new Operators(); hasOperators = true; String routeId = affects.getRouteId(); // LineRef String directionId = affects.getDirectionId(); String stopId = affects.getStopId(); if (!StringUtils.isBlank(routeId)) { AffectedVehicleJourneyStructure affectedVehicleJourneyStructure = new AffectedVehicleJourneyStructure();
/**** * Situations Affects ****/ private List<SituationAffectsBean> getAffectsAsBeans(ServiceAlertRecord serviceAlert) { if (serviceAlert.getAllAffects().size() == 0) return null; List<SituationAffectsBean> beans = new ArrayList<SituationAffectsBean>(); for (ServiceAlertsSituationAffectsClause affects : serviceAlert.getAllAffects()) { SituationAffectsBean bean = new SituationAffectsBean(); if (affects.getAgencyId() != null) bean.setAgencyId(affects.getAgencyId()); if (affects.getApplicationId() != null) bean.setApplicationId(affects.getApplicationId()); if (affects.getRouteId() != null) { bean.setRouteId(affects.getRouteId()); } if (affects.getDirectionId() != null) bean.setDirectionId(affects.getDirectionId()); if (affects.getTripId() != null) { bean.setTripId(affects.getTripId()); } if (affects.getStopId() != null) { bean.setStopId(affects.getStopId()); } if (affects.getApplicationId() != null) bean.setApplicationId(affects.getApplicationId()); beans.add(bean); } return beans; }
SituationAffects affects) { SituationAffectsBean bean = new SituationAffectsBean(); beans.add(agencyBean); bean.setAgencies(beans); beans.add(stopBean); bean.setStops(beans); beans.add(vjBean); bean.setVehicleJourneys(beans);
private boolean isSituationApplicable(ServiceAlertBean situation) { Set<String> applicationIds = new HashSet<String>(); for (SituationAffectsBean affects : situation.getAllAffects()) { if (affects.getApplicationId() != null) applicationIds.add(affects.getApplicationId()); } if (CollectionsLibrary.isEmpty(applicationIds)) return true; if (_apiKey == null) return false; return applicationIds.contains(_apiKey); } }
public boolean isSituationExcludedForApplication(ServiceAlertBean situation) { List<SituationAffectsBean> affects = situation.getAllAffects(); if (affects == null) return false; Set<String> applicationIds = new HashSet<String>(); for (SituationAffectsBean affect : affects) { if (affect.getApplicationId() != null) applicationIds.add(affect.getApplicationId()); } if (CollectionsLibrary.isEmpty(applicationIds)) return false; if (_applicationKey == null) return true; return !_applicationKey.contains(_applicationKey); }
public SituationAffectsV2Bean getSituationAffects(SituationAffectsBean affects) { SituationAffectsV2Bean bean = new SituationAffectsV2Bean(); bean.setAgencyId(affects.getAgencyId()); bean.setApplicationId(affects.getApplicationId()); bean.setDirectionId(affects.getDirectionId()); bean.setRouteId(affects.getRouteId()); bean.setStopId(affects.getStopId()); bean.setTripId(affects.getTripId()); return bean; }
public boolean isSituationExcludedForApplication(ServiceAlertBean situation) { List<SituationAffectsBean> affects = situation.getAllAffects(); if (affects == null) return false; Set<String> applicationIds = new HashSet<String>(); for (SituationAffectsBean affect : affects) { if (affect.getApplicationId() != null) applicationIds.add(affect.getApplicationId()); } if (CollectionsLibrary.isEmpty(applicationIds)) return false; if (_applicationKey == null) return true; return !_applicationKey.contains(_applicationKey); }
private Set<ServiceAlertsSituationAffectsClause> getBeanAsAffects(ServiceAlertBean bean) { Set<ServiceAlertsSituationAffectsClause> affectsList = new HashSet<ServiceAlertsSituationAffectsClause>(); if (!CollectionsLibrary.isEmpty(bean.getAllAffects())) { for (SituationAffectsBean affectsBean : bean.getAllAffects()) { ServiceAlertsSituationAffectsClause affects = new ServiceAlertsSituationAffectsClause(); if (affectsBean.getAgencyId() != null) affects.setAgencyId(affectsBean.getAgencyId()); if (affectsBean.getApplicationId() != null) affects.setApplicationId(affectsBean.getApplicationId()); if (affectsBean.getRouteId() != null) { affects.setRouteId(affectsBean.getRouteId()); } if (affectsBean.getDirectionId() != null) affects.setDirectionId(affectsBean.getDirectionId()); if (affectsBean.getTripId() != null) { affects.setTripId(affectsBean.getTripId()); } if (affectsBean.getStopId() != null) { affects.setStopId(affectsBean.getStopId()); } affectsList.add(affects); } } return affectsList; }