edu.internet2.middleware.grouper.app.loader.db
Class GrouperLoaderResultset

java.lang.Object
  extended by 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


Nested Class Summary
 class GrouperLoaderResultset.Row
          simple struct for subjects
 
Field Summary
static String ACTION_NAME_COL
           
static String ATTR_DESCRIPTION_COL
           
static String ATTR_DISPLAY_NAME_COL
           
static String ATTR_NAME_COL
           
static String GROUP_ADMINS_COL
           
static String GROUP_ATTR_READERS_COL
           
static String GROUP_ATTR_UPDATERS_COL
           
static String GROUP_DESCRIPTION_COL
           
static String GROUP_DISPLAY_NAME_COL
           
static String GROUP_NAME_COL
           
static String GROUP_OPTINS_COL
           
static String GROUP_OPTOUTS_COL
           
static String GROUP_READERS_COL
           
static String GROUP_UPDATERS_COL
           
static String GROUP_VIEWERS_COL
           
static String IF_HAS_ACTION_NAME_COL
           
static String IF_HAS_ATTR_NAME_COL
           
static String SUBJECT_ID_COL
           
static String SUBJECT_ID_OR_IDENTIFIER_COL
           
static String SUBJECT_IDENTIFIER_COL
           
static String SUBJECT_SOURCE_ID_COL
           
static String THEN_HAS_ACTION_NAME_COL
           
static String THEN_HAS_ATTR_NAME_COL
           
 
Constructor Summary
GrouperLoaderResultset()
           
GrouperLoaderResultset(GrouperLoaderDb grouperLoaderDb, String query, String jobName, Hib3GrouperLoaderLog hib3GrouperLoaderLog)
          get a resultset based on a db and query
GrouperLoaderResultset(GrouperLoaderResultset parentResultSet, String groupName)
          get a resultset on another resultset and a group name
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
 
Method Summary
 void assertColumnName(String columnName)
          make sure this column name is here
 void bulkLookupSubjects()
          if we should bulk lookup subjects to add/remove
 int columnIndex(String columnNameInput)
          find a column index in the resultset
 int columnIndex(String columnNameInput, boolean throwErrorIfNotFound)
          find a column index in the resultset
 GrouperLoaderResultset.Row find(String subjectId, String subjectSourceId, String subjectIdentifier0)
          find a row and return
 Object getCell(int rowIndex, String columnName, boolean exceptionOnColNotFound)
          get a cell in the data structure
 List<String> getColumnNames()
          return the column names
 Set<String> groupNames()
          get a set of group names
 boolean hasColumnName(String columnName)
          make sure this column name is here
 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)
          get a resultset based on an ldap server and filter for ldap list of groups
 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
 int numberOfRows()
          return the number of rows
 void remove(GrouperLoaderResultset.Row row)
          remove by row
 void remove(int i)
          remove by row index
 GrouperLoaderResultset.Row retrieveRow(int i)
          find a certain row
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUBJECT_ID_COL

public static final String SUBJECT_ID_COL
See Also:
Constant Field Values

SUBJECT_IDENTIFIER_COL

public static final String SUBJECT_IDENTIFIER_COL
See Also:
Constant Field Values

SUBJECT_ID_OR_IDENTIFIER_COL

public static final String SUBJECT_ID_OR_IDENTIFIER_COL
See Also:
Constant Field Values

ACTION_NAME_COL

public static final String ACTION_NAME_COL
See Also:
Constant Field Values

GROUP_NAME_COL

public static final String GROUP_NAME_COL
See Also:
Constant Field Values

GROUP_DISPLAY_NAME_COL

public static final String GROUP_DISPLAY_NAME_COL
See Also:
Constant Field Values

GROUP_DESCRIPTION_COL

public static final String GROUP_DESCRIPTION_COL
See Also:
Constant Field Values

GROUP_VIEWERS_COL

public static final String GROUP_VIEWERS_COL
See Also:
Constant Field Values

GROUP_READERS_COL

public static final String GROUP_READERS_COL
See Also:
Constant Field Values

GROUP_UPDATERS_COL

public static final String GROUP_UPDATERS_COL
See Also:
Constant Field Values

GROUP_ADMINS_COL

public static final String GROUP_ADMINS_COL
See Also:
Constant Field Values

ATTR_NAME_COL

public static final String ATTR_NAME_COL
See Also:
Constant Field Values

ATTR_DISPLAY_NAME_COL

public static final String ATTR_DISPLAY_NAME_COL
See Also:
Constant Field Values

ATTR_DESCRIPTION_COL

public static final String ATTR_DESCRIPTION_COL
See Also:
Constant Field Values

IF_HAS_ATTR_NAME_COL

public static final String IF_HAS_ATTR_NAME_COL
See Also:
Constant Field Values

THEN_HAS_ATTR_NAME_COL

public static final String THEN_HAS_ATTR_NAME_COL
See Also:
Constant Field Values

IF_HAS_ACTION_NAME_COL

public static final String IF_HAS_ACTION_NAME_COL
See Also:
Constant Field Values

THEN_HAS_ACTION_NAME_COL

public static final String THEN_HAS_ACTION_NAME_COL
See Also:
Constant Field Values

GROUP_OPTINS_COL

public static final String GROUP_OPTINS_COL
See Also:
Constant Field Values

GROUP_OPTOUTS_COL

public static final String GROUP_OPTOUTS_COL
See Also:
Constant Field Values

GROUP_ATTR_READERS_COL

public static final String GROUP_ATTR_READERS_COL
See Also:
Constant Field Values

GROUP_ATTR_UPDATERS_COL

public static final String GROUP_ATTR_UPDATERS_COL
See Also:
Constant Field Values

SUBJECT_SOURCE_ID_COL

public static final String SUBJECT_SOURCE_ID_COL
See Also:
Constant Field Values
Constructor Detail

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 Detail

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)
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

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)
find a row and return

Parameters:
subjectId -
subjectSourceId -
subjectIdentifier0 -
Returns:
row if found, else null