protected void validateLinks(final Map<String, ServiceLink> newServiceLinks) { for (ServiceLink link : newServiceLinks.values()) { Service targetService = objMgr.loadResource(Service.class, link.getServiceId()); if (targetService == null || targetService.getRemoved() != null || targetService.getState().equalsIgnoreCase(CommonStatesConstants.REMOVING)) { Object obfuscatedId = idFormatter.formatId("service", link.getServiceId()); String obfuscatedIdStr = obfuscatedId != null ? obfuscatedId.toString() : null; String svcName = targetService != null ? targetService.getName() : obfuscatedIdStr; ValidationErrorCodes.throwValidationError( ValidationErrorCodes.INVALID_REFERENCE, "Service " + svcName + " is removed"); } } }
@Override public void removeServiceLink(Service service, ServiceLink serviceLink) { ServiceConsumeMap map = consumeMapDao.findMapToRemove(service.getId(), serviceLink.getServiceId()); if (map != null) { objectProcessManager.scheduleProcessInstance( ServiceDiscoveryConstants.PROCESS_SERVICE_CONSUME_MAP_REMOVE, map, null); } }