Class VersionPlugin
- java.lang.Object
-
- org.imixs.workflow.engine.plugins.AbstractPlugin
-
- org.imixs.workflow.engine.plugins.VersionPlugin
-
- All Implemented Interfaces:
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 $uniqueid 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 Modifier and Type Field Description static StringINVALID_CONTEXTstatic StringINVALID_WORKITEM-
Fields inherited from class org.imixs.workflow.engine.plugins.AbstractPlugin
INVALID_ITEMVALUE_FORMAT, INVALID_PROPERTYVALUE_FORMAT
-
-
Constructor Summary
Constructors Constructor Description VersionPlugin()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ItemCollectioncreateVersion(ItemCollection sourceItemCollection)This method creates a new instance of a exiting workitem.ItemCollectiongetVersion()static booleanisProcssingVersion(ItemCollection adocumentContext)returns true in case a new version is created based on the currentWorkitemItemCollectionrun(ItemCollection adocumentContext, ItemCollection adocumentActivity)creates a new version or converts a version into the MasterVersion depending to the activity attribute "keyVersion" provided by the workflow model.voidsetVersion(ItemCollection version)-
Methods inherited from class org.imixs.workflow.engine.plugins.AbstractPlugin
close, getCtx, getWorkflowService, init, mergeFieldList, uniqueList
-
-
-
-
Field Detail
-
INVALID_CONTEXT
public static final String INVALID_CONTEXT
- See Also:
- Constant Field Values
-
INVALID_WORKITEM
public static final String INVALID_WORKITEM
- See Also:
- Constant Field Values
-
-
Method Detail
-
getVersion
public ItemCollection getVersion()
-
setVersion
public void setVersion(ItemCollection version)
-
run
public ItemCollection run(ItemCollection adocumentContext, ItemCollection adocumentActivity) throws PluginException
creates a new version or converts a version into the MasterVersion depending to the activity attribute "keyVersion" provided by the workflow model. If a new version is created and be processed the plugin adds the attribute '_versionprocessing' = true to indicate this situation for other plugins. Other plugins can determine the $processingversion mode by calling the method isProcssingVersion(). The attribute will be removed after a version was processed.- Throws:
PluginException
-
isProcssingVersion
public static boolean isProcssingVersion(ItemCollection adocumentContext)
returns true in case a new version is created based on the currentWorkitem- Parameters:
documentContext-documentActivity-- Returns:
-
createVersion
public ItemCollection createVersion(ItemCollection sourceItemCollection) throws PluginException
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:
PluginExceptionException
-
-