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 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; }
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 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; }