org.apache.lenya.defaultpub.cms.task
Class Publish

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

public class Publish
extends PublicationTask

Publish a document.


Field Summary
static java.lang.String PARAMETER_DOCUMENT_ID
           
static java.lang.String PARAMETER_DOCUMENT_LANGUAGE
           
static java.lang.String PARAMETER_USER_EMAIL
           
static java.lang.String PARAMETER_USER_NAME
           
 
Fields inherited from class org.apache.lenya.cms.publication.task.PublicationTask
PARAMETER_IP_ADDRESS, PARAMETER_ROLE_IDS, PARAMETER_USER_ID, PARAMETER_WORKFLOW_EVENT, 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
Publish()
           
 
Method Summary
protected  boolean checkPreconditions(Document document)
          Checks if the preconditions are complied.
 void execute(java.lang.String servletContextPath)
          Execute the task.
protected  Document getAuthoringDocument()
          Returns the authoring document to apply this task on.
protected  void publish(Document authoringDocument)
          Publishes a document.
 void setModificationDate(Document document, java.lang.String date)
          set the date of the publication, the date of the last change
 void setPublicationDate(Document document, java.lang.String date)
          set the date of the first publication
 void setPublisher(Document document)
          set the publisher (the user-id, the user-name and the user-email seperate with a |)
 
Methods inherited from class org.apache.lenya.cms.publication.task.PublicationTask
canCheckOut, canWorkflowFire, copyResources, getEventName, getExecutableEvent, getPublication, getRevisionController, getRevisionFilePath, getRoleIDs, getSituation, reservedCheckIn, reservedCheckOut, triggerWorkflow
 
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
 

Field Detail

PARAMETER_DOCUMENT_ID

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

PARAMETER_DOCUMENT_LANGUAGE

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

PARAMETER_USER_NAME

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

PARAMETER_USER_EMAIL

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

Publish

public Publish()
Method Detail

execute

public void execute(java.lang.String servletContextPath)
             throws ExecutionException
Description copied from interface: Task
Execute the task. All parameters must have been set with parameterize().

Parameters:
servletContextPath - the servlet-context
Throws:
ExecutionException - if the execution fails
See Also:
Task.execute(java.lang.String)

setPublisher

public void setPublisher(Document document)
                  throws PublicationException,
                         org.apache.avalon.framework.parameters.ParameterException
set the publisher (the user-id, the user-name and the user-email seperate with a |)

Parameters:
document - The document.
Throws:
PublicationException - When something went wrong.
org.apache.avalon.framework.parameters.ParameterException - When something went wrong.

setModificationDate

public void setModificationDate(Document document,
                                java.lang.String date)
                         throws PublicationException
set the date of the publication, the date of the last change

Parameters:
document - The document.
date - The date in the format yyyy-MM-dd HH:mm:ss.
Throws:
PublicationException - When something went wrong

setPublicationDate

public void setPublicationDate(Document document,
                               java.lang.String date)
                        throws PublicationException
set the date of the first publication

Parameters:
document - The document.
date - The date in the format yyyy-MM-dd HH:mm:ss.
Throws:
PublicationException - When something went wrong

checkPreconditions

protected boolean checkPreconditions(Document document)
                              throws ExecutionException,
                                     java.io.IOException,
                                     java.lang.Exception
Checks if the preconditions are complied.

Parameters:
document - The document to publish.
Returns:
Throws:
ExecutionException
java.lang.Exception
java.io.IOException

publish

protected void publish(Document authoringDocument)
                throws PublicationException,
                       ExecutionException,
                       java.io.IOException,
                       org.apache.avalon.framework.parameters.ParameterException,
                       WorkflowException
Publishes a document.

Parameters:
authoringDocument - The authoring document.
Throws:
PublicationException
ExecutionException
java.io.IOException
org.apache.avalon.framework.parameters.ParameterException
WorkflowException

getAuthoringDocument

protected Document getAuthoringDocument()
                                 throws org.apache.avalon.framework.parameters.ParameterException,
                                        DocumentBuildException,
                                        ExecutionException
Returns the authoring document to apply this task on.

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


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