@Restrict("#{s:hasPermission('configuration', 'access')}")
  public String update() {
    if (!vdsCacheRefreshPollingInterval()) {
      return OxTrustConstants.RESULT_FAILURE;
    }

    updateLists();

    if (!validateLists()) {
      return OxTrustConstants.RESULT_FAILURE;
    }

    fixLdapConfigurations(this.cacheRefreshConfiguration.getSourceConfigs());
    fixLdapConfiguration(this.cacheRefreshConfiguration.getInumConfig());
    fixLdapConfiguration(this.cacheRefreshConfiguration.getTargetConfig());

    try {
      jsonConfigurationService.saveOxTrustCacheRefreshConfiguration(this.cacheRefreshConfiguration);

      updateAppliance();
    } catch (Exception ex) {
      log.error("Failed to save Cache Refresh configuration", ex);
      return OxTrustConstants.RESULT_FAILURE;
    }

    return OxTrustConstants.RESULT_SUCCESS;
  }
  private CacheRefreshConfiguration getOxTrustCacheRefreshConfig() {
    CacheRefreshConfiguration cacheRefreshConfiguration =
        jsonConfigurationService.getOxTrustCacheRefreshConfiguration();

    if (cacheRefreshConfiguration == null) {
      cacheRefreshConfiguration = new CacheRefreshConfiguration();
      cacheRefreshConfiguration.setUpdateMethod(CacheRefreshUpdateMethod.COPY.getValue());
      cacheRefreshConfiguration.setSourceConfigs(new ArrayList<GluuLdapConfiguration>());
      cacheRefreshConfiguration.setInumConfig(new GluuLdapConfiguration());
      cacheRefreshConfiguration.setTargetConfig(new GluuLdapConfiguration());
      cacheRefreshConfiguration.setKeyAttributes(new ArrayList<String>(0));
      cacheRefreshConfiguration.setKeyObjectClasses(new ArrayList<String>());
      cacheRefreshConfiguration.setSourceAttributes(new ArrayList<String>());
      cacheRefreshConfiguration.setAttributeMapping(new ArrayList<CacheRefreshAttributeMapping>());
    }

    this.updateMethod =
        CacheRefreshUpdateMethod.getByValue(cacheRefreshConfiguration.getUpdateMethod());
    this.keyAttributes = toSimpleProperties(cacheRefreshConfiguration.getKeyAttributes());
    this.keyObjectClasses = toSimpleProperties(cacheRefreshConfiguration.getKeyObjectClasses());
    this.sourceAttributes = toSimpleProperties(cacheRefreshConfiguration.getSourceAttributes());
    this.attributeMapping =
        toSimpleCustomProperties(cacheRefreshConfiguration.getAttributeMapping());

    return cacheRefreshConfiguration;
  }