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, 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:
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)
          Create a builder with the given parameters.
 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.
 boolean isActive()
          The active indicator for an object.
 void setActions(List<ActionDefinition.Builder> actions)
          Sets the value of the actions on this builder to the given value
 void setActive(boolean active)
          Sets the value of the active on this builder to the given value
 void setAttributes(Map<String,String> attributes)
          Sets the value of the attributes 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 ruleId)
          Sets the value of the id on this builder to the given value.
 void setName(String name)
          Sets the value of the name on this builder to the given value
 void setNamespace(String namespace)
          Sets the value of the namespace on this builder to the given value
 void setPropId(String propId)
          Sets the value of the propId on this builder to the given value
 void setProposition(PropositionDefinition.Builder prop)
          Sets the value of the proposition 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

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

isActive

public boolean isActive()
Description copied from interface: Inactivatable
The active indicator for an object.

Specified by:
isActive in interface Inactivatable
Returns:
true if active false if not.

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 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 © 2005-2013 The Kuali Foundation. All Rights Reserved.