コード例 #1
0
  @Override
  public void removeServiceMaps(Service service) {
    // 1. remove all maps to the services consumed by service specified
    for (ServiceConsumeMap map : consumeMapDao.findConsumedMapsToRemove(service.getId())) {
      objectProcessManager.scheduleProcessInstance(
          ServiceDiscoveryConstants.PROCESS_SERVICE_CONSUME_MAP_REMOVE, map, null);
    }

    // 2. remove all maps to the services consuming service specified
    for (ServiceConsumeMap map : consumeMapDao.findConsumingMapsToRemove(service.getId())) {
      objectProcessManager.scheduleProcessInstance(
          ServiceDiscoveryConstants.PROCESS_SERVICE_CONSUME_MAP_REMOVE, map, null);
    }
  }
コード例 #2
0
  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);
    }
  }
コード例 #3
0
  private void removeOldServiceMaps(Service service, Map<Long, String> newServiceLinks) {
    List<? extends ServiceConsumeMap> existingMaps =
        consumeMapDao.findConsumedMapsToRemove(service.getId());
    List<ServiceConsumeMap> mapsToRemove = new ArrayList<>();

    for (ServiceConsumeMap existingMap : existingMaps) {
      if (!newServiceLinks.containsKey(existingMap.getConsumedServiceId())) {
        mapsToRemove.add(existingMap);
      } else {
        String newName = newServiceLinks.get(existingMap.getConsumedServiceId());
        String existingName = existingMap.getName();

        if (!StringUtils.equalsIgnoreCase(newName, existingName)) {
          mapsToRemove.add(existingMap);
        }
      }
    }

    for (ServiceConsumeMap mapToRemove : mapsToRemove) {
      objectProcessManager.scheduleProcessInstanceAsync(
          ServiceDiscoveryConstants.PROCESS_SERVICE_CONSUME_MAP_REMOVE, mapToRemove, null);
    }
  }