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 Details

    • create

      public static ContextDefinition.Builder create(String namespace, String name)
      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 blank
      name - 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 blank
      IllegalArgumentException - if the given name is null or blank
    • create

      public static ContextDefinition.Builder create(ContextDefinitionContract contract)
      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

      public ContextDefinition build()
      Specified by:
      build in interface org.kuali.rice.core.api.mo.ModelBuilder
    • getVersionNumber

      public Long getVersionNumber()
      Specified by:
      getVersionNumber in interface org.kuali.rice.core.api.mo.common.Versioned
    • getId

      public String getId()
      Specified by:
      getId in interface org.kuali.rice.core.api.mo.common.Identifiable
    • getNamespace

      public String getNamespace()
      Description copied from interface: ContextDefinitionContract
      Returns 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:
      getNamespace in interface ContextDefinitionContract
      Returns:
      the namespace of the context definition, should never be null or blank
    • getName

      public String getName()
      Description copied from interface: ContextDefinitionContract
      Returns 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:
      getName in interface ContextDefinitionContract
      Returns:
      the name of the context definition, should never be null or blank
    • getTypeId

      public String getTypeId()
      Description copied from interface: ContextDefinitionContract
      Returns 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:
      getTypeId in interface ContextDefinitionContract
      Returns:
      the type id for the context definition, or null if this context definition is of the default type
    • getDescription

      public String getDescription()
      Description copied from interface: ContextDefinitionContract
      Returns the description of the context definition.
      Specified by:
      getDescription in interface ContextDefinitionContract
      Returns:
      the description of the context definition. May be null.
    • isActive

      public boolean isActive()
      Specified by:
      isActive in interface org.kuali.rice.core.api.mo.common.active.Inactivatable
    • getAgendas

      public List<AgendaDefinition.Builder> getAgendas()
      Description copied from interface: ContextDefinitionContract
      Returns the list of agendas AgendaDefinitionContract contained 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:
      getAgendas in interface ContextDefinitionContract
      Returns:
      the list of agendas contained in this context definition
    • getAttributes

      public Map<String,String> getAttributes()
      Description copied from interface: ContextDefinitionContract
      Returns 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:
      getAttributes in interface ContextDefinitionContract
      Returns:
      a list of Map of name/value String pairs.
    • setId

      public void setId(String id)
      Sets the id for the context definition that will be created by this builder.
      Parameters:
      id - the id to set
    • setNamespace

      public void setNamespace(String namespace)
      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

      public void setName(String name)
      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

      public void setTypeId(String typeId)
      Sets the typeId for the context definition that will be created by this builder.
      Parameters:
      typeId - the typeId to set
    • setDescription

      public void setDescription(String description)
      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

      public void setAgendas(List<? extends AgendaDefinitionContract> agendaContracts)
      Sets the agendas property of this context definition.

      For each of the AgendaDefinitionContract provided in the parameter list, construct an AgendaDefinition from the builder of the provided contract, and save the agenda definitions in a List of AgendaDefinition

      Parameters:
      agendaContracts - a list of agenda definition contracts
    • setAttributes

      public void setAttributes(Map<String,String> attributes)
      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

      public void setVersionNumber(Long versionNumber)
      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 ContextDefinitionContract when invoking create(ContextDefinitionContract).

      Parameters:
      versionNumber - the version number to set