+ private static Notification setUpdateTypes(boolean updated, boolean removed, Notification notification) {
+ if(notification!=null){
+ if(updated && removed){
+ notification.setNotificationType(NotificationType.BOTH);
+ if(notification.getLoadedPolicies()!=null){
+ HashSet<Updated> updatedPolicies = new HashSet<Updated>();
+ for(Updated oldUpdatedPolicy: notification.getLoadedPolicies()){
+ Updated updatePolicy = oldUpdatedPolicy;
+ if(notification.getRemovedPolicies()!=null){
+ for(RemovedPolicy removedPolicy: notification.getRemovedPolicies()){
+ String regex = ".(\\d)*.xml";
+ if(removedPolicy.getPolicyName().replaceAll(regex, "").equals(oldUpdatedPolicy.getPolicyName().replaceAll(regex, ""))){
+ updatePolicy.setUpdateType(UpdateType.UPDATE);
+ break;
+ }
+ }
+ }
+ updatedPolicies.add(updatePolicy);
+ }
+ notification.setLoadedPolicies(updatedPolicies);
+ }
+ }else if(updated){
+ notification.setNotificationType(NotificationType.UPDATE);
+ }else if(removed){
+ notification.setNotificationType(NotificationType.REMOVE);
+ }
+ }
+ return notification;
+ }
+