private void removeOldServiceMaps(Service service, Map<String, ServiceLink> newServiceLinks) { List<? extends ServiceConsumeMap> existingMaps = consumeMapDao.findConsumedMapsToRemove(service.getId()); List<ServiceLink> linksToRemove = new ArrayList<>(); for (ServiceConsumeMap existingMap : existingMaps) { ServiceLink existingLink = new ServiceLink(existingMap.getConsumedServiceId(), existingMap.getName()); if (!newServiceLinks.containsKey(existingLink.getUuid())) { linksToRemove.add(existingLink); } } for (ServiceLink linkToRemove : linksToRemove) { sdService.removeServiceLink(service, linkToRemove); } }
private void createNewServiceMaps(Service service, Map<String, ServiceLink> newServiceLinks) { for (ServiceLink newServiceLink : newServiceLinks.values()) { sdService.addServiceLink(service, newServiceLink); } }