Class PropositionDefinition.Builder

java.lang.Object
org.kuali.rice.krms.api.repository.proposition.PropositionDefinition.Builder
All Implemented Interfaces:
Serializable, Identifiable, Versioned, ModelBuilder, PropositionDefinitionContract
Enclosing class:
PropositionDefinition

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

    • compoundOpCode

      public PropositionDefinition.Builder compoundOpCode(String opCode)
      Set the value of the opCode to the given value.
      Parameters:
      opCode - the opCode value to set
      Returns:
      Builder an instance of the builder populated with given parameters
    • compoundComponents

      public PropositionDefinition.Builder compoundComponents(List<PropositionDefinition.Builder> components)
      Set the value of the components to the given value.
      Parameters:
      components - the components value to set
      Returns:
      Builder
    • create

      public static PropositionDefinition.Builder create(String propId, String propTypeCode, String ruleId, String typeId, List<PropositionParameter.Builder> parameters)
      Create a Builder with the given values
      Parameters:
      propId - the propId value to set
      propTypeCode - the propTypeCode value to set
      ruleId - the ruleId value to set
      typeId - the typeId value to set
      parameters - the parameters value to set
      Returns:
      Builder an instance of the builder populated with given parameters
    • create

      Creates a builder by populating it with data from the given PropositionDefinitionContract.
      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 propId)
      Sets the value of the propId on this builder to the given value.
      Parameters:
      propId - the propId value to set
      Throws:
      IllegalArgumentException - if the propId 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 - the description value to set
    • 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
    • setRuleId

      public void setRuleId(String ruleId)
      Sets the value of the ruleId on this builder to the given value.
      Parameters:
      ruleId - the ruleId value to set
    • setRule

      public void setRule(RuleDefinition.Builder rule)
      Sets the value of the rule on this builder to the given value.
      Parameters:
      rule - the rule value to set
    • setPropositionTypeCode

      public void setPropositionTypeCode(String propTypeCode)
      Sets the value of the propTypeCode on this builder to the given value.
      Parameters:
      propTypeCode - the propTypeCode value to set
      Throws:
      IllegalArgumentException - if the propTypeCode is null, blank or invalid
    • setParameters

      public void setParameters(List<PropositionParameter.Builder> parameters)
      Sets the value of the parameters on this builder to the given value.
      Parameters:
      parameters - the parameters value to set
    • setCompoundOpCode

      public void setCompoundOpCode(String opCode)
      Sets the value of the opCode on this builder to the given value.
      Parameters:
      opCode - the opCode value to set
      Throws:
      IllegalArgumentException - if the opCode invalid
    • setCompoundSequenceNumber

      public void setCompoundSequenceNumber(Integer seqNo)
      Sets the value of the compound sequence no on this builder to the given value.
      Parameters:
      seqNo - the sequence number for this compound prop
      Throws:
      IllegalArgumentException - if the seqNo invalid
    • setCompoundComponents

      public void setCompoundComponents(List<PropositionDefinition.Builder> components)
      Sets the value of the components on this builder to the given value.
      Parameters:
      components - the components value to set
    • 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
    • getDescription

      public String getDescription()
      Description copied from interface: PropositionDefinitionContract
      Returns the description text for the KRMS proposition
      Specified by:
      getDescription in interface PropositionDefinitionContract
      Returns:
      description for KRMS type.
    • getRuleId

      public String getRuleId()
      Description copied from interface: PropositionDefinitionContract
      TReturns the ID of the rule this proposition belongs to. May be null if this proposition has not yet been persisted.
      Specified by:
      getRuleId in interface PropositionDefinitionContract
      Returns:
      the ID of the Rule this proposition belongs to.
    • getTypeId

      public String getTypeId()
      Description copied from interface: PropositionDefinitionContract
      Returns the id of Proposition KrmsType of the proposition. It provides some context to what type of object of the KRMS type.
      Specified by:
      getTypeId in interface PropositionDefinitionContract
      Returns:
      the id of the KRMS type.
    • getPropositionTypeCode

      public String getPropositionTypeCode()
      Description copied from interface: PropositionDefinitionContract

      There are three main types of Propositions: Compound Propositions - a proposition consisting of other propositions and a boolean algebra operator (AND, OR) defining how to evaluate those propositions. Parameterized Propositions - a proposition which is parameterized by some set of values, evaluation logic is implemented by hand and returns true or false Simple Propositions - a proposition of the form lhs op rhs where lhs=left-hand side, rhs=right-hand side, and op=operator

      Specified by:
      getPropositionTypeCode in interface PropositionDefinitionContract
      Returns:
      the proposition type code of the proposition

      Valid values are C = compound, P = parameterized, S = simple

    • getParameters

      public List<PropositionParameter.Builder> getParameters()
      Description copied from interface: PropositionDefinitionContract
      Returns the parameter list of the proposition. Parameters are listed in Reverse Polish Notation. Parameters may be constants, terms, or functions.

      Compound Propositions will have an empty parameter list.

      Specified by:
      getParameters in interface PropositionDefinitionContract
      Returns:
      the Parameters related to the proposition
      See Also:
    • getCompoundOpCode

      public String getCompoundOpCode()
      Description copied from interface: PropositionDefinitionContract
      Returns the op code to be used when evaluating compound propositions.
      Specified by:
      getCompoundOpCode in interface PropositionDefinitionContract
      Returns:
      the compound op code. valid values are A = and, O = or
    • getCompoundSequenceNumber

      public Integer getCompoundSequenceNumber()
      Description copied from interface: PropositionDefinitionContract
      Returns the sequence number used to order the compound propositions Note: this value is set by the service
      Specified by:
      getCompoundSequenceNumber in interface PropositionDefinitionContract
      Returns:
      the compound sequence number
    • getCompoundComponents

      public List<PropositionDefinition.Builder> getCompoundComponents()
      Description copied from interface: PropositionDefinitionContract
      Returns the propositions which are contained in a compound proposition.
      Specified by:
      getCompoundComponents in interface PropositionDefinitionContract
      Returns:
      an ordered list of the Propositions which make up the compound proposition.
    • getVersionNumber

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

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