org.imixs.workflow.plugins.jee
Class VersionPlugin

java.lang.Object
  extended by org.imixs.workflow.plugins.AbstractPlugin
      extended by org.imixs.workflow.plugins.jee.AbstractPlugin
          extended by org.imixs.workflow.plugins.jee.VersionPlugin
All Implemented Interfaces:
org.imixs.workflow.Plugin

public class VersionPlugin
extends AbstractPlugin

This plugin handles the creation and management of versions from an existing workitem. inside the Imix JEE Workflow. The creation or modificatin of a version is defined by the workflowmodel. The plugin can generate new versions (e.g. creating a version of a master version) and also converting a existing version into a master version.

The Plugin depends on the org.imixs.workflow.jee.ejb.WorkflowManager. So the Plugin can not be used in other implementations.

The creation and management of a new version is defined by the workflow model (See Imixs Modeler) There are currently two modes supported (provided by the activity property 'keyVersion')

mode=1 indicates that the plugin should create a new version of the current workitem. The two workitems are identically except the attributes $unqiueid and $workitemidRef. The attribute workitemidRef points to the $uniqueid form the source workitem. So the availability of this property indicates that the workitem is a version of source workitem with this $uniqueid. The source workitem has typically no $workitemidRef attribute. The Source Workitem is also named Master Version. After the new version is created the plugin processes the version with the activity provided by the model (numVersionActivityID) if provided by the model.

2=indicates that the plugin should convert a existing version into a Master Version. This means that the $workitemIDRef will be nulled. An existing Master Version will be processed by the activity provided by the model (numVersionActivityID). Also the $workitemidRef will be set to the current $workitemID.

If an error occured during the workflow process this plugin will throw a new ejbexception in the close() method to cancel the current transaction. So no changes will be saved by the ejb container

Version:
1.0
Author:
Ralph Soika
See Also:
org.imixs.workflow.jee.ejb.WorkflowManager

Field Summary
 
Fields inherited from class org.imixs.workflow.plugins.AbstractPlugin
ctx
 
Fields inherited from interface org.imixs.workflow.Plugin
PLUGIN_ERROR, PLUGIN_OK, PLUGIN_WARNING
 
Constructor Summary
VersionPlugin()
           
 
Method Summary
 void close(int status)
           
 org.imixs.workflow.ItemCollection createVersion(org.imixs.workflow.ItemCollection sourceItemCollection)
          This method creates a new instance of a exiting workitem.
 EntityService getEntityService()
           
 org.imixs.workflow.ItemCollection getVersion()
           
 WorkflowService getWorkflowService()
           
 void init(org.imixs.workflow.WorkflowContext actx)
          the init method throws an exception if the plugin is not run in a instance of org.imixs.workflow.jee.ejb.WorkflowManager.
 int run(org.imixs.workflow.ItemCollection adocumentContext, org.imixs.workflow.ItemCollection adocumentActivity)
          creates an version depending to the version mode and the version activity ID provided by the workflow model.
 void setVersion(org.imixs.workflow.ItemCollection version)
           
 
Methods inherited from class org.imixs.workflow.plugins.jee.AbstractPlugin
getUserName
 
Methods inherited from class org.imixs.workflow.plugins.AbstractPlugin
formatItemValues, replaceDynamicValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VersionPlugin

public VersionPlugin()
Method Detail

init

public void init(org.imixs.workflow.WorkflowContext actx)
          throws Exception
the init method throws an exception if the plugin is not run in a instance of org.imixs.workflow.jee.ejb.WorkflowManager. This is necessary as the plugin needs an instance of the EntityService.

Specified by:
init in interface org.imixs.workflow.Plugin
Overrides:
init in class AbstractPlugin
Throws:
Exception

getEntityService

public EntityService getEntityService()

getWorkflowService

public WorkflowService getWorkflowService()

getVersion

public org.imixs.workflow.ItemCollection getVersion()

setVersion

public void setVersion(org.imixs.workflow.ItemCollection version)

run

public int run(org.imixs.workflow.ItemCollection adocumentContext,
               org.imixs.workflow.ItemCollection adocumentActivity)
        throws Exception
creates an version depending to the version mode and the version activity ID provided by the workflow model.

Specified by:
run in interface org.imixs.workflow.Plugin
Specified by:
run in class AbstractPlugin
Throws:
Exception

close

public void close(int status)
           throws Exception
Specified by:
close in interface org.imixs.workflow.Plugin
Specified by:
close in class AbstractPlugin
Throws:
Exception

createVersion

public org.imixs.workflow.ItemCollection createVersion(org.imixs.workflow.ItemCollection sourceItemCollection)
                                                throws Exception
This method creates a new instance of a exiting workitem. The method did not save the workitem!. The method can be subclassed to modify the new created version. The new property $WorkitemIDRef will be added which points to the $uniqueID of the sourceWorkitem.

Parameters:
sourceItemCollection - the ItemCollection which should be versioned
Returns:
new version of the source ItemCollection
Throws:
Exception


Copyright © 2006-2012 Imixs Software Solutions GmbH. All Rights Reserved.