org.kuali.rice.krms.api.repository.proposition
Class PropositionDefinition.Builder

java.lang.Object
  extended by 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:
Serialized Form

Method Summary
 PropositionDefinition build()
          Builds an instance of a Proposition based on the current state of the builder.
 PropositionDefinition.Builder compoundComponents(List<PropositionDefinition.Builder> components)
          Set the value of the components to the given value.
 PropositionDefinition.Builder compoundOpCode(String opCode)
          Set the value of the opCode to the given value.
static PropositionDefinition.Builder create(PropositionDefinitionContract contract)
          Creates a builder by populating it with data from the given PropositionDefinitionContract.
static PropositionDefinition.Builder create(String propId, String propTypeCode, String ruleId, String typeId, List<PropositionParameter.Builder> parameters)
          Create a Builder with the given values
 List<PropositionDefinition.Builder> getCompoundComponents()
          Returns the propositions which are contained in a compound proposition.
 String getCompoundOpCode()
          Returns the op code to be used when evaluating compound propositions.
 String getDescription()
          Returns the description text for the KRMS proposition
 String getId()
          The unique identifier for an object.
 List<PropositionParameter.Builder> getParameters()
          Returns the parameter list of the proposition.
 String getPropositionTypeCode()
           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.
 String getRuleId()
          TReturns the ID of the rule this proposition belongs to.
 String getTypeId()
          Returns the id of Proposition KrmsType of the proposition.
 Long getVersionNumber()
          Returns the version number for this object.
 void setCompoundComponents(List<PropositionDefinition.Builder> components)
          Sets the value of the components on this builder to the given value.
 void setCompoundOpCode(String opCode)
          Sets the value of the opCode on this builder to the given value.
 void setDescription(String description)
          Sets the value of the description on this builder to the given value.
 void setId(String propId)
          Sets the value of the propId on this builder to the given value.
 void setParameters(List<PropositionParameter.Builder> parameters)
          Sets the value of the parameters on this builder to the given value.
 void setPropositionTypeCode(String propTypeCode)
          Sets the value of the propTypeCode on this builder to the given value.
 void setRule(RuleDefinition.Builder rule)
          Sets the value of the rule on this builder to the given value.
 void setRuleId(String ruleId)
          Sets the value of the ruleId on this builder to the given value.
 void setTypeId(String typeId)
          Sets the value of the typeId on this builder to the given value.
 void setVersionNumber(Long versionNumber)
          Sets the value of the versionNumber on this builder to the given value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

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

public static PropositionDefinition.Builder create(PropositionDefinitionContract contract)
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

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()
Description copied from interface: Identifiable
The unique identifier for an object. This can be null.

Specified by:
getId in interface Identifiable
Returns:
the id

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:
PropositionParameter

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

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()
Description copied from interface: Versioned
Returns the version number for this object. In general, this value should only be null if the object has not yet been stored to a persistent data store. This version number is generally used for the purposes of optimistic locking.

Specified by:
getVersionNumber in interface Versioned
Returns:
the version number, or null if one has not been assigned yet

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


Copyright © 2005-2013 The Kuali Foundation. All Rights Reserved.