Interface TemplateStatus

All Superinterfaces:
Serializable

public interface TemplateStatus extends Serializable
The TemplateStatus provides access to the state of a template. It is a wrapper for methods which are provided by the process repository as well as the process manager. Most state can be annotated with an arbitrary string which may provide more information on the cause for the state.
Author:
Ulrich Kreher
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    Generated ID for serialisation.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    areInstancesChangeable(boolean subprocessScope)
    Returns whether instances running on this template may be changed or not.
    boolean
    areInstancesMigratableTo(boolean subprocessScope)
    Returns whether instances running on a parent process template may be migrated to this process template or not.
    Gets the state of this process template while it may be modified and is not released.
    Returns the comment set for the derivable status for either subprocess or top-level-usage.
    getInstancesChangeableComment(boolean subprocessScope)
    Returns the comment set for the "instances changeable"-status for either subprocess or top-level-usage.
    getInstancesMigratableToComment(boolean subprocessScope)
    Returns the comment set for the "instances migratable to"-status for either subprocess or top-level-usage.
    getInstantiableComment(boolean subprocessScope)
    Returns the comment set for the instantiable status for either subprocess or top-level-usage.
    getOutdatedComment(boolean subprocessScope)
    Returns the comment set for the outdated status for either subprocess or top-level-usage.
    Gets the staff rule which specifies which agent may create and start an instance of this template.
    Returns the ID of the template this status object belongs to.
    Gets how the template may be used, that is whether the template may be used as a top-level process only, a copied subprocess, a referenced subprocess or both.
    boolean
    Returns whether this process template may be derived and therefore modified.
    boolean
    isInstantiable(boolean subprocessScope)
    Returns whether this process template may be instantiated or not.
    boolean
    isOutdated(boolean subprocessScope)
    Returns whether this process template is outdated and should not be used any more.
    boolean
    Returns whether this template may be used as top-level process
    void
    Enables the instantiation and usage of the process template by setting the buildtime state to RELEASED.
    void
    setDerivable(boolean derivable, String comment)
    Sets the designated template to derivable or not.
    void
    setInstancesChangeable(boolean instancesChangeable, boolean subprocessScope, String comment)
    Sets the designated template to instances changeable to or not.
    void
    setInstancesMigratableTo(boolean instancesMigratableTo, boolean subprocessScope, String comment)
    Sets the designated template to instances migratable to or not.
    void
    setInstantiable(boolean instantiable, boolean subprocessScope, String comment)
    Sets the designated template to instantiable or not.
    void
    setOutdated(boolean outdated, boolean subprocessScope, String comment)
    Sets the designated template to outdated or active.
    void
    setStarterRule(String starterRule)
    Sets the staff assignment rule which specifies which agent may create and start an instance of this template.
    void
    Sets how the designated template may be used as subprocess.
    void
    setTopLevelUsage(boolean useAsTopLevel)
    Sets whether the designated template may be used and instantiated as top-level process.
  • Field Details

    • serialVersionUID

      static final long serialVersionUID
      Generated ID for serialisation.
      See Also:
  • Method Details

    • getTemplateID

      UUID getTemplateID()
      Returns the ID of the template this status object belongs to.
      Returns:
      The ID of the template which this status object represents.
    • getStarterRule

      String getStarterRule()
      Gets the staff rule which specifies which agent may create and start an instance of this template. This rule is also used as default staff assignment rule when used as a subprocess.
      Returns:
      Returns the staff rule which specifies which agent may create and start an instance of this template.
      See Also:
    • isTopLevelUsable

      boolean isTopLevelUsable()
      Returns whether this template may be used as top-level process
      Returns:
      true if this process template may be instantiated as top-level process.
    • getUsageAsSubprocess

      ProcessConstants.TemplateUsage getUsageAsSubprocess()
      Gets how the template may be used, that is whether the template may be used as a top-level process only, a copied subprocess, a referenced subprocess or both.
      Returns:
      The subprocess usage of the template (none, copy, reference or both).
    • isOutdated

      boolean isOutdated(boolean subprocessScope)
      Returns whether this process template is outdated and should not be used any more. This results in a warning message when using the template, for example when the template is instantiated, derived and migrated to. Initially a released process template is not outdated, that is "active".

      Please note that the returned state will have to be ignored if the request is for subprocess scope and the template usage is NO_SUBPROCESS.

      Parameters:
      subprocessScope - Whether the scope of the asked for template state is for subprocess usage (template is referenced) or for usage as top-level process.
      Returns:
      true if this process template is outdated and should not be used any more. Ignore the returned value if the request is for subprocess scope and the template usage is TemplateUsage.NO_SUBPROCESS.
      See Also:
    • getOutdatedComment

      String getOutdatedComment(boolean subprocessScope)
      Returns the comment set for the outdated status for either subprocess or top-level-usage.

      Please note that the returned comment will have to be ignored if the request is for subprocess scope and the template usage is NO_SUBPROCESS.

      Parameters:
      subprocessScope - Whether the scope of the asked for template state is for subprocess usage (template is referenced) or for usage as top-level process.
      Returns:
      The comment set for the current outdated status or null if not set. Ignore the returned value if the request is for subprocess scope and the template usage is TemplateUsage.NO_SUBPROCESS.
    • isInstantiable

      boolean isInstantiable(boolean subprocessScope)
      Returns whether this process template may be instantiated or not. This state has no effect on already running instances. Initially a released process template is not instantiable.

      Please note that the returned state will have to be ignored if the request is for subprocess scope and the template usage is NO_SUBPROCESS.

      Parameters:
      subprocessScope - Whether the scope of the asked for template state is for subprocess usage (template is referenced) or for usage as top-level process.
      Returns:
      true if this process template may be instantiated. Ignore the returned value if the request is for subprocess scope and the template usage is TemplateUsage.NO_SUBPROCESS.
      See Also:
    • getInstantiableComment

      String getInstantiableComment(boolean subprocessScope)
      Returns the comment set for the instantiable status for either subprocess or top-level-usage.

      Please note that the returned comment will have to be ignored if the request is for subprocess scope and the template usage is NO_SUBPROCESS.

      Parameters:
      subprocessScope - Whether the scope of the asked for template state is for subprocess usage (template is referenced) or for usage as top-level process.
      Returns:
      The comment set for the current instantiable status or null if not set. Ignore the returned value if the request is for subprocess scope and the template usage is TemplateUsage.NO_SUBPROCESS.
    • isDerivable

      boolean isDerivable()
      Returns whether this process template may be derived and therefore modified. Besides creating a child template of the same branch, derivable is also applicable to the creation of a new branch, starting with this template. Initially a released process template may be derived. This is for top-level usage only since it refers to the template as stand-alone object in the process repository.
      Returns:
      true if the referenced process template may be derived.
    • getDerivableComment

      String getDerivableComment()
      Returns the comment set for the derivable status for either subprocess or top-level-usage.
      Returns:
      The comment set for the current derivable status or null if not set.
    • areInstancesMigratableTo

      boolean areInstancesMigratableTo(boolean subprocessScope)
      Returns whether instances running on a parent process template may be migrated to this process template or not. Initially a released process template is not migratable to, this means this method returns false.

      Please note that the returned state will have to be ignored if the request is for subprocess scope and the template usage is NO_SUBPROCESS.

      Parameters:
      subprocessScope - Whether the scope of the asked for template state is for subprocess usage (template is referenced) or for usage as top-level process.
      Returns:
      true if instances may be migrated to the referenced process template. Ignore the returned value if the request is for subprocess scope and the template usage is TemplateUsage.NO_SUBPROCESS.
      See Also:
    • getInstancesMigratableToComment

      String getInstancesMigratableToComment(boolean subprocessScope)
      Returns the comment set for the "instances migratable to"-status for either subprocess or top-level-usage.

      Please note that the returned comment will have to be ignored if the request is for subprocess scope and the template usage is NO_SUBPROCESS.

      Parameters:
      subprocessScope - Whether the scope of the asked for template state is for subprocess usage (template is referenced) or for usage as top-level process.
      Returns:
      The comment set for the current "instances migratable to"-status or null if not set. Ignore the returned value if the request is for subprocess scope and the template usage is TemplateUsage.NO_SUBPROCESS.
    • areInstancesChangeable

      boolean areInstancesChangeable(boolean subprocessScope)
      Returns whether instances running on this template may be changed or not. Initially instances of a released process template are changeable.

      Please note that the returned state will have to be ignored if the request is for subprocess scope and the template usage is NO_SUBPROCESS.

      Parameters:
      subprocessScope - Whether the scope of the asked for template state is for subprocess usage (template is referenced) or for usage as top-level process.
      Returns:
      true if instances may be changed. Ignore the returned value if the request is for subprocess scope and the template usage is TemplateUsage.NO_SUBPROCESS.
      See Also:
    • getInstancesChangeableComment

      String getInstancesChangeableComment(boolean subprocessScope)
      Returns the comment set for the "instances changeable"-status for either subprocess or top-level-usage.

      Please note that the returned comment will have to be ignored if the request is for subprocess scope and the template usage is NO_SUBPROCESS.

      Parameters:
      subprocessScope - Whether the scope of the asked for template state is for subprocess usage (template is referenced) or for usage as top-level process.
      Returns:
      The comment set for the current "instances changeable"-status or null if not set. Ignore the returned value if the request is for subprocess scope and the template usage is TemplateUsage.NO_SUBPROCESS.
    • getBuildtimeState

      Gets the state of this process template while it may be modified and is not released. A template can be in construction, locked or valid.
      Returns:
      The TemplateBuildtimeState of this template specifying whether changes are allowed.
    • setStarterRule

      void setStarterRule(String starterRule)
      Sets the staff assignment rule which specifies which agent may create and start an instance of this template.
      Parameters:
      starterRule - The staff assignment rule which specifies which agent may create and start an instance of this template.
    • setTopLevelUsage

      void setTopLevelUsage(boolean useAsTopLevel)
      Sets whether the designated template may be used and instantiated as top-level process. By default this is set to true.
      Parameters:
      useAsTopLevel - Whether the specified process template may be instantiated as top-level process.
    • setSubprocessUsage

      void setSubprocessUsage(ProcessConstants.TemplateUsage usage)
      Sets how the designated template may be used as subprocess. There can be four different usages:
      • NO_SUBPROCESS: the template can not be used as a subprocess
      • AS_COPY: the template is copied and physically integrated (embedded) in the corresponding superprocess
      • AS_REFERENCE: the template is referenced in the superprocess and may be subject to late binding or schema evolution
      • COPY_OR_REFERENCE: the template can be used as copy or as reference depending on the modelers demand
      By default this is set to TemplateUsage.NO_SUBPROCESS.
      Parameters:
      usage - Whether the specified process template may be instantiated as top-level process.
    • release

      void release() throws InvalidTemplateStateException
      Enables the instantiation and usage of the process template by setting the buildtime state to RELEASED. A released template may not be changed any more. One has to derive a new child template for modifications instead. Only a valid, that is a template compliant to the ADEPT-metamodel, may be released.

      When releasing a template the substates are set to the following default values for both usages, top-level as well as subprocess:

      • OUTDATED: false
      • DERIVABLE (scope-independent): true
      • INSTANCEABLE: false
      • INSTANCES_MIGRATABLE_TO: false
      • INSTANCES_CHANGEABLE: true

      Precondition:

       (template.getBuildtimeState() == ProcessConstants.TemplateBuildtimeState.VALID)
       

      Postcondition:

       (template.getBuildtimeState() == ProcessConstants.TemplateBuildtimeState.RELEASED)
           && !template.isOutdated(true | false)
           && template.isDerivable()
           && !template.isInstantiable(true | false)
           && !template.areInstancesMigratableTo(true | false)
           && template.areInstancesChangeable(true | false)
       
      Throws:
      InvalidTemplateStateException - If the process template is not valid, an InvalidTemplateStateException will be raised.
      See Also:
    • setOutdated

      void setOutdated(boolean outdated, boolean subprocessScope, String comment) throws InvalidTemplateStateException
      Sets the designated template to outdated or active. The usage of an outdated template will be especially treated by clients, for example by questioning whether the user is sure to use this outdated template. If this method is called with subprocess scope and for a template with template usage NO_SUBPROCESS, the method call will be ignored.
      Parameters:
      outdated - Whether the template is outdated or active.
      subprocessScope - Whether the the outdated-state is valid for subprocess usage or top-level usage..
      comment - The comment for the status to be set. The comment will override the former comment. The parameter may be null.
      Throws:
      InvalidTemplateStateException - If the process template is not released (in state ProcessConstants.TemplateBuildtimeState.RELEASED, an InvalidTemplateStateException will be raised.
    • setDerivable

      void setDerivable(boolean derivable, String comment) throws InvalidTemplateStateException
      Sets the designated template to derivable or not. A derivable template allows a corresponding child template to be created. This applies to the creation of a child template in the same branch as well as creation of a new branch starting with the designated template. If this method is called with subprocess scope and for a template with template usage NO_SUBPROCESS, the method call will be ignored.
      Parameters:
      derivable - Whether the template is derivable.
      comment - The comment for the status to be set. The comment will override the former comment. The parameter may be null.
      Throws:
      InvalidTemplateStateException - If the process template is not released (in state ProcessConstants.TemplateBuildtimeState.RELEASED, an InvalidTemplateStateException will be raised.
    • setInstantiable

      void setInstantiable(boolean instantiable, boolean subprocessScope, String comment) throws InvalidTemplateStateException
      Sets the designated template to instantiable or not. If this method is called with subprocess scope and for a template with template usage NO_SUBPROCESS, the method call will be ignored.
      Parameters:
      instantiable - Whether the template may be instantiated.
      subprocessScope - Whether the the outdated-state is valid for subprocess usage or top-level usage.
      comment - The comment for the status to be set. The comment will override the former comment. The parameter may be null.
      Throws:
      InvalidTemplateStateException - If the process template is not released (in state ProcessConstants.TemplateBuildtimeState.RELEASED, an InvalidTemplateStateException will be raised.
    • setInstancesMigratableTo

      void setInstancesMigratableTo(boolean instancesMigratableTo, boolean subprocessScope, String comment) throws InvalidTemplateStateException
      Sets the designated template to instances migratable to or not. If this is set to false, no instances (top-level and/or subprocess) can be migrated to the designated template. If this method is called with subprocess scope and for a template with template usage NO_SUBPROCESS, the method call will be ignored.
      Parameters:
      instancesMigratableTo - Whether instances may be migrated to the designated template.
      subprocessScope - Whether the the instancesMigratableTo-state is valid for subprocess usage or top-level usage.
      comment - The comment for the status to be set. The comment will override the former comment. The parameter may be null.
      Throws:
      InvalidTemplateStateException - If the process template is not released (in state ProcessConstants.TemplateBuildtimeState.RELEASED, an InvalidTemplateStateException will be raised.
    • setInstancesChangeable

      void setInstancesChangeable(boolean instancesChangeable, boolean subprocessScope, String comment) throws InvalidTemplateStateException
      Sets the designated template to instances changeable to or not. If this is set to false, no instances (in the given subprocess scope) can be ad-hoc modified. If this method is called with subprocess scope and for a template with template usage NO_SUBPROCESS, the method call will be ignored.
      Parameters:
      instancesChangeable - Whether instances running on the designated template may be individually changed.
      subprocessScope - Whether the the instancesChangeable-state is valid for subprocess usage or top-level usage.
      comment - The comment for the status to be set. The comment will override the former comment. The parameter may be null.
      Throws:
      InvalidTemplateStateException - If the process template is not released (in state ProcessConstants.TemplateBuildtimeState.RELEASED, an InvalidTemplateStateException will be raised.