for (InstanceInfo instanceInfo : thisApp.getInstancesAsIsFromEureka()) {
allInstanceAppInstanceIds.add(new Pair(thisApp.getName(),
instanceInfo.getId()));
}
for (InstanceInfo otherInstanceInfo : otherApp.getInstancesAsIsFromEureka()) {
InstanceInfo thisInstanceInfo = thisApp.getByInstanceId(otherInstanceInfo.getId());
if (thisInstanceInfo == null) {
List<String> diffList = diffMap.get(ActionType.DELETED.name());
if (diffList == null) {
diffList = new ArrayList<String>();
diffMap.put(ActionType.DELETED.name(), diffList);
}
diffList.add(otherInstanceInfo.getId());
} else if (!thisInstanceInfo.getStatus().name()
.equalsIgnoreCase(otherInstanceInfo.getStatus().name())) {
List<String> diffList = diffMap.get(ActionType.MODIFIED.name());
if (diffList == null) {
diffList = new ArrayList<String>();
diffMap.put(ActionType.MODIFIED.name(), diffList);
}
diffList.add(thisInstanceInfo.getId()
+ APP_INSTANCEID_DELIMITER
+ thisInstanceInfo.getStatus().name()
+ APP_INSTANCEID_DELIMITER
+ otherInstanceInfo.getStatus().name());
}
allInstanceAppInstanceIds.remove(new Pair(otherApp.getName(), otherInstanceInfo.getId()));
}
}
for (Pair pair : allInstanceAppInstanceIds) {
Application app = new Application(pair.getItem1());
InstanceInfo thisInstanceInfo = app.getByInstanceId(pair.getItem2());
if (thisInstanceInfo != null) {
List<String> diffList = diffMap.get(ActionType.ADDED.name());
if (diffList == null) {
diffList = new ArrayList<String>();
diffMap.put(ActionType.ADDED.name(), diffList);
}
diffList.add(thisInstanceInfo.getId());
}
}
return diffMap;
}