org.apache.lenya.cms.publication.task
Class PublicationTask

java.lang.Object
  extended by org.apache.lenya.cms.task.AbstractTask
      extended by org.apache.lenya.cms.publication.task.PublicationTask
All Implemented Interfaces:
org.apache.avalon.framework.parameters.Parameterizable, Task
Direct Known Subclasses:
Deactivate, DocumentTask, Publish

public abstract class PublicationTask
extends AbstractTask

Abstract super class for publication-based tasks.


Field Summary
static java.lang.String PARAMETER_IP_ADDRESS
           
static java.lang.String PARAMETER_ROLE_IDS
           
static java.lang.String PARAMETER_USER_ID
           
static java.lang.String PARAMETER_WORKFLOW_EVENT
           
static java.lang.String ROLE_SEPARATOR_REGEXP
           
 
Fields inherited from interface org.apache.lenya.cms.task.Task
DEFAULT_PREFIX, FAILURE, NAMESPACE, PARAMETER_CONTEXT_PREFIX, PARAMETER_PUBLICATION_ID, PARAMETER_SERVER_PORT, PARAMETER_SERVER_URI, PARAMETER_SERVLET_CONTEXT, SUCCESS
 
Constructor Summary
PublicationTask()
           
 
Method Summary
protected  boolean canCheckOut(Document document)
          Checks if the document can be checked out.
protected  boolean canWorkflowFire(Document document)
          Checks if the workflow event can be invoked on a document.
protected  void copyResources(Document sourceDocument, Document destinationDocument)
          Copies the resources of a document to another document.
protected  java.lang.String getEventName()
          Returns the workflow event name.
protected  Event getExecutableEvent(SynchronizedWorkflowInstances instance, Situation situation)
          Returns the executable event for the provided PARAMETER_WORKFLOW_EVENT parameter.
protected  Publication getPublication()
          Returns the publication used by this task.
protected  RevisionController getRevisionController()
          Returns the revision controller.
protected  java.lang.String getRevisionFilePath(Document document)
          Returns the revision file path of a document.
protected  java.lang.String[] getRoleIDs()
          Returns the role IDs.
protected  Situation getSituation()
          Returns the workflow situation.
protected  void reservedCheckIn(Document document, boolean backup)
          Checks in a document and creates a revision, if backup is true.
protected  void reservedCheckOut(Document document)
          Checks out a document.
protected  void triggerWorkflow(Document document)
          Invokes the workflow on a document.
 
Methods inherited from class org.apache.lenya.cms.task.AbstractTask
getParameters, getResult, parameterize, setLabel, setResult
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.lenya.cms.task.Task
execute
 

Field Detail

PARAMETER_WORKFLOW_EVENT

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

PARAMETER_USER_ID

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

PARAMETER_IP_ADDRESS

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

PARAMETER_ROLE_IDS

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

ROLE_SEPARATOR_REGEXP

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

PublicationTask

public PublicationTask()
Method Detail

getPublication

protected Publication getPublication()
                              throws ExecutionException
Returns the publication used by this task.

Returns:
A publication.
Throws:
ExecutionException - when an error occurs.

copyResources

protected void copyResources(Document sourceDocument,
                             Document destinationDocument)
                      throws ExecutionException
Copies the resources of a document to another document.

Parameters:
sourceDocument - The source document.
destinationDocument - The destination document.
Throws:
PublicationException - when something went wrong.
ExecutionException - when something went wrong.
java.io.IOException - when something went wrong.

canWorkflowFire

protected boolean canWorkflowFire(Document document)
                           throws ExecutionException
Checks if the workflow event can be invoked on a document.

Parameters:
document - The document.
Returns:
A boolean value.
Throws:
ExecutionException - when something went wrong.

getSituation

protected Situation getSituation()
                          throws org.apache.avalon.framework.parameters.ParameterException
Returns the workflow situation.

Returns:
A situation.
Throws:
org.apache.avalon.framework.parameters.ParameterException - when something went wrong.

triggerWorkflow

protected void triggerWorkflow(Document document)
                        throws ExecutionException
Invokes the workflow on a document.

Parameters:
document - The document.
Throws:
org.apache.avalon.framework.parameters.ParameterException - when something went wrong.
WorkflowException - when something went wrong.
ExecutionException

getExecutableEvent

protected Event getExecutableEvent(SynchronizedWorkflowInstances instance,
                                   Situation situation)
                            throws WorkflowException,
                                   org.apache.avalon.framework.parameters.ParameterException
Returns the executable event for the provided PARAMETER_WORKFLOW_EVENT parameter.

Parameters:
instance - The workflow instance.
situation - The situation.
Returns:
An event.
Throws:
WorkflowException - when something went wrong.
org.apache.avalon.framework.parameters.ParameterException - when the PARAMETER_WORKFLOW_EVENT parameter could not be resolved.

getEventName

protected java.lang.String getEventName()
                                 throws org.apache.avalon.framework.parameters.ParameterException
Returns the workflow event name.

Returns:
A string.
Throws:
org.apache.avalon.framework.parameters.ParameterException - when the parameter does not exist.

getRoleIDs

protected java.lang.String[] getRoleIDs()
                                 throws org.apache.avalon.framework.parameters.ParameterException
Returns the role IDs.

Returns:
An array of strings.
Throws:
org.apache.avalon.framework.parameters.ParameterException

getRevisionController

protected RevisionController getRevisionController()
                                            throws RevisionControlException,
                                                   ExecutionException
Returns the revision controller.

Returns:
A revision controller.
Throws:
ExecutionException
java.io.IOException - when something went wrong.
RevisionControlException

getRevisionFilePath

protected java.lang.String getRevisionFilePath(Document document)
                                        throws java.io.IOException
Returns the revision file path of a document.

Parameters:
document - The document.
Returns:
A string.
Throws:
java.io.IOException - when something went wrong.

canCheckOut

protected boolean canCheckOut(Document document)
                       throws ExecutionException,
                              java.io.IOException,
                              java.lang.Exception
Checks if the document can be checked out.

Parameters:
document - The document
Returns:
A boolean value.
Throws:
ExecutionException - when something went wrong.
java.io.IOException - when something went wrong.
java.lang.Exception - when something went wrong.

reservedCheckIn

protected void reservedCheckIn(Document document,
                               boolean backup)
                        throws FileReservedCheckInException,
                               java.lang.Exception
Checks in a document and creates a revision, if backup is true.

Parameters:
document -
backup - A boolean Value
Throws:
FileReservedCheckInException - when something went wrong.
java.lang.Exception - when something went wrong.

reservedCheckOut

protected void reservedCheckOut(Document document)
                         throws java.io.IOException,
                                java.lang.Exception
Checks out a document.

Parameters:
document - The document
Throws:
java.io.IOException - when something went wrong.
java.lang.Exception - when something went wrong.


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