All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.internet2.middleware.grouper.attr.resolver.LdapGlobalAttributeResolverOptionValueDriver Maven / Gradle / Ivy

There is a newer version: 5.13.5
Show newest version
package edu.internet2.middleware.grouper.attr.resolver;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import edu.internet2.middleware.grouper.cfg.dbConfig.OptionValueDriver;
import edu.internet2.middleware.grouperClient.collections.MultiKey;
import org.apache.commons.lang3.StringUtils;

public class LdapGlobalAttributeResolverOptionValueDriver implements OptionValueDriver {
  
  @Override
  public List retrieveKeysAndLabels() {
    
    List keysAndLabels = new ArrayList();
    
    List resolverConfigs = (List) (Object) new GlobalAttributeResolverConfiguration().listAllConfigurationsOfThisType();
    
    for (GlobalAttributeResolverConfiguration resolverConfig: resolverConfigs) {
      
      if (StringUtils.equals(resolverConfig.retrieveAttributeValueFromConfig("resolverType", false), "ldap") &&
          resolverConfig.isEnabled()) {
        String configId = resolverConfig.getConfigId();
        keysAndLabels.add(new MultiKey(configId, configId));
      }
      
    }
    
    Collections.sort(keysAndLabels, new Comparator() {

      @Override
      public int compare(MultiKey o1, MultiKey o2) {
        return ((String)o1.getKey(0)).compareTo((String)o2.getKey(0));
      }
    });
    
    return keysAndLabels;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy