Class GrouperLoaderResultset

java.lang.Object
edu.internet2.middleware.grouper.app.loader.db.GrouperLoaderResultset

public class GrouperLoaderResultset extends Object
encapsulate a resultset into this resultset to be case-insensitive and column-order insensitive
  • Field Details

  • Constructor Details

    • GrouperLoaderResultset

      public GrouperLoaderResultset(GrouperLoaderResultset parentResultSet, String groupName)
      get a resultset on another resultset and a group name
      Parameters:
      parentResultSet -
      groupName -
    • GrouperLoaderResultset

      public GrouperLoaderResultset(GrouperLoaderDb grouperLoaderDb, String query, String jobName, Hib3GrouperLoaderLog hib3GrouperLoaderLog)
      get a resultset based on a db and query
      Parameters:
      grouperLoaderDb -
      query -
      jobName -
      hib3GrouperLoaderLog -
    • GrouperLoaderResultset

      public GrouperLoaderResultset(String ldapServerId, String filter, String searchDn, String subjectAttribute, String sourceId, String subjectIdType, String ldapSearchScope, String jobName, Hib3GrouperLoaderLog hib3GrouperLoaderLog, String ldapSubjectExpression)
      get a resultset based on an ldap server and filter
      Parameters:
      ldapServerId - server id in grouper-loader.properties
      filter - ldap filter query
      searchDn - place in ldap where search starts from
      subjectAttribute - attribute where the subjectId, or subjectIdentifier, or subjectIdOrIdentifier is
      sourceId - if all subjects come from one source, put the sourceId here
      subjectIdType - the type of the subjectId, either: subjectId, subjectIdentifier, or subjectIdOrIdentifier
      ldapSearchScope - either OBJECT_SCOPE, ONELEVEL_SCOPE, SUBTREE_SCOPE
      jobName - for logging if problem
      hib3GrouperLoaderLog -
      ldapSubjectExpression -
    • GrouperLoaderResultset

      public GrouperLoaderResultset()
  • Method Details

    • main

      public static void main(String[] args)
      Parameters:
      args -
    • bulkLookupSubjects

      public void bulkLookupSubjects()
      if we should bulk lookup subjects to add/remove
    • groupNames

      public Set<String> groupNames()
      get a set of group names
      Returns:
      the set of names, never null
    • initForLdapListOfGroups

      public void initForLdapListOfGroups(String ldapServerId, String filter, String searchDn, String subjectAttributeName, String sourceId, String subjectIdType, String ldapSearchScope, String jobName, Hib3GrouperLoaderLog hib3GrouperLoaderLog, String subjectExpression, String extraAttributes, String groupNameExpression, String groupDisplayNameExpression, String groupDescriptionExpression, Map<String,String> groupNameToDisplayName, Map<String,String> groupNameToDescription, Set<String> groupNames)
      get a resultset based on an ldap server and filter for ldap list of groups
      Parameters:
      ldapServerId - server id in grouper-loader.properties
      filter - ldap filter query
      searchDn - place in ldap where search starts from
      subjectAttributeName - attribute where the subjectId, or subjectIdentifier, or subjectIdOrIdentifier is
      sourceId - if all subjects come from one source, put the sourceId here
      subjectIdType - the type of the subjectId, either: subjectId, subjectIdentifier, or subjectIdOrIdentifier
      ldapSearchScope - either OBJECT_SCOPE, ONELEVEL_SCOPE, SUBTREE_SCOPE
      jobName - for logging if problem
      hib3GrouperLoaderLog -
      subjectExpression -
      extraAttributes -
      groupNameExpression -
      groupDisplayNameExpression -
      groupDescriptionExpression -
      groupNameToDisplayName - map to translate group name to display name
      groupNameToDescription - map to translate group name to description
      groupNames - keep track of which group names there are
    • initForLdapGroupsFromAttributes

      public void initForLdapGroupsFromAttributes(String ldapServerId, String filter, String searchDn, String subjectAttributeName, String groupAttributeName, String sourceId, String subjectIdType, String ldapSearchScope, String jobName, Hib3GrouperLoaderLog hib3GrouperLoaderLog, String subjectExpression, String extraAttributes, String groupNameExpression, String groupDisplayNameExpression, String groupDescriptionExpression, Map<String,String> groupNameToDisplayName, Map<String,String> groupNameToDescription, String ldapAttributeFilterExpression, String resultsTransformationClass)
      get a resultset based on an ldap server and filter for ldap list of groups
      Parameters:
      ldapServerId - server id in grouper-loader.properties
      filter - ldap filter query
      searchDn - place in ldap where search starts from
      subjectAttributeName - attribute where the subjectId, or subjectIdentifier, or subjectIdOrIdentifier is
      groupAttributeName - attribute (e.g. affiliation) of subject which holds link to group
      sourceId - if all subjects come from one source, put the sourceId here
      subjectIdType - the type of the subjectId, either: subjectId, subjectIdentifier, or subjectIdOrIdentifier
      ldapSearchScope - either OBJECT_SCOPE, ONELEVEL_SCOPE, SUBTREE_SCOPE
      jobName - for logging if problem
      hib3GrouperLoaderLog -
      subjectExpression -
      extraAttributes -
      groupNameExpression -
      groupDisplayNameExpression -
      groupDescriptionExpression -
      groupNameToDisplayName - map to translate group name to display name
      groupNameToDescription - map to translate group name to description
      ldapAttributeFilterExpression - if specified, this will filter the attributes that are turned into groups, should return true or false
      resultsTransformationClass -
    • getLdapMembershipsForLdapGroupsFromAttributes

      public static Map<String,List<String>> getLdapMembershipsForLdapGroupsFromAttributes(String ldapServerId, String filter, String searchDn, String subjectAttributeName, String groupAttributeName, String sourceId, String subjectIdType, String ldapSearchScope, Hib3GrouperLoaderLog hib3GrouperLoaderLog, String overallGroupName, String subjectExpression, String extraAttributes, String groupNameExpression, String groupDisplayNameExpression, String groupDescriptionExpression, Map<String,String> groupNameToDisplayName, Map<String,String> groupNameToDescription, String ldapAttributeFilterExpression, String subjectIdIfIncremental, String resultsTransformationClass)
      Parameters:
      ldapServerId -
      filter -
      searchDn -
      subjectAttributeName -
      groupAttributeName -
      sourceId -
      subjectIdType -
      ldapSearchScope -
      jobName -
      hib3GrouperLoaderLog -
      overallGroupName -
      subjectExpression -
      extraAttributes -
      groupNameExpression -
      groupDisplayNameExpression -
      groupDescriptionExpression -
      groupNameToDisplayName -
      groupNameToDescription -
      ldapAttributeFilterExpression -
      subjectIdIfIncremental -
      resultsTransformationClass -
      Returns:
      map of memberships
    • groupParentFolderNameIsRoot

      public static boolean groupParentFolderNameIsRoot(String overallGroupName, String groupName)
      This is going to end with a colon.
      Parameters:
      requireTopStemAsStemFromConfigGroup -
      overallGroupName -
      groupName -
      Returns:
    • columnIndex

      public int columnIndex(String columnNameInput)
      find a column index in the resultset
      Parameters:
      columnNameInput -
      Returns:
      the column index
    • columnIndex

      public int columnIndex(String columnNameInput, boolean throwErrorIfNotFound)
      find a column index in the resultset
      Parameters:
      columnNameInput -
      throwErrorIfNotFound - if should throw error if not found
      Returns:
      the column index or -1 if not found or exception
    • retrieveRow

      public GrouperLoaderResultset.Row retrieveRow(int i)
      find a certain row
      Parameters:
      i -
      Returns:
      the row
    • numberOfRows

      public int numberOfRows()
      return the number of rows
      Returns:
      the number of rows
    • getColumnNames

      public List<String> getColumnNames()
      return the column names
      Returns:
      the column names
    • getCell

      public Object getCell(int rowIndex, String columnName, boolean exceptionOnColNotFound)
      get a cell in the data structure
      Parameters:
      rowIndex -
      columnName -
      exceptionOnColNotFound -
      Returns:
      the cell or null if col not found and not throwing exception if col not found
    • assertColumnName

      public void assertColumnName(String columnName)
      make sure this column name is here
      Parameters:
      columnName -
    • hasColumnName

      public boolean hasColumnName(String columnName)
      make sure this column name is here
      Parameters:
      columnName -
      Returns:
      true if the column is there
    • remove

      public void remove(GrouperLoaderResultset.Row row)
      remove by row
      Parameters:
      row -
    • remove

      public void remove(int i)
      remove by row index
      Parameters:
      i -
    • find

      public GrouperLoaderResultset.Row find(String subjectId, String subjectSourceId, String subjectIdentifier0, String subjectIdentifier1, String subjectIdentifier2)
      find a row and return
      Parameters:
      subjectId -
      subjectSourceId -
      subjectIdentifier0 -
      subjectIdentifier1 -
      subjectIdentifier2 -
      Returns:
      row if found, else null