java.lang.Object
com.codebarrel.automation.api.config.Scope

public final class Scope extends Object
A set of methods to help determine the scope of a rule or the type of a rule restriction. Ideally these would live on RuleConfigBean and ProjectAssociationBean but that cannot happen until the big split and the -api project is merged back in. Until that time they live here. This should be all you need so think twice before making any changes :)
  • Method Summary

    Modifier and Type
    Method
    Description
    static Set<String>
    getProjectIdsFromProjectRestrictions(com.codebarrel.automation.api.config.RuleConfigBean rule)
    Filters restrictions to just project instance restrictions and then returns just the project id of each restriction
    static Set<String>
    getProjectTypesFromProjectRestrictions(com.codebarrel.automation.api.config.RuleConfigBean rule)
    Filters restrictions to just project instance restrictions and then returns just the project type of each restriction
    static boolean
    isGlobalRule(com.codebarrel.automation.api.config.RuleConfigBean rule)
    Checks to see if the rule applies to any project (it has no restrictions at all).
    static boolean
    isMultiProjectRule(com.codebarrel.automation.api.config.RuleConfigBean rule)
    Checks whether the rule is restricted to more than one project instance
    static boolean
    isProjectInRuleRestrictions(com.codebarrel.automation.api.config.RuleConfigBean rule, String projectId)
    Checks to see if a rule contains a restriction on a particular project
    protected static boolean
    isProjectRestriction(com.codebarrel.automation.api.config.ProjectAssociationBean projectAssociation)
    Indicates if the project association restricts based on a specific project
    static boolean
    isProjectTypeRestriction(com.codebarrel.automation.api.config.ProjectAssociationBean projectAssociation)
    Indicates if the project association restricts based on just the project type
    static boolean
    isProjectTypeRule(com.codebarrel.automation.api.config.RuleConfigBean rule)
    Checks to see if the rule is restricted to one or more project types
    static boolean
    isSingleOrMultiProjectRule(com.codebarrel.automation.api.config.RuleConfigBean rule)
    Convenience and efficiency method, this is the same as calling isSingleProjectRule || isMultiProjectRule
    static boolean
    isSingleProjectRule(com.codebarrel.automation.api.config.RuleConfigBean rule)
    Checks whether the rule is restricted to exactly one project instance
    static boolean
    isSingleProjectRuleForProject(com.codebarrel.automation.api.config.RuleConfigBean rule, String projectId)
    Checks whether the rule is restricted to just the specified project

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isSingleProjectRule

      public static boolean isSingleProjectRule(com.codebarrel.automation.api.config.RuleConfigBean rule)
      Checks whether the rule is restricted to exactly one project instance
      Parameters:
      rule - The rule to check scope for
      Returns:
      true if the rule is single project, or false otherwise
    • isSingleProjectRuleForProject

      public static boolean isSingleProjectRuleForProject(com.codebarrel.automation.api.config.RuleConfigBean rule, String projectId)
      Checks whether the rule is restricted to just the specified project
      Parameters:
      rule - The rule to check scope for
      Returns:
      true if the rule is restricted to just the specified project, or false otherwise
    • isMultiProjectRule

      public static boolean isMultiProjectRule(com.codebarrel.automation.api.config.RuleConfigBean rule)
      Checks whether the rule is restricted to more than one project instance
      Parameters:
      rule - The rule to check scope for
      Returns:
      true if the rule is multi project, or false otherwise
    • isProjectTypeRule

      public static boolean isProjectTypeRule(com.codebarrel.automation.api.config.RuleConfigBean rule)
      Checks to see if the rule is restricted to one or more project types
      Parameters:
      rule - The rule to check scope for
      Returns:
      true if the rule is project type restricted, or false otherwise
    • isGlobalRule

      public static boolean isGlobalRule(com.codebarrel.automation.api.config.RuleConfigBean rule)
      Checks to see if the rule applies to any project (it has no restrictions at all).
      Parameters:
      rule - The rule to check scope for
      Returns:
      true if the rule has zero restrictions, or false otherwise
    • isSingleOrMultiProjectRule

      public static boolean isSingleOrMultiProjectRule(com.codebarrel.automation.api.config.RuleConfigBean rule)
      Convenience and efficiency method, this is the same as calling isSingleProjectRule || isMultiProjectRule
      Parameters:
      rule - The rule to check scope for
      Returns:
      true if the rule has one or more project instance restrictions, or false otherwise
    • isProjectTypeRestriction

      public static boolean isProjectTypeRestriction(com.codebarrel.automation.api.config.ProjectAssociationBean projectAssociation)
      Indicates if the project association restricts based on just the project type
      Parameters:
      projectAssociation - Association to check
      Returns:
      true if the association is restricting by type, or false otherwise
    • getProjectIdsFromProjectRestrictions

      public static Set<String> getProjectIdsFromProjectRestrictions(@Nullable com.codebarrel.automation.api.config.RuleConfigBean rule)
      Filters restrictions to just project instance restrictions and then returns just the project id of each restriction
      Parameters:
      rule - The rule to check scope for
      Returns:
      a set of project ids, or an empty set if there was nothing to transform
    • getProjectTypesFromProjectRestrictions

      public static Set<String> getProjectTypesFromProjectRestrictions(@Nullable com.codebarrel.automation.api.config.RuleConfigBean rule)
      Filters restrictions to just project instance restrictions and then returns just the project type of each restriction
      Parameters:
      rule - The rule to check scope for
      Returns:
      a set of project types, or an empty set if there was nothing to transform
    • isProjectInRuleRestrictions

      public static boolean isProjectInRuleRestrictions(com.codebarrel.automation.api.config.RuleConfigBean rule, String projectId)
      Checks to see if a rule contains a restriction on a particular project
      Parameters:
      rule - The rule to check
      projectId - The project Id to look for
      Returns:
      true if the rule includes a restriction on this project, or false otherwise
    • isProjectRestriction

      protected static boolean isProjectRestriction(com.codebarrel.automation.api.config.ProjectAssociationBean projectAssociation)
      Indicates if the project association restricts based on a specific project
      Parameters:
      projectAssociation - Association to check
      Returns:
      true if the association is restricting by a specific project, or false otherwise