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)
           
 PropositionDefinition.Builder compoundOpCode(String opCode)
           
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)
           
 List<PropositionDefinition.Builder> getCompoundComponents()
          This method returns the propositions which are contained in a compound proposition.
 String getCompoundOpCode()
          This method returns the op code to be used when evaluating compound propositions.
 String getDescription()
          This is the description text for the KRMS proposition
 String getId()
          The unique identifier for an object.
 List<PropositionParameter.Builder> getParameters()
          This is 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()
          This returns the ID of the rule this proposition belongs to.
 String getTypeId()
          This is the id of Proposition KrmsType of the proposition.
 Long getVersionNumber()
          Returns the version number for this object.
 void setCompoundComponents(List<PropositionDefinition.Builder> components)
           
 void setCompoundOpCode(String opCode)
           
 void setDescription(String desc)
           
 void setId(String propId)
          Sets the value of the id on this builder to the given value.
 void setParameters(List<PropositionParameter.Builder> parameters)
           
 void setPropositionTypeCode(String propTypeCode)
           
 void setRule(RuleDefinition.Builder rule)
           
 void setRuleId(String ruleId)
           
 void setTypeId(String typeId)
           
 void setVersionNumber(Long versionNumber)
           
 
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)

compoundComponents

public PropositionDefinition.Builder compoundComponents(List<PropositionDefinition.Builder> components)

create

public static PropositionDefinition.Builder create(String propId,
                                                   String propTypeCode,
                                                   String ruleId,
                                                   String typeId,
                                                   List<PropositionParameter.Builder> 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 id on this builder to the given value.

Parameters:
id - the id value to set

setDescription

public void setDescription(String desc)

setTypeId

public void setTypeId(String typeId)

setRuleId

public void setRuleId(String ruleId)

setRule

public void setRule(RuleDefinition.Builder rule)

setPropositionTypeCode

public void setPropositionTypeCode(String propTypeCode)

setParameters

public void setParameters(List<PropositionParameter.Builder> parameters)

setCompoundOpCode

public void setCompoundOpCode(String opCode)

setCompoundComponents

public void setCompoundComponents(List<PropositionDefinition.Builder> components)

setVersionNumber

public void setVersionNumber(Long versionNumber)

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
This is 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
This returns 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
This is 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
This is 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
This method 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
This method 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 © 2004-2011 The Kuali Foundation. All Rights Reserved.