Class RuleDefinition.Builder

java.lang.Object
org.kuali.rice.krms.api.repository.rule.RuleDefinition.Builder
All Implemented Interfaces:
Serializable, Inactivatable, Identifiable, Versioned, ModelBuilder, RuleDefinitionContract
Enclosing class:
RuleDefinition

public static class RuleDefinition.Builder extends Object implements RuleDefinitionContract, ModelBuilder, Serializable
This builder is used to construct instances of KRMS Repository Rule. It enforces the constraints of the RuleDefinitionContract.
See Also:
  • Method Details

    • create

      public static RuleDefinition.Builder create(String ruleId, String name, String namespace, String typeId, String propId)
      Create a builder with the given parameters.
      Parameters:
      ruleId - the id value to set, must not be null or blank
      name - the name value to set, must not be null or blank
      namespace - the namespace value to set, must not be null or blank
      typeId - the typeId value to set
      propId - the propId value to set, must not be null or blank
      Returns:
      Builder with the given values set
    • create

      public static RuleDefinition.Builder create(RuleDefinitionContract contract)
      Creates a builder by populating it with data from the given RuleDefinitionContract.
      Parameters:
      contract - the contract from which to populate this builder
      Returns:
      an instance of the builder populated with data from the contract
    • setId

      public void setId(String ruleId)
      Sets the value of the id on this builder to the given value.
      Parameters:
      ruleId - the id value to set, must not be null or blank
      Throws:
      IllegalArgumentException - if the id is null or blank
    • setName

      public void setName(String name)
      Sets the value of the name on this builder to the given value
      Parameters:
      name - the name value to set, must not be null or blank
      Throws:
      IllegalArgumentException - if the name is null or blank
    • setDescription

      public void setDescription(String description)
      Sets the value of the description on this builder to the given value
      Parameters:
      description -
    • setNamespace

      public void setNamespace(String namespace)
      Sets the value of the namespace on this builder to the given value
      Parameters:
      namespace - the namespace value to set, must not be null or blank
      Throws:
      IllegalArgumentException - if the namespace is null or blank
    • setTypeId

      public void setTypeId(String typeId)
      Sets the value of the typeId on this builder to the given value
      Parameters:
      typeId - the typeId value to set
    • setActive

      public void setActive(boolean active)
      Sets the value of the active on this builder to the given value
      Parameters:
      active - the active value to set
    • setPropId

      public void setPropId(String propId)
      Sets the value of the propId on this builder to the given value
      Parameters:
      propId - the propId value to set, must not be null or blank
      Throws:
      IllegalArgumentException - if the propId is null or blank
    • setProposition

      public void setProposition(PropositionDefinition.Builder prop)
      Sets the value of the proposition on this builder to the given value
      Parameters:
      prop - the proposition value to set, must not be null
    • setActions

      public void setActions(List<ActionDefinition.Builder> actions)
      Sets the value of the actions on this builder to the given value
      Parameters:
      actions - the actions value to set, can be null
    • setAttributes

      public void setAttributes(Map<String,String> attributes)
      Sets the value of the attributes on this builder to the given value
      Parameters:
      attributes - the attributes values to set, can be null
    • setVersionNumber

      public void setVersionNumber(Long versionNumber)
      Sets the value of the versionNumber on this builder to the given value
      Parameters:
      versionNumber - the versionNumber value to set
    • getId

      public String getId()
      Specified by:
      getId in interface Identifiable
    • getName

      public String getName()
      Description copied from interface: RuleDefinitionContract
      This is the name of the Rule

      name - the name of the Rule

      Specified by:
      getName in interface RuleDefinitionContract
      Returns:
      the name of the Rule
    • getDescription

      public String getDescription()
      Description copied from interface: RuleDefinitionContract
      This is the description of the Rule

      description - the description of the Rule

      Specified by:
      getDescription in interface RuleDefinitionContract
      Returns:
      the description of the Rule
    • getNamespace

      public String getNamespace()
      Description copied from interface: RuleDefinitionContract
      This is the namespace of the Rule

      The namespace of the Rule

      Specified by:
      getNamespace in interface RuleDefinitionContract
      Returns:
      the namespace of the Rule
    • getTypeId

      public String getTypeId()
      Description copied from interface: RuleDefinitionContract
      This is the KrmsType of the Rule
      Specified by:
      getTypeId in interface RuleDefinitionContract
      Returns:
      id for KRMS type related of the Rule
    • getPropId

      public String getPropId()
      Description copied from interface: RuleDefinitionContract
      This method returns the ID of the Proposition associated with the rule.

      Each Rule has exactly one Proposition associated with it.

      Specified by:
      getPropId in interface RuleDefinitionContract
      Returns:
      the id of the Proposition associated with the Rule
    • isActive

      public boolean isActive()
      Specified by:
      isActive in interface Inactivatable
    • getProposition

      public PropositionDefinition.Builder getProposition()
      Description copied from interface: RuleDefinitionContract
      This method returns the Proposition associated with the rule.

      Each Rule has exactly one Proposition associated with it.

      Specified by:
      getProposition in interface RuleDefinitionContract
      Returns:
      an immutable representation of the Proposition associated with the Rule
    • getActions

      public List<ActionDefinition.Builder> getActions()
      Description copied from interface: RuleDefinitionContract
      This method returns a list of Actions associated with the Rule.

      A Rule may have zero or more Actions associated with it.

      Specified by:
      getActions in interface RuleDefinitionContract
      Returns:
      An ordered list of Actions associated with a Rule.
    • getAttributes

      public Map<String,String> getAttributes()
      Description copied from interface: RuleDefinitionContract
      This method returns a Map of attributes associated with the Rule. The attributes are represented as name/value pairs.
      Specified by:
      getAttributes in interface RuleDefinitionContract
      Returns:
      a Map<String,String> of RuleAttribute objects.
    • getVersionNumber

      public Long getVersionNumber()
      Specified by:
      getVersionNumber in interface Versioned
    • build

      public RuleDefinition build()
      Builds an instance of a Rule based on the current state of the builder.
      Specified by:
      build in interface ModelBuilder
      Returns:
      the fully-constructed Rule