Class RuleDefinition.Builder
java.lang.Object
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:
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds an instance of a Rule based on the current state of the builder.static RuleDefinition.BuilderCreate a builder with the given parameters.static RuleDefinition.Buildercreate(RuleDefinitionContract contract) Creates a builder by populating it with data from the givenRuleDefinitionContract.This method returns a list of Actions associated with the Rule.This method returns a Map of attributes associated with the Rule.This is the description of the RulegetId()getName()This is the name of the RuleThis is the namespace of the RuleThis method returns the ID of the Proposition associated with the rule.This method returns the Proposition associated with the rule.This is the KrmsType of the RulebooleanisActive()voidsetActions(List<ActionDefinition.Builder> actions) Sets the value of the actions on this builder to the given valuevoidsetActive(boolean active) Sets the value of the active on this builder to the given valuevoidsetAttributes(Map<String, String> attributes) Sets the value of the attributes on this builder to the given valuevoidsetDescription(String description) Sets the value of the description on this builder to the given valuevoidSets the value of the id on this builder to the given value.voidSets the value of the name on this builder to the given valuevoidsetNamespace(String namespace) Sets the value of the namespace on this builder to the given valuevoidSets the value of the propId on this builder to the given valuevoidSets the value of the proposition on this builder to the given valuevoidSets the value of the typeId on this builder to the given valuevoidsetVersionNumber(Long versionNumber) Sets the value of the versionNumber on this builder to the given value
-
Method Details
-
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 blankname- the name value to set, must not be null or blanknamespace- the namespace value to set, must not be null or blanktypeId- the typeId value to setpropId- the propId value to set, must not be null or blank- Returns:
- Builder with the given values set
-
create
Creates a builder by populating it with data from the givenRuleDefinitionContract.- Parameters:
contract- the contract from which to populate this builder- Returns:
- an instance of the builder populated with data from the contract
-
setId
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
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
Sets the value of the description on this builder to the given value- Parameters:
description-
-
setNamespace
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
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
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
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
Sets the value of the actions on this builder to the given value- Parameters:
actions- the actions value to set, can be null
-
setAttributes
Sets the value of the attributes on this builder to the given value- Parameters:
attributes- the attributes values to set, can be null
-
setVersionNumber
Sets the value of the versionNumber on this builder to the given value- Parameters:
versionNumber- the versionNumber value to set
-
getId
- Specified by:
getIdin interfaceIdentifiable
-
getName
Description copied from interface:RuleDefinitionContractThis is the name of the Rulename - the name of the Rule
- Specified by:
getNamein interfaceRuleDefinitionContract- Returns:
- the name of the Rule
-
getDescription
Description copied from interface:RuleDefinitionContractThis is the description of the Ruledescription - the description of the Rule
- Specified by:
getDescriptionin interfaceRuleDefinitionContract- Returns:
- the description of the Rule
-
getNamespace
Description copied from interface:RuleDefinitionContractThis is the namespace of the RuleThe namespace of the Rule
- Specified by:
getNamespacein interfaceRuleDefinitionContract- Returns:
- the namespace of the Rule
-
getTypeId
Description copied from interface:RuleDefinitionContractThis is the KrmsType of the Rule- Specified by:
getTypeIdin interfaceRuleDefinitionContract- Returns:
- id for KRMS type related of the Rule
-
getPropId
Description copied from interface:RuleDefinitionContractThis method returns the ID of the Proposition associated with the rule.Each Rule has exactly one Proposition associated with it.
- Specified by:
getPropIdin interfaceRuleDefinitionContract- Returns:
- the id of the Proposition associated with the Rule
-
isActive
public boolean isActive()- Specified by:
isActivein interfaceInactivatable
-
getProposition
Description copied from interface:RuleDefinitionContractThis method returns the Proposition associated with the rule.Each Rule has exactly one Proposition associated with it.
- Specified by:
getPropositionin interfaceRuleDefinitionContract- Returns:
- an immutable representation of the Proposition associated with the Rule
-
getActions
Description copied from interface:RuleDefinitionContractThis method returns a list of Actions associated with the Rule.A Rule may have zero or more Actions associated with it.
- Specified by:
getActionsin interfaceRuleDefinitionContract- Returns:
- An ordered list of Actions associated with a Rule.
-
getAttributes
Description copied from interface:RuleDefinitionContractThis method returns a Map of attributes associated with the Rule. The attributes are represented as name/value pairs.- Specified by:
getAttributesin interfaceRuleDefinitionContract- Returns:
- a Mapinvalid input: '<'String,String> of RuleAttribute objects.
-
getVersionNumber
- Specified by:
getVersionNumberin interfaceVersioned
-
build
Builds an instance of a Rule based on the current state of the builder.- Specified by:
buildin interfaceModelBuilder- Returns:
- the fully-constructed Rule
-