edu.internet2.middleware.grouper.hooks.examples
Class GroupTypeTupleIncludeExcludeHook

java.lang.Object
  extended by edu.internet2.middleware.grouper.hooks.GroupTypeTupleHooks
      extended by edu.internet2.middleware.grouper.hooks.examples.GroupTypeTupleIncludeExcludeHook

public class GroupTypeTupleIncludeExcludeHook
extends GroupTypeTupleHooks

 built in hook to grouper, which is turned on when it is configured in the grouper.properties.
 
 you can auto create groups to facilitate include and exclude lists
 
 to debug this add these two entries to log4j.properties
 
 log4j.logger.edu.internet2.middleware.grouper.hooks.examples.GroupTypeTupleIncludeExcludeHook = DEBUG
 log4j.logger.edu.internet2.middleware.grouper.Group = DEBUG
 


Field Summary
 
Fields inherited from class edu.internet2.middleware.grouper.hooks.GroupTypeTupleHooks
METHOD_GROUP_TYPE_TUPLE_POST_COMMIT_DELETE, METHOD_GROUP_TYPE_TUPLE_POST_COMMIT_INSERT, METHOD_GROUP_TYPE_TUPLE_POST_COMMIT_UPDATE, METHOD_GROUP_TYPE_TUPLE_POST_DELETE, METHOD_GROUP_TYPE_TUPLE_POST_INSERT, METHOD_GROUP_TYPE_TUPLE_POST_UPDATE, METHOD_GROUP_TYPE_TUPLE_PRE_DELETE, METHOD_GROUP_TYPE_TUPLE_PRE_INSERT, METHOD_GROUP_TYPE_TUPLE_PRE_UPDATE
 
Constructor Summary
GroupTypeTupleIncludeExcludeHook()
           
 
Method Summary
static String convertToOverall(String extension)
          convert a system of record extension to an overall extension
static int deleteGroupsIfNotUsed(GrouperSession grouperSession, String groupName, StringBuilder reason, boolean saveIncludesExcludesIfMembers)
           
static String excludeDescription(String overallGroupExtension, String overallGroupDisplayExtension)
          substitute and return systemOfRecordAndIncludes exclude description
static String excludeDisplayExtensionSuffix()
          substitute and return exclude name suffix
static String excludeExtensionSuffix()
          substitute and return exclude id suffix
static String groupNameFromAndGroupAttributeName(String attributeName)
           
 void groupTypeTuplePostDelete(HooksContext hooksContext, HooksGroupTypeTupleBean postDeleteBean)
          called right after a groupTypeTuple delete
 void groupTypeTuplePostInsert(HooksContext hooksContext, HooksGroupTypeTupleBean postInsertBean)
          called right after a groupTypeTuple insert
static String includeDescription(String overallGroupExtension, String overallGroupDisplayExtension)
          substitute and return systemOfRecordAndIncludes include description
static String includeDisplayExtensionSuffix()
          substitute and return include name suffix
static String includeExtensionSuffix()
          substitute and return include id suffix
static String includesMinusExcludesDescription(String overallGroupExtension, String overallGroupDisplayExtension)
          substitute and return includesMinusExcludes description
static String includesMinusExcludesDisplayExtensionSuffix()
          substitute and return includesMinusExcludes name suffix
static String includesMinusExcludesExtensionSuffix()
          substitute and return includesMinusExcludes id suffix
static void main(String[] args)
           
static void manageIncludesExcludesAndGroups(Group typedGroup, boolean isIncludeExclude, Set<Group> andGroups, String calledFromForLog)
          change a typed group into include and exclude group lists and andGroups also
static void manageIncludesExcludesAndGroups(GrouperSession grouperSession, Group typedGroup, String summaryForLog)
           
static boolean nameIsIncludeExcludeRequireGroup(String groupName)
          see if a group name has an include/exclude or requireGroup suffix
static String overallDescription(String overallGroupExtension, String overallGroupDisplayExtension)
          substitute and return systemOfRecordAndIncludes overall description
static void registerHookIfNecessary(boolean tryAgainIfNotBefore)
          see if this is configured in the grouper.properties, if so, register this hook
static Set<Group> relatedGroups(Group group)
          return a set of groups including the one passed in, related to this group.
static String requireGroupsDescription(int index, String overallGroupExtension, String overallGroupDisplayExtension)
          description of group for includeExcludeMinusAndGroup, index is 1 based
static String requireGroupsDisplayExtensionSuffix(int index)
          display extension of group for includeExcludeMinusAndGroup, index is 1 based
static String requireGroupsExtensionSuffix(int index)
          extension of group for includeExcludeMinusAndGroup, index is 1 based
static String systemOfRecordAndIncludesDescription(String overallGroupExtension, String overallGroupDisplayExtension)
          substitute and return systemOfRecordAndIncludes systemOfRecordAndIncludes description
static String systemOfRecordAndIncludesDisplayExtensionSuffix()
          substitute and return systemOfRecordAndIncludes name suffix
static String systemOfRecordAndIncludesExtensionSuffix()
          substitute and return systemOfRecordAndIncludes id suffix
static String systemOfRecordDescription(String overallGroupExtension, String overallGroupDisplayExtension)
          substitute and return systemOfRecordAndIncludes systemOfRecord description
static String systemOfRecordDisplayExtensionSuffix()
          substitute and return overall systemOfRecord suffix
static String systemOfRecordExtensionSuffix()
          substitute and return system of record id suffix
 
Methods inherited from class edu.internet2.middleware.grouper.hooks.GroupTypeTupleHooks
groupTypeTuplePostCommitDelete, groupTypeTuplePostCommitInsert, groupTypeTuplePostCommitUpdate, groupTypeTuplePostUpdate, groupTypeTuplePreDelete, groupTypeTuplePreInsert, groupTypeTuplePreUpdate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupTypeTupleIncludeExcludeHook

public GroupTypeTupleIncludeExcludeHook()
Method Detail

registerHookIfNecessary

public static void registerHookIfNecessary(boolean tryAgainIfNotBefore)
see if this is configured in the grouper.properties, if so, register this hook

Parameters:
tryAgainIfNotBefore -

groupNameFromAndGroupAttributeName

public static String groupNameFromAndGroupAttributeName(String attributeName)
Parameters:
attributeName -
Returns:
the group name from the config file

groupTypeTuplePostDelete

public void groupTypeTuplePostDelete(HooksContext hooksContext,
                                     HooksGroupTypeTupleBean postDeleteBean)
Description copied from class: GroupTypeTupleHooks
called right after a groupTypeTuple delete

Overrides:
groupTypeTuplePostDelete in class GroupTypeTupleHooks
See Also:
GroupTypeTupleHooks.groupTypeTuplePostDelete(edu.internet2.middleware.grouper.hooks.beans.HooksContext, edu.internet2.middleware.grouper.hooks.beans.HooksGroupTypeTupleBean)

groupTypeTuplePostInsert

public void groupTypeTuplePostInsert(HooksContext hooksContext,
                                     HooksGroupTypeTupleBean postInsertBean)
Description copied from class: GroupTypeTupleHooks
called right after a groupTypeTuple insert

Overrides:
groupTypeTuplePostInsert in class GroupTypeTupleHooks
See Also:
GroupTypeTupleHooks.groupTypeTuplePostInsert(edu.internet2.middleware.grouper.hooks.beans.HooksContext, edu.internet2.middleware.grouper.hooks.beans.HooksGroupTypeTupleBean)

convertToOverall

public static String convertToOverall(String extension)
convert a system of record extension to an overall extension

Parameters:
extension - is overall extension or system of record extension
Returns:
the overall extension

relatedGroups

public static Set<Group> relatedGroups(Group group)
return a set of groups including the one passed in, related to this group. if the groups arent found, dont worry i.e. if include/exclude or requireGroups, find related groups

Parameters:
group -
Returns:
the set of groups

main

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

manageIncludesExcludesAndGroups

public static void manageIncludesExcludesAndGroups(GrouperSession grouperSession,
                                                   Group typedGroup,
                                                   String summaryForLog)
Parameters:
grouperSession -
typedGroup -
summaryForLog - some string that will be logged to debug...

excludeDescription

public static String excludeDescription(String overallGroupExtension,
                                        String overallGroupDisplayExtension)
substitute and return systemOfRecordAndIncludes exclude description

Parameters:
overallGroupExtension -
overallGroupDisplayExtension -
Returns:
description

excludeDisplayExtensionSuffix

public static String excludeDisplayExtensionSuffix()
substitute and return exclude name suffix

Returns:
suffix

excludeExtensionSuffix

public static String excludeExtensionSuffix()
substitute and return exclude id suffix

Returns:
suffix

manageIncludesExcludesAndGroups

public static void manageIncludesExcludesAndGroups(Group typedGroup,
                                                   boolean isIncludeExclude,
                                                   Set<Group> andGroups,
                                                   String calledFromForLog)
change a typed group into include and exclude group lists and andGroups also

Parameters:
typedGroup -
isIncludeExclude -
andGroups -
calledFromForLog - summary of where this is coming from for debug log

systemOfRecordExtensionSuffix

public static String systemOfRecordExtensionSuffix()
substitute and return system of record id suffix

Returns:
suffix

nameIsIncludeExcludeRequireGroup

public static boolean nameIsIncludeExcludeRequireGroup(String groupName)
see if a group name has an include/exclude or requireGroup suffix

Parameters:
groupName -
Returns:
true if include/exclude

includeExtensionSuffix

public static String includeExtensionSuffix()
substitute and return include id suffix

Returns:
suffix

includesMinusExcludesExtensionSuffix

public static String includesMinusExcludesExtensionSuffix()
substitute and return includesMinusExcludes id suffix

Returns:
suffix

systemOfRecordAndIncludesExtensionSuffix

public static String systemOfRecordAndIncludesExtensionSuffix()
substitute and return systemOfRecordAndIncludes id suffix

Returns:
suffix

systemOfRecordDisplayExtensionSuffix

public static String systemOfRecordDisplayExtensionSuffix()
substitute and return overall systemOfRecord suffix

Returns:
suffix

includeDisplayExtensionSuffix

public static String includeDisplayExtensionSuffix()
substitute and return include name suffix

Returns:
suffix

includesMinusExcludesDisplayExtensionSuffix

public static String includesMinusExcludesDisplayExtensionSuffix()
substitute and return includesMinusExcludes name suffix

Returns:
suffix

requireGroupsExtensionSuffix

public static String requireGroupsExtensionSuffix(int index)
extension of group for includeExcludeMinusAndGroup, index is 1 based

Parameters:
index -
Returns:
the extension

deleteGroupsIfNotUsed

public static int deleteGroupsIfNotUsed(GrouperSession grouperSession,
                                        String groupName,
                                        StringBuilder reason,
                                        boolean saveIncludesExcludesIfMembers)
Parameters:
grouperSession -
groupName - if the overall or system of record group
reason - if you want a reason passed back
saveIncludesExcludesIfMembers - true if not delete only the includes group and excludes group if they have members. false, delete anyway
Returns:
the number of groups removed

requireGroupsDescription

public static String requireGroupsDescription(int index,
                                              String overallGroupExtension,
                                              String overallGroupDisplayExtension)
description of group for includeExcludeMinusAndGroup, index is 1 based

Parameters:
index -
overallGroupExtension -
overallGroupDisplayExtension -
Returns:
the extension

requireGroupsDisplayExtensionSuffix

public static String requireGroupsDisplayExtensionSuffix(int index)
display extension of group for includeExcludeMinusAndGroup, index is 1 based

Parameters:
index -
Returns:
the extension

systemOfRecordAndIncludesDisplayExtensionSuffix

public static String systemOfRecordAndIncludesDisplayExtensionSuffix()
substitute and return systemOfRecordAndIncludes name suffix

Returns:
suffix

overallDescription

public static String overallDescription(String overallGroupExtension,
                                        String overallGroupDisplayExtension)
substitute and return systemOfRecordAndIncludes overall description

Parameters:
overallGroupExtension -
overallGroupDisplayExtension -
Returns:
description

systemOfRecordAndIncludesDescription

public static String systemOfRecordAndIncludesDescription(String overallGroupExtension,
                                                          String overallGroupDisplayExtension)
substitute and return systemOfRecordAndIncludes systemOfRecordAndIncludes description

Parameters:
overallGroupExtension -
overallGroupDisplayExtension -
Returns:
description

systemOfRecordDescription

public static String systemOfRecordDescription(String overallGroupExtension,
                                               String overallGroupDisplayExtension)
substitute and return systemOfRecordAndIncludes systemOfRecord description

Parameters:
overallGroupExtension -
overallGroupDisplayExtension -
Returns:
description

includeDescription

public static String includeDescription(String overallGroupExtension,
                                        String overallGroupDisplayExtension)
substitute and return systemOfRecordAndIncludes include description

Parameters:
overallGroupExtension -
overallGroupDisplayExtension -
Returns:
description

includesMinusExcludesDescription

public static String includesMinusExcludesDescription(String overallGroupExtension,
                                                      String overallGroupDisplayExtension)
substitute and return includesMinusExcludes description

Parameters:
overallGroupExtension -
overallGroupDisplayExtension -
Returns:
description