Class RulesAPI


@Component public class RulesAPI extends BaseAPI
Covers CRUD API operations on rules
  • Field Details

  • Constructor Details

    • RulesAPI

      public RulesAPI()
  • Method Details

    • createRule

      public org.apache.http.HttpResponse createRule(String username, String password, String containerNodeRef, RuleDefinition ruleProperties)
      Creates a rule for the specified container with given rule properties
      Parameters:
      containerNodeRef - the container to have the rule created on
      ruleProperties - the rule properties
      Returns:
      The HTTP Response (or null if the response could not be understood).
    • updateRule

      public org.json.JSONObject updateRule(String username, String password, String containerNodeRef, RuleDefinition ruleProperties)
      Updates a rule for the specified container with given rule properties
      Parameters:
      containerNodeRef - the container to have the rule created on
      ruleProperties - the rule properties
      Returns:
      true if the rule has been updated successfully, false otherwise
    • deleteRule

      public void deleteRule(String username, String password, String containerNodeRef, String ruleId)
      Deletes a rule on a container and checks it doesn't exist anymore
      Parameters:
      username - the user performing the request
      password - the password
      containerNodeRef - the container on which the rule has been created
      ruleId - the rule id
      Throws:
      AssertionError - if the rule could not be deleted.
    • deleteAllRulesOnContainer

      public void deleteAllRulesOnContainer(String username, String password, String containerNodeRef)
      Deletes all the rules on a container and checks they don't exist anymore
      Parameters:
      username - the user performing the request
      password - the password
      containerNodeRef - the container on which the rules have been created
      Throws:
      AssertionError - if at least one of the rules could not be deleted.
    • getRulesSetOnContainer

      public List<RuleDefinition> getRulesSetOnContainer(String username, String password, String containerNodeRef)
      Gets all the rules for the specified container with given rule properties
      Parameters:
      username - the user performing the request
      password - the password
      containerNodeRef - the container to get the rules from
      Returns:
      list of rules on container
    • getRulesIdsSetOnContainer

      public List<String> getRulesIdsSetOnContainer(String username, String password, String containerNodeRef)
      Retrieves all the ids of the rules set on the container
      Parameters:
      username - the user performing the request
      password - the password
      containerNodeRef - the container's noderef to get set rules for
      Returns:
      the list of rules ids that the container has
    • getRuleIdWithTitle

      public String getRuleIdWithTitle(String username, String password, String containerNodeRef, String title)
      Returns the rule id for the give rule title set on a container
      Parameters:
      username - the user performing the request
      password - the password
      containerNodeRef - container nodeRef
      Returns:
      the rule id
    • disableRulesInheritance

      public org.apache.http.HttpResponse disableRulesInheritance(String username, String password, String containerNodeRef)
      Disable inheritance on specific container
      Parameters:
      username - the username
      password - the password
      containerNodeRef - the container nodeRef
      Returns:
      The HTTP Response (or null if the current state is disabled).
    • enableRulesInheritance

      public org.apache.http.HttpResponse enableRulesInheritance(String username, String password, String containerNodeRef)
      Enable inheritance on specific container
      Parameters:
      username - the username
      password - the password
      containerNodeRef - the container nodeRef
      Returns:
      The HTTP Response (or null if the current state is disabled).
    • containerInheritsRulesFromParent

      public boolean containerInheritsRulesFromParent(String username, String password, String containerNodeRef) throws org.json.JSONException
      Returns the rules inheritance state of the container
      Parameters:
      username - the username
      password - the password
      containerNodeRef - the container nodeRef
      Returns:
      a boolean specifying if the container inherits rules from parent
      Throws:
      org.json.JSONException