/** * Adjust the StateUpdate object so that those descriptions that have disappeared are purged. * * @param update * @param currentDescriptions * @param futureDescriptions */ private void purgeMissingSummaries( StateUpdate update, Map<String, Map<String, ReservationSummaryInfo>> currentVoInfo, Map<String, Map<String, ReservationSummaryInfo>> futureVoInfo) { for (Map.Entry<String, Map<String, ReservationSummaryInfo>> voEntry : currentVoInfo.entrySet()) { String voName = voEntry.getKey(); Set<String> currentDescriptions = voEntry.getValue().keySet(); StatePath voBasePath = buildVoPath(voName); Map<String, ReservationSummaryInfo> futureDescriptions = futureVoInfo.get(voName); // If this VO is gone completely, purge everything and move on. if (futureDescriptions == null) { update.purgeUnder(voBasePath); continue; } // Otherwise, purge those descriptions that have gone. for (String thisDescription : currentDescriptions) { if (!futureDescriptions.containsKey(thisDescription)) { update.purgeUnder(buildDescriptionPath(voBasePath, thisDescription)); } } } }
/** * Purge all IDs that are not present in this ReservationSummaryInfo but are missing from a new * version of ReservationSummaryInfo * * @param update the StateUpdate to add adjust. * @param basePath the base path of the IDs * @param newInfo the new version of this ReservationSummaryInfo */ public void purgeMissingIds( StateUpdate update, StatePath basePath, ReservationSummaryInfo newInfo) { for (String id : _ids) { if (!newInfo.hasId(id)) { update.purgeUnder(basePath.newChild(id)); } } }