private void createOrFindApplicationCallEndpointSet()

in service/src/main/java/org/apache/fineract/cn/provisioner/internal/service/applications/IdentityServiceInitializer.java [324:352]


  private void createOrFindApplicationCallEndpointSet(
          final @Nonnull IdentityManager identityService,
          final @Nonnull String applicationName,
          final @Nonnull CallEndpointSet callEndpointSet) {
    try {
      identityService.createApplicationCallEndpointSet(applicationName, callEndpointSet);
    }
    catch (final CallEndpointSetAlreadyExistsException alreadyExistsException)
    {
      //if already exists, read out and compare.  If is the same, there is nothing left to do.
      final CallEndpointSet existing = identityService.getApplicationCallEndpointSet(
              applicationName, callEndpointSet.getIdentifier());
      if (!existing.getIdentifier().equals(callEndpointSet.getIdentifier())) {
        logger.error("Application call endpoint set '{}' already exists, but has a different name {} (strange).",
                callEndpointSet.getIdentifier(), existing.getIdentifier());
      }

      //Compare as sets because I'm not going to get into a hissy fit over order.
      final Set<String> existingPermittableEndpoints = new HashSet<>(existing.getPermittableEndpointGroupIdentifiers());
      final Set<String> newPermittableEndpoints = new HashSet<>(callEndpointSet.getPermittableEndpointGroupIdentifiers());
      if (!existingPermittableEndpoints.equals(newPermittableEndpoints)) {
        logger.error("Application call endpoint set '{}' already exists, but has different contents.", callEndpointSet.getIdentifier());
      }
    }
    catch (final RuntimeException unexpected)
    {
      logger.error("Creating application call endpoint set '{}' failed.", callEndpointSet.getIdentifier(), unexpected);
    }
  }