edu.internet2.middleware.grouper.rules
Class RuleUtils

java.lang.Object
  extended by edu.internet2.middleware.grouper.rules.RuleUtils

public class RuleUtils
extends Object


Field Summary
static String RULE_ACT_AS_SUBJECT_ID
           
static String RULE_ACT_AS_SUBJECT_IDENTIFIER
           
static String RULE_ACT_AS_SUBJECT_SOURCE_ID
           
static String RULE_CHECK_ARG0
           
static String RULE_CHECK_ARG1
           
static String RULE_CHECK_OWNER_ID
           
static String RULE_CHECK_OWNER_NAME
           
static String RULE_CHECK_STEM_SCOPE
           
static String RULE_CHECK_TYPE
           
static String RULE_IF_CONDITION_EL
           
static String RULE_IF_CONDITION_ENUM
           
static String RULE_IF_CONDITION_ENUM_ARG0
           
static String RULE_IF_CONDITION_ENUM_ARG1
           
static String RULE_IF_OWNER_ID
           
static String RULE_IF_OWNER_NAME
           
static String RULE_IF_STEM_SCOPE
           
static String RULE_RUN_DAEMON
          should be T or F
static String RULE_THEN_EL
           
static String RULE_THEN_ENUM
           
static String RULE_THEN_ENUM_ARG0
           
static String RULE_THEN_ENUM_ARG1
           
static String RULE_THEN_ENUM_ARG2
           
static String RULE_VALID
           
 
Constructor Summary
RuleUtils()
           
 
Method Summary
static AttributeDef attributeDef(String attributeDefId, String attributeDefName, String alternateAttributeDefId, boolean useRootSession, boolean throwExceptionIfNotFound)
           
static String attributeRuleStemName()
          return the stem name where the rule attributes go, without colon on end
static String emailTemplate(String emailTemplateString)
          if it starts with template: then get the arg from a file.
static boolean folderHasMembership(RulesBean rulesBean, String stemId, String stemName, Stem.Scope stemScope, MembershipType membershipType)
          see if there is a membership in the folder
static Group group(String groupId, String groupName, String alternateGroupId, boolean useRootSession, boolean throwExceptionIfNotFound)
           
static boolean groupHasImmediateEnabledMembership(RulesBean rulesBean, String groupId)
           
static Set<PermissionEntry> permissionsForUser(String attributeDefId, RulesBean rulesBean, boolean noEndDate)
           
static Set<PermissionEntry> permissionsForUser(String attributeDefId, String memberId, boolean noEndDate)
           
static String removeSurroundingQuotesConvertNull(String string)
          take in a string, e.g.
static String ruleActAsSubjectIdentifierName()
          full rule then el name
static String ruleActAsSubjectIdName()
          full ruleActAsSubjectIdName
static String ruleActAsSubjectSourceIdName()
          full ruleActAsSubjectSourceIdName
static AttributeDef ruleAttrAttributeDef()
          return the rule attr attribute def this throws exception if cant find
static AttributeDefName ruleAttributeDefName()
          return the rule attribute def name, assign this to an object to attach a rule.
static String ruleCheckArg0Name()
          full ruleCheckArg0Name
static String ruleCheckArg1Name()
          full ruleCheckArg1Name
static String ruleCheckOwnerIdName()
          full ruleCheckOwnerIdName
static String ruleCheckOwnerNameName()
          full ruleCheckOwnerName
static String ruleCheckStemScopeName()
          full ruleCheckStemScope
static String ruleCheckTypeName()
          full ruleCheckTypeName
static String ruleIfConditionElName()
          full rule ruleIfConditionElName
static String ruleIfConditionEnumArg0Name()
          full rule if condition enum arg0 name
static String ruleIfConditionEnumArg1Name()
          full rule if condition enum arg1 name
static String ruleIfConditionEnumName()
          full rule if condition enum name
static String ruleIfOwnerIdName()
          full ruleIfOwnerIdName
static String ruleIfOwnerNameName()
          full ruleIfOwnerName
static String ruleIfStemScopeName()
          full ruleIfStemScopeName
static String ruleRunDaemonName()
          full rule run daemon name
static String ruleThenElName()
          full rule then el name
static String ruleThenEnumArg0Name()
          full rule then enum arg0 name
static String ruleThenEnumArg1Name()
          full rule then enum arg1 name
static String ruleThenEnumArg2Name()
          full rule then enum arg2 name
static String ruleThenEnumName()
          full rule then enum name
static AttributeDef ruleTypeAttributeDef()
          return the rule type attribute def this throws exception if cant find
static AttributeDefName ruleValidAttributeDefName()
          return the rule attribute def name, assign this to an object to attach a rule.
static String ruleValidName()
          full rule valid name name
static Stem stem(String stemId, String stemName, String alternateStemId, boolean useRootSession, boolean throwExceptionIfNotFound)
           
static String validateAttributeDef(String attributeDefId, String attributeDefName, String alternateAttributeDefId)
           
static String validateGroup(String groupId, String groupName, String alternateGroupId)
           
static String validateStem(String stemId, String stemName, String alternateStemId)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RULE_THEN_EL

public static final String RULE_THEN_EL
See Also:
Constant Field Values

RULE_RUN_DAEMON

public static final String RULE_RUN_DAEMON
should be T or F

See Also:
Constant Field Values

RULE_VALID

public static final String RULE_VALID
See Also:
Constant Field Values

RULE_THEN_ENUM

public static final String RULE_THEN_ENUM
See Also:
Constant Field Values

RULE_THEN_ENUM_ARG0

public static final String RULE_THEN_ENUM_ARG0
See Also:
Constant Field Values

RULE_THEN_ENUM_ARG1

public static final String RULE_THEN_ENUM_ARG1
See Also:
Constant Field Values

RULE_THEN_ENUM_ARG2

public static final String RULE_THEN_ENUM_ARG2
See Also:
Constant Field Values

RULE_IF_CONDITION_ENUM

public static final String RULE_IF_CONDITION_ENUM
See Also:
Constant Field Values

RULE_IF_CONDITION_ENUM_ARG0

public static final String RULE_IF_CONDITION_ENUM_ARG0
See Also:
Constant Field Values

RULE_IF_CONDITION_ENUM_ARG1

public static final String RULE_IF_CONDITION_ENUM_ARG1
See Also:
Constant Field Values

RULE_IF_CONDITION_EL

public static final String RULE_IF_CONDITION_EL
See Also:
Constant Field Values

RULE_IF_OWNER_NAME

public static final String RULE_IF_OWNER_NAME
See Also:
Constant Field Values

RULE_CHECK_OWNER_NAME

public static final String RULE_CHECK_OWNER_NAME
See Also:
Constant Field Values

RULE_CHECK_STEM_SCOPE

public static final String RULE_CHECK_STEM_SCOPE
See Also:
Constant Field Values

RULE_CHECK_OWNER_ID

public static final String RULE_CHECK_OWNER_ID
See Also:
Constant Field Values

RULE_CHECK_ARG0

public static final String RULE_CHECK_ARG0
See Also:
Constant Field Values

RULE_CHECK_ARG1

public static final String RULE_CHECK_ARG1
See Also:
Constant Field Values

RULE_IF_OWNER_ID

public static final String RULE_IF_OWNER_ID
See Also:
Constant Field Values

RULE_IF_STEM_SCOPE

public static final String RULE_IF_STEM_SCOPE
See Also:
Constant Field Values

RULE_CHECK_TYPE

public static final String RULE_CHECK_TYPE
See Also:
Constant Field Values

RULE_ACT_AS_SUBJECT_SOURCE_ID

public static final String RULE_ACT_AS_SUBJECT_SOURCE_ID
See Also:
Constant Field Values

RULE_ACT_AS_SUBJECT_IDENTIFIER

public static final String RULE_ACT_AS_SUBJECT_IDENTIFIER
See Also:
Constant Field Values

RULE_ACT_AS_SUBJECT_ID

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

RuleUtils

public RuleUtils()
Method Detail

groupHasImmediateEnabledMembership

public static boolean groupHasImmediateEnabledMembership(RulesBean rulesBean,
                                                         String groupId)
Parameters:
rulesBean -
groupId -
Returns:

folderHasMembership

public static boolean folderHasMembership(RulesBean rulesBean,
                                          String stemId,
                                          String stemName,
                                          Stem.Scope stemScope,
                                          MembershipType membershipType)
see if there is a membership in the folder

Parameters:
rulesBean -
stemId - add either this or stem name
stemName - add either this or stem id
stemScope -
membershipType - null for any
Returns:
true if membership, false if not

permissionsForUser

public static Set<PermissionEntry> permissionsForUser(String attributeDefId,
                                                      RulesBean rulesBean,
                                                      boolean noEndDate)
Parameters:
attributeDefId -
rulesBean -
noEndDate -
Returns:
the set of permissions entries

permissionsForUser

public static Set<PermissionEntry> permissionsForUser(String attributeDefId,
                                                      String memberId,
                                                      boolean noEndDate)
Parameters:
attributeDefId -
rulesBean -
memberId -
noEndDate -
Returns:
the set of permissions entries

emailTemplate

public static String emailTemplate(String emailTemplateString)
if it starts with template: then get the arg from a file. If it doesnt, then it is the template, return that. if there is a problem retrieving the template, then throw exception. if the template name is invalid, throw exception

Parameters:
emailTemplateString -
Returns:
the email template

removeSurroundingQuotesConvertNull

public static String removeSurroundingQuotesConvertNull(String string)
take in a string, e.g. "this", and return it without quotes on the outside

Parameters:
string -
Returns:
the string

ruleAttributeDefName

public static AttributeDefName ruleAttributeDefName()
return the rule attribute def name, assign this to an object to attach a rule. this throws exception if cant find

Returns:
the attribute def name

ruleValidAttributeDefName

public static AttributeDefName ruleValidAttributeDefName()
return the rule attribute def name, assign this to an object to attach a rule. this throws exception if cant find

Returns:
the attribute def name

ruleTypeAttributeDef

public static AttributeDef ruleTypeAttributeDef()
return the rule type attribute def this throws exception if cant find

Returns:
the attribute def

ruleAttrAttributeDef

public static AttributeDef ruleAttrAttributeDef()
return the rule attr attribute def this throws exception if cant find

Returns:
the attribute def

attributeRuleStemName

public static String attributeRuleStemName()
return the stem name where the rule attributes go, without colon on end

Returns:
stem name

ruleThenElName

public static String ruleThenElName()
full rule then el name

Returns:
name

ruleRunDaemonName

public static String ruleRunDaemonName()
full rule run daemon name

Returns:
name

ruleValidName

public static String ruleValidName()
full rule valid name name

Returns:
name

ruleThenEnumName

public static String ruleThenEnumName()
full rule then enum name

Returns:
name

ruleThenEnumArg0Name

public static String ruleThenEnumArg0Name()
full rule then enum arg0 name

Returns:
name

ruleThenEnumArg1Name

public static String ruleThenEnumArg1Name()
full rule then enum arg1 name

Returns:
name

ruleThenEnumArg2Name

public static String ruleThenEnumArg2Name()
full rule then enum arg2 name

Returns:
name

ruleIfConditionEnumName

public static String ruleIfConditionEnumName()
full rule if condition enum name

Returns:
name

ruleIfConditionEnumArg0Name

public static String ruleIfConditionEnumArg0Name()
full rule if condition enum arg0 name

Returns:
name

ruleIfConditionEnumArg1Name

public static String ruleIfConditionEnumArg1Name()
full rule if condition enum arg1 name

Returns:
name

ruleIfConditionElName

public static String ruleIfConditionElName()
full rule ruleIfConditionElName

Returns:
name

ruleIfOwnerNameName

public static String ruleIfOwnerNameName()
full ruleIfOwnerName

Returns:
name

ruleCheckOwnerNameName

public static String ruleCheckOwnerNameName()
full ruleCheckOwnerName

Returns:
name

ruleCheckStemScopeName

public static String ruleCheckStemScopeName()
full ruleCheckStemScope

Returns:
name

ruleCheckOwnerIdName

public static String ruleCheckOwnerIdName()
full ruleCheckOwnerIdName

Returns:
name

ruleCheckArg0Name

public static String ruleCheckArg0Name()
full ruleCheckArg0Name

Returns:
name

ruleCheckArg1Name

public static String ruleCheckArg1Name()
full ruleCheckArg1Name

Returns:
name

ruleIfOwnerIdName

public static String ruleIfOwnerIdName()
full ruleIfOwnerIdName

Returns:
name

ruleIfStemScopeName

public static String ruleIfStemScopeName()
full ruleIfStemScopeName

Returns:
name

ruleCheckTypeName

public static String ruleCheckTypeName()
full ruleCheckTypeName

Returns:
name

ruleActAsSubjectSourceIdName

public static String ruleActAsSubjectSourceIdName()
full ruleActAsSubjectSourceIdName

Returns:
name

ruleActAsSubjectIdentifierName

public static String ruleActAsSubjectIdentifierName()
full rule then el name

Returns:
name

ruleActAsSubjectIdName

public static String ruleActAsSubjectIdName()
full ruleActAsSubjectIdName

Returns:
name

group

public static Group group(String groupId,
                          String groupName,
                          String alternateGroupId,
                          boolean useRootSession,
                          boolean throwExceptionIfNotFound)
Parameters:
groupId -
groupName -
alternateGroupId -
useRootSession - if we should use root or static session
throwExceptionIfNotFound -
Returns:
group or null

stem

public static Stem stem(String stemId,
                        String stemName,
                        String alternateStemId,
                        boolean useRootSession,
                        boolean throwExceptionIfNotFound)
Parameters:
stemId -
stemName -
alternateStemId -
useRootSession - if we should use root or static session
throwExceptionIfNotFound -
Returns:
stem or null

attributeDef

public static AttributeDef attributeDef(String attributeDefId,
                                        String attributeDefName,
                                        String alternateAttributeDefId,
                                        boolean useRootSession,
                                        boolean throwExceptionIfNotFound)
Parameters:
attributeDefId -
attributeDefName -
alternateAttributeDefId -
useRootSession - if we should use root or static session
throwExceptionIfNotFound -
Returns:
attributeDef or null

validateGroup

public static String validateGroup(String groupId,
                                   String groupName,
                                   String alternateGroupId)
Parameters:
groupId -
groupName -
alternateGroupId -
Returns:
the error message or null if ok

validateStem

public static String validateStem(String stemId,
                                  String stemName,
                                  String alternateStemId)
Parameters:
stemId -
stemName -
alternateStemId -
Returns:
the error message or null if ok

validateAttributeDef

public static String validateAttributeDef(String attributeDefId,
                                          String attributeDefName,
                                          String alternateAttributeDefId)
Parameters:
attributeDefId -
attributeDefName -
alternateAttributeDefId -
Returns:
the error message or null if ok