Class GroupTypeTupleIncludeExcludeHook

java.lang.Object
edu.internet2.middleware.grouper.hooks.GroupTypeTupleHooks
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
 
  • Constructor Details

    • GroupTypeTupleIncludeExcludeHook

      public GroupTypeTupleIncludeExcludeHook()
  • Method Details

    • clearHook

      public static void clearHook()
    • 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:
    • 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:
    • 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