Class ContextDefinition.Builder
java.lang.Object
org.kuali.rice.krms.api.repository.context.ContextDefinition.Builder
- All Implemented Interfaces:
Serializable,org.kuali.rice.core.api.mo.common.active.Inactivatable,org.kuali.rice.core.api.mo.common.Identifiable,org.kuali.rice.core.api.mo.common.Versioned,org.kuali.rice.core.api.mo.ModelBuilder,ContextDefinitionContract
- Enclosing class:
ContextDefinition
public static final class ContextDefinition.Builder
extends Object
implements ContextDefinitionContract, org.kuali.rice.core.api.mo.ModelBuilder, Serializable
A builder which can be used to construct ContextDefinition instances. Enforces the
constraints of the
ContextDefinitionContract. This class is the only means
by which a ContextDefinition object can be constructed.- Author:
- Kuali Rice Team (rice.collab@kuali.org)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbuild()static ContextDefinition.BuilderCreates a context definition builder with the given required valuesstatic ContextDefinition.Buildercreate(ContextDefinitionContract contract) Creates a populates a builder with the data on the given ContextDefinitionContract.Returns the list of agendasAgendaDefinitionContractcontained in the context definition.Returns a map of name/value pairs representing the attributes associated with this context.Returns the description of the context definition.getId()getName()Returns the name of the context definition.Returns the namespace of the context definition.Returns the type id for the context definition.booleanisActive()voidsetActive(boolean active) Sets the active flag for the context that will be returned by this builder.voidsetAgendas(List<? extends AgendaDefinitionContract> agendaContracts) Sets the agendas property of this context definition.voidsetAttributes(Map<String, String> attributes) Sets the Map of attributes as name / value pairs.voidsetDescription(String description) Sets the description for the context definition that will be created by this builder.voidSets the id for the context definition that will be created by this builder.voidSets the name for the context definition that will be created by this builder.voidsetNamespace(String namespace) Sets the namespace code for the context definition that will be created by this builder.voidSets the typeId for the context definition that will be created by this builder.voidsetVersionNumber(Long versionNumber) Sets the version number for the style that will be returned by this builder.
-
Method Details
-
create
Creates a context definition builder with the given required values- Parameters:
namespace- the namespace code of the context definition to create, must not be null or blankname- the name of the context definition to create, must not be null or blank- Returns:
- a builder with the required values already initialized
- Throws:
IllegalArgumentException- if the given namespace is null or blankIllegalArgumentException- if the given name is null or blank
-
create
Creates a populates a builder with the data on the given ContextDefinitionContract. This is similar in nature to a "copy constructor" for Style.- Parameters:
contract- an object implementing the ContextDefinitionContract from which to copy property values- Returns:
- a builder with the values from the contract already initialized
- Throws:
IllegalArgumentException- if the given contract is null
-
build
- Specified by:
buildin interfaceorg.kuali.rice.core.api.mo.ModelBuilder
-
getVersionNumber
- Specified by:
getVersionNumberin interfaceorg.kuali.rice.core.api.mo.common.Versioned
-
getId
- Specified by:
getIdin interfaceorg.kuali.rice.core.api.mo.common.Identifiable
-
getNamespace
Description copied from interface:ContextDefinitionContractReturns the namespace of the context definition. The combination of namespace and name represent a unique business key for the context definition. The namespace should never be null or blank.- Specified by:
getNamespacein interfaceContextDefinitionContract- Returns:
- the namespace of the context definition, should never be null or blank
-
getName
Description copied from interface:ContextDefinitionContractReturns the name of the context definition. The combination of name and namespaceCode represent a unique business key for the context definition. The name should never be null or blank.- Specified by:
getNamein interfaceContextDefinitionContract- Returns:
- the name of the context definition, should never be null or blank
-
getTypeId
Description copied from interface:ContextDefinitionContractReturns the type id for the context definition. If the type id is null, that means this context definition is of the default type.- Specified by:
getTypeIdin interfaceContextDefinitionContract- Returns:
- the type id for the context definition, or null if this context definition is of the default type
-
getDescription
Description copied from interface:ContextDefinitionContractReturns the description of the context definition.- Specified by:
getDescriptionin interfaceContextDefinitionContract- Returns:
- the description of the context definition. May be null.
-
isActive
public boolean isActive()- Specified by:
isActivein interfaceorg.kuali.rice.core.api.mo.common.active.Inactivatable
-
getAgendas
Description copied from interface:ContextDefinitionContractReturns the list of agendasAgendaDefinitionContractcontained in the context definition. This method should never return null. An empty list is returned if no agendas are associated with this context.- Specified by:
getAgendasin interfaceContextDefinitionContract- Returns:
- the list of agendas contained in this context definition
-
getAttributes
Description copied from interface:ContextDefinitionContractReturns a map of name/value pairs representing the attributes associated with this context.This method should never return null. An empty map is returned if no attributes are associated with the context.
- Specified by:
getAttributesin interfaceContextDefinitionContract- Returns:
- a list of Map of name/value String pairs.
-
setId
Sets the id for the context definition that will be created by this builder.- Parameters:
id- the id to set
-
setNamespace
Sets the namespace code for the context definition that will be created by this builder. The namespace code must not be blank or null.- Parameters:
namespace- the namespace to set on this builder, must not be null or blank- Throws:
IllegalArgumentException- if the given namespace code is null or blank
-
setName
Sets the name for the context definition that will be created by this builder. The name must not be blank or null.- Parameters:
name- the name to set on this builder, must not be null or blank- Throws:
IllegalArgumentException- if the given name is null or blank
-
setTypeId
Sets the typeId for the context definition that will be created by this builder.- Parameters:
typeId- the typeId to set
-
setDescription
Sets the description for the context definition that will be created by this builder.- Parameters:
description- the descripition to set
-
setActive
public void setActive(boolean active) Sets the active flag for the context that will be returned by this builder.- Parameters:
active- the active flag to set
-
setAgendas
Sets the agendas property of this context definition.For each of the
AgendaDefinitionContractprovided in the parameter list, construct an AgendaDefinition from the builder of the provided contract, and save the agenda definitions in a List ofAgendaDefinition- Parameters:
agendaContracts- a list of agenda definition contracts
-
setAttributes
Sets the Map of attributes as name / value pairs.- Parameters:
attributes- a Map of name value String pairs representing the attributes associated with this context
-
setVersionNumber
Sets the version number for the style that will be returned by this builder.In general, this value should not be manually set on the builder, but rather copied from an existing
ContextDefinitionContractwhen invokingcreate(ContextDefinitionContract).- Parameters:
versionNumber- the version number to set
-