org.kuali.rice.krms.api.repository.rule
Class RuleDefinition.Builder

java.lang.Object
  extended by org.kuali.rice.krms.api.repository.rule.RuleDefinition.Builder
All Implemented Interfaces:
Serializable, 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:
Serialized Form

Method Summary
 RuleDefinition build()
          Builds an instance of a Rule based on the current state of the builder.
static RuleDefinition.Builder create(RuleDefinitionContract contract)
          Creates a builder by populating it with data from the given RuleDefinitionContract.
static RuleDefinition.Builder create(String ruleId, String name, String namespace, String typeId, String propId)
           
 List<ActionDefinition.Builder> getActions()
          This method returns a list of Actions associated with the Rule.
 Map<String,String> getAttributes()
          This method returns a Map of attributes associated with the Rule.
 String getDescription()
          This is the description of the Rule
 String getId()
          The unique identifier for an object.
 String getName()
          This is the name of the Rule
 String getNamespace()
          This is the namespace of the Rule
 String getPropId()
          This method returns the ID of the Proposition associated with the rule.
 PropositionDefinition.Builder getProposition()
          This method returns the Proposition associated with the rule.
 String getTypeId()
          This is the KrmsType of the Rule
 Long getVersionNumber()
          Returns the version number for this object.
 void setActions(List<ActionDefinition.Builder> actions)
           
 void setAttributes(Map<String,String> attributes)
           
 void setDescription(String description)
           
 void setId(String ruleId)
          Sets the value of the id on this builder to the given value.
 void setName(String name)
           
 void setNamespace(String namespace)
           
 void setPropId(String propId)
           
 void setProposition(PropositionDefinition.Builder prop)
           
 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

create

public static RuleDefinition.Builder create(String ruleId,
                                            String name,
                                            String namespace,
                                            String typeId,
                                            String propId)

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:
id - 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)

setDescription

public void setDescription(String description)

setNamespace

public void setNamespace(String namespace)

setTypeId

public void setTypeId(String typeId)

setPropId

public void setPropId(String propId)

setProposition

public void setProposition(PropositionDefinition.Builder prop)

setActions

public void setActions(List<ActionDefinition.Builder> actions)

setAttributes

public void setAttributes(Map<String,String> attributes)

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

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

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 represtentation 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 of RuleAttribute objects.

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


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.