org.apache.lenya.cms.workflow
Class CMSHistory

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

public class CMSHistory
extends History


Field Summary
static java.lang.String HISTORY_PATH
           
static java.lang.String ID_ATTRIBUTE
           
static java.lang.String IDENTITY_ELEMENT
           
static java.lang.String IP_ATTRIBUTE
           
static java.lang.String MACHINE_ELEMENT
           
static java.lang.String NAME_ATTRIBUTE
           
static java.lang.String USER_ELEMENT
           
 
Fields inherited from class org.apache.lenya.workflow.impl.History
DATE_ATTRIBUTE, EVENT_ATTRIBUTE, HISTORY_ELEMENT, STATE_ATTRIBUTE, VALUE_ATTRIBUTE, VARIABLE_ELEMENT, VERSION_ELEMENT, WORKFLOW_ATTRIBUTE
 
Constructor Summary
protected CMSHistory(Document document)
          Creates a new CMSHistory object.
 
Method Summary
protected  WorkflowInstanceImpl createInstance()
          Factory method to create a workflow instance object.
protected  org.w3c.dom.Element createVersionElement(NamespaceHelper helper, Situation situation)
          Creates a version element based on a situation.
 void delete()
          Additionally to deleting the workflow history, the parent directories are deleted up to the workflow history directory.
protected  org.w3c.dom.Element generateMachineElement(NamespaceHelper helper, java.lang.String machineIp)
          Creates an XML element describing the machine.
protected  org.w3c.dom.Element generateUserElement(NamespaceHelper helper, java.lang.String userId)
          Creates an XML element describing the user.
 Document getDocument()
          Get the document
protected  java.io.File getHistoryFile()
          Factory method to obtain the history file.
protected  java.io.File getHistoryFile(Document document)
          Returns the history file for a certain document.
 java.lang.String getHistoryPath()
          Returns the history path of this history.
 java.lang.String getHistoryPath(Document document)
          Returns the path of the history file inside the publication directory.
protected  void initialize(Document newDocument, Situation situation)
          Initializes the workflow history of another document using the same workflow schema like this history.
protected  void move(Document newDocument)
          Moves this history to a new document.
protected  Version restoreVersion(NamespaceHelper helper, org.w3c.dom.Element element)
          Restores a version from an XML element.
 void setDocument(Document document)
          Set the document
 
Methods inherited from class org.apache.lenya.workflow.impl.History
createInitialVersionElement, createVersionElement, getInstance, getNamespaceHelper, getVersions, getWorkflowId, getWorkflowId, initialize, isInitialized, move, restoreState, restoreVariables, saveVariables, setInstance, transitionFired
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HISTORY_PATH

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

IDENTITY_ELEMENT

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

USER_ELEMENT

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

MACHINE_ELEMENT

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

ID_ATTRIBUTE

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

NAME_ATTRIBUTE

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

IP_ATTRIBUTE

public static final java.lang.String IP_ATTRIBUTE
See Also:
Constant Field Values
Constructor Detail

CMSHistory

protected CMSHistory(Document document)
Creates a new CMSHistory object.

Parameters:
document - the document to which the CMSHistory is attached
Method Detail

createVersionElement

protected org.w3c.dom.Element createVersionElement(NamespaceHelper helper,
                                                   Situation situation)
Description copied from class: History
Creates a version element based on a situation.

Overrides:
createVersionElement in class History
Parameters:
helper - The namespace helper of the history document.
situation - The current situation.
Returns:
An XML element.
See Also:
History.createVersionElement(org.apache.lenya.xml.NamespaceHelper, org.apache.lenya.workflow.Situation)

generateUserElement

protected org.w3c.dom.Element generateUserElement(NamespaceHelper helper,
                                                  java.lang.String userId)
Creates an XML element describing the user.

Parameters:
helper - The namespace helper of the document.
userId - The user ID.
Returns:
An XML element.

generateMachineElement

protected org.w3c.dom.Element generateMachineElement(NamespaceHelper helper,
                                                     java.lang.String machineIp)
Creates an XML element describing the machine.

Parameters:
helper - The namespace helper of the document.
machineIp - The machine IP address.
Returns:
An XML element.

getHistoryPath

public java.lang.String getHistoryPath(Document document)
Returns the path of the history file inside the publication directory.

Parameters:
document - A CMS document.
Returns:
A string.

getHistoryFile

protected java.io.File getHistoryFile()
Description copied from class: History
Factory method to obtain the history file.

Specified by:
getHistoryFile in class History
Returns:
A file.
See Also:
History.getHistoryFile()

getHistoryFile

protected java.io.File getHistoryFile(Document document)
Returns the history file for a certain document.

Parameters:
document - The document.
Returns:
A file.

createInstance

protected WorkflowInstanceImpl createInstance()
                                       throws WorkflowException
Description copied from class: History
Factory method to create a workflow instance object.

Specified by:
createInstance in class History
Returns:
A workflow instance object.
Throws:
WorkflowException - if something goes wrong.
See Also:
History.createInstance()

getDocument

public Document getDocument()
Get the document

Returns:
the Document

setDocument

public void setDocument(Document document)
Set the document

Parameters:
document - the document

initialize

protected void initialize(Document newDocument,
                          Situation situation)
                   throws WorkflowException
Initializes the workflow history of another document using the same workflow schema like this history.

Parameters:
newDocument - The document to initialize the history for.
situation - The current situation.
Throws:
WorkflowException - when something went wrong.

move

protected void move(Document newDocument)
             throws WorkflowException
Moves this history to a new document.

Parameters:
newDocument - The new document.
Throws:
WorkflowException - when something went wrong.

restoreVersion

protected Version restoreVersion(NamespaceHelper helper,
                                 org.w3c.dom.Element element)
                          throws WorkflowException
Description copied from class: History
Restores a version from an XML element.

Overrides:
restoreVersion in class History
Parameters:
helper - The namespace helper.
element - An XML element.
Returns:
A version.
Throws:
WorkflowException - when something went wrong.
See Also:
History.restoreVersion(NamespaceHelper, org.w3c.dom.Element)

getHistoryPath

public java.lang.String getHistoryPath()
Returns the history path of this history.

Returns:
A string.

delete

public void delete()
            throws WorkflowException
Additionally to deleting the workflow history, the parent directories are deleted up to the workflow history directory.

Overrides:
delete in class History
Throws:
WorkflowException - when something went wrong.
See Also:
History.delete()


Copyright © 1999-2005 Apache Software Foundation. All Rights Reserved.