Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.lenya.workflow.impl
Class History  view History download History.java

java.lang.Object
  extended byorg.apache.lenya.workflow.impl.History
All Implemented Interfaces:
org.apache.lenya.workflow.WorkflowListener

public abstract class History
extends java.lang.Object
implements org.apache.lenya.workflow.WorkflowListener

The history of a workflow instance contains a list of all versions of the instance. A version contains


Field Summary
static java.lang.String DATE_ATTRIBUTE
           
static java.lang.String EVENT_ATTRIBUTE
           
static java.lang.String HISTORY_ELEMENT
           
private  WorkflowInstanceImpl instance
           
static java.lang.String NAME_ATTRIBUTE
           
static java.lang.String STATE_ATTRIBUTE
           
static java.lang.String VALUE_ATTRIBUTE
           
static java.lang.String VARIABLE_ELEMENT
           
static java.lang.String VERSION_ELEMENT
           
static java.lang.String WORKFLOW_ATTRIBUTE
           
 
Constructor Summary
protected History()
          Creates a new history object for a workflow instance.
 
Method Summary
protected  org.w3c.dom.Element createInitialVersionElement(org.apache.lenya.xml.NamespaceHelper helper, org.apache.lenya.workflow.Situation situation, java.lang.String workflowId)
          Creates a new version element.
protected abstract  WorkflowInstanceImpl createInstance()
          Factory method to create a workflow instance object.
protected  org.w3c.dom.Element createVersionElement(org.apache.lenya.xml.NamespaceHelper helper, org.apache.lenya.workflow.Situation situation)
          Creates a version element based on a situation.
protected  org.w3c.dom.Element createVersionElement(org.apache.lenya.xml.NamespaceHelper helper, StateImpl state, org.apache.lenya.workflow.Situation situation, org.apache.lenya.workflow.Event event)
          Creates a new version element.
 void delete()
          Deletes the history.
protected abstract  java.io.File getHistoryFile()
          Factory method to obtain the history file.
 WorkflowInstanceImpl getInstance()
          Restores the workflow, state and variables of a workflow instance from this history.
protected  org.apache.lenya.xml.NamespaceHelper getNamespaceHelper()
          Returns the namespace helper for the history file.
 Version[] getVersions()
          Returns the versions of this history.
protected  java.lang.String getWorkflowId()
          Returns the workflow ID for this history.
protected  java.lang.String getWorkflowId(org.apache.lenya.xml.NamespaceHelper helper)
          Returns the workflow ID for this history.
 void initialize(java.lang.String workflowId, org.apache.lenya.workflow.Situation situation)
          Creates a new history object.
 boolean isInitialized()
          Returns if the history has been initialized.
protected  void move(java.io.File newFile)
          Moves this history to a new file.
protected  void restoreState(WorkflowInstanceImpl instance, org.apache.lenya.xml.NamespaceHelper helper)
          Restores the state of a workflow instance.
protected  void restoreVariables(WorkflowInstanceImpl instance, org.apache.lenya.xml.NamespaceHelper helper)
          Restores the state variables of a workflow instance.
protected  Version restoreVersion(org.apache.lenya.xml.NamespaceHelper helper, org.w3c.dom.Element element)
          Restores a version from an XML element.
protected  void saveVariables(org.apache.lenya.xml.NamespaceHelper helper)
          Saves the state variables as children of the document element.
 void setInstance(WorkflowInstanceImpl impl)
          Sets the workflow instance.
 void transitionFired(org.apache.lenya.workflow.WorkflowInstance instance, org.apache.lenya.workflow.Situation situation, org.apache.lenya.workflow.Event event)
          Advances the workflow history when a tranistion was invoked.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WORKFLOW_ATTRIBUTE

public static final java.lang.String WORKFLOW_ATTRIBUTE
See Also:
Constant Field Values

HISTORY_ELEMENT

public static final java.lang.String HISTORY_ELEMENT
See Also:
Constant Field Values

VERSION_ELEMENT

public static final java.lang.String VERSION_ELEMENT
See Also:
Constant Field Values

STATE_ATTRIBUTE

public static final java.lang.String STATE_ATTRIBUTE
See Also:
Constant Field Values

EVENT_ATTRIBUTE

public static final java.lang.String EVENT_ATTRIBUTE
See Also:
Constant Field Values

VARIABLE_ELEMENT

public static final java.lang.String VARIABLE_ELEMENT
See Also:
Constant Field Values

NAME_ATTRIBUTE

public static final java.lang.String NAME_ATTRIBUTE
See Also:
Constant Field Values

VALUE_ATTRIBUTE

public static final java.lang.String VALUE_ATTRIBUTE
See Also:
Constant Field Values

DATE_ATTRIBUTE

public static final java.lang.String DATE_ATTRIBUTE
See Also:
Constant Field Values

instance

private WorkflowInstanceImpl instance
Constructor Detail

History

protected History()
Creates a new history object for a workflow instance.

Method Detail

initialize

public void initialize(java.lang.String workflowId,
                       org.apache.lenya.workflow.Situation situation)
                throws org.apache.lenya.workflow.WorkflowException
Creates a new history object. A new history file is created and initialized.


getNamespaceHelper

protected org.apache.lenya.xml.NamespaceHelper getNamespaceHelper()
                                                           throws org.apache.lenya.workflow.WorkflowException
Returns the namespace helper for the history file.


getWorkflowId

protected java.lang.String getWorkflowId()
                                  throws org.apache.lenya.workflow.WorkflowException
Returns the workflow ID for this history.


getWorkflowId

protected java.lang.String getWorkflowId(org.apache.lenya.xml.NamespaceHelper helper)
                                  throws org.apache.lenya.workflow.WorkflowException
Returns the workflow ID for this history.


getInstance

public WorkflowInstanceImpl getInstance()
                                 throws org.apache.lenya.workflow.WorkflowException
Restores the workflow, state and variables of a workflow instance from this history.


isInitialized

public boolean isInitialized()
Returns if the history has been initialized.


getHistoryFile

protected abstract java.io.File getHistoryFile()
Factory method to obtain the history file.


createInstance

protected abstract WorkflowInstanceImpl createInstance()
                                                throws org.apache.lenya.workflow.WorkflowException
Factory method to create a workflow instance object.


createInitialVersionElement

protected org.w3c.dom.Element createInitialVersionElement(org.apache.lenya.xml.NamespaceHelper helper,
                                                          org.apache.lenya.workflow.Situation situation,
                                                          java.lang.String workflowId)
                                                   throws org.apache.lenya.workflow.WorkflowException
Creates a new version element. This method is called after a tansition invocation.


createVersionElement

protected org.w3c.dom.Element createVersionElement(org.apache.lenya.xml.NamespaceHelper helper,
                                                   StateImpl state,
                                                   org.apache.lenya.workflow.Situation situation,
                                                   org.apache.lenya.workflow.Event event)
Creates a new version element. This method is called after a tansition invocation.


createVersionElement

protected org.w3c.dom.Element createVersionElement(org.apache.lenya.xml.NamespaceHelper helper,
                                                   org.apache.lenya.workflow.Situation situation)
Creates a version element based on a situation.


transitionFired

public void transitionFired(org.apache.lenya.workflow.WorkflowInstance instance,
                            org.apache.lenya.workflow.Situation situation,
                            org.apache.lenya.workflow.Event event)
                     throws org.apache.lenya.workflow.WorkflowException
Advances the workflow history when a tranistion was invoked.

Specified by:
transitionFired in interface org.apache.lenya.workflow.WorkflowListener

setInstance

public void setInstance(WorkflowInstanceImpl impl)
Sets the workflow instance.


saveVariables

protected void saveVariables(org.apache.lenya.xml.NamespaceHelper helper)
                      throws org.apache.lenya.workflow.WorkflowException
Saves the state variables as children of the document element.


restoreVariables

protected void restoreVariables(WorkflowInstanceImpl instance,
                                org.apache.lenya.xml.NamespaceHelper helper)
                         throws org.apache.lenya.workflow.WorkflowException
Restores the state variables of a workflow instance.


restoreState

protected void restoreState(WorkflowInstanceImpl instance,
                            org.apache.lenya.xml.NamespaceHelper helper)
                     throws org.apache.lenya.workflow.WorkflowException
Restores the state of a workflow instance.


move

protected void move(java.io.File newFile)
             throws org.apache.lenya.workflow.WorkflowException
Moves this history to a new file.


restoreVersion

protected Version restoreVersion(org.apache.lenya.xml.NamespaceHelper helper,
                                 org.w3c.dom.Element element)
                          throws org.apache.lenya.workflow.WorkflowException
Restores a version from an XML element.


getVersions

public Version[] getVersions()
                      throws org.apache.lenya.workflow.WorkflowException
Returns the versions of this history.


delete

public void delete()
            throws org.apache.lenya.workflow.WorkflowException
Deletes the history.