org.apache.lenya.cms.usecase
Class DocumentUsecase

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.lenya.cms.usecase.AbstractUsecase
          extended by org.apache.lenya.cms.usecase.DocumentUsecase
All Implemented Interfaces:
org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, Usecase
Direct Known Subclasses:
ManageJobs

public class DocumentUsecase
extends AbstractUsecase

Extends AbstractUsecase with document helper methods.

Some parameters are initialized by default:


Field Summary
protected static java.lang.String DOCUMENT
           
protected static java.lang.String TARGET_DOCUMENT
           
 
Fields inherited from class org.apache.lenya.cms.usecase.AbstractUsecase
ATTRIBUTE_NAME, ATTRIBUTE_POLICY, ATTRIBUTE_USECASE, ATTRIBUTE_VALUE, context, ELEMENT_EXIT, ELEMENT_PARAMETER, ELEMENT_TRANSACTION, ELEMENT_VIEW, ERROR_OBJECTS_CHECKED_OUT, EVENT_CHECK_EXECUTION_CONDITIONS, EVENT_CHECK_POSTCONDITIONS, EVENT_CHECK_PRECONDITIONS, EVENT_EXECUTE, manager, MODEL, PARAMETER_CHECKOUT_RESTRICTED_TO_SESSION, PARAMETER_FACTORY, PARAMETER_SESSION, PARAMETER_STATE_MACHINE, PARAMETERS_INITIALIZED, SOURCE_URL, TRANSITIONS, VALUE_OPTIMISTIC, VALUE_PESSIMISTIC
 
Fields inherited from interface org.apache.lenya.cms.usecase.Usecase
ROLE
 
Constructor Summary
DocumentUsecase()
          Ctor.
 
Method Summary
protected  void doCheckPreconditions()
          Checks the preconditions.
protected  org.apache.lenya.cms.publication.Document getSourceDocument()
          Returns the source document.
 java.lang.String getSourceURL()
           
protected  org.apache.lenya.cms.publication.Document getTargetDocument(boolean success)
          Returns the document to be redirected to after the usecase has been completed.
 java.lang.String getTargetURL(boolean success)
          If setTargetDocument(Document)was not called, the URL of the source document ( getSourceDocument()) is returned.
protected  void setDefaultTargetURL(java.lang.String url)
          Sets the default target URL which should be used if no explicit target URL is set.
protected  void setTargetDocument(org.apache.lenya.cms.publication.Document document)
          Sets the target document for the case that the usecase execution succeeded (see getTargetDocument(boolean)).
 
Methods inherited from class org.apache.lenya.cms.usecase.AbstractUsecase
addErrorMessage, addErrorMessage, addErrorMessages, addInfoMessage, addInfoMessage, advance, advanceState, cancel, canCheckOut, checkEvent, checkExecutionConditions, checkoutRestrictedToSession, checkPostconditions, checkPreconditions, clearErrorMessages, clearInfoMessages, configure, contextualize, deleteParameter, doCheckExecutionConditions, doCheckPostconditions, doExecute, doInitialize, dumpErrorMessages, execute, getBooleanCheckboxParameter, getContext, getDocumentFactory, getErrorMessages, getExitQueryString, getInfoMessages, getName, getNodesToLock, getParameter, getParameter, getParameterAsBoolean, getParameterAsInteger, getParameterAsString, getParameterAsString, getParameterNames, getParameters, getPart, getSession, getStateMachine, getView, hasErrors, hasInfoMessages, initialize, initializeParametersIfNotDone, initParameters, isOptimistic, lockInvolvedObjects, lockInvolvedObjects, prepareView, service, setExitParameter, setName, setParameter, setPart, setSession, setSourceURL, setTestSession, setView, startTransaction
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOCUMENT

protected static final java.lang.String DOCUMENT
See Also:
Constant Field Values

TARGET_DOCUMENT

protected static final java.lang.String TARGET_DOCUMENT
See Also:
Constant Field Values
Constructor Detail

DocumentUsecase

public DocumentUsecase()
Ctor.

Method Detail

doCheckPreconditions

protected void doCheckPreconditions()
                             throws java.lang.Exception
Description copied from class: AbstractUsecase
Checks the preconditions.

Overrides:
doCheckPreconditions in class AbstractUsecase
Throws:
java.lang.Exception - if an error occurs.
See Also:
AbstractUsecase.doCheckPreconditions()

getSourceDocument

protected org.apache.lenya.cms.publication.Document getSourceDocument()
Returns the source document.

Returns:
A document.

setTargetDocument

protected void setTargetDocument(org.apache.lenya.cms.publication.Document document)
Sets the target document for the case that the usecase execution succeeded (see getTargetDocument(boolean)).

Parameters:
document - A document.

getTargetDocument

protected org.apache.lenya.cms.publication.Document getTargetDocument(boolean success)
Returns the document to be redirected to after the usecase has been completed. If the parameter success is false, the source document is returned (override this method to change this behaviour).

Parameters:
success - If the usecase was successfully completed.
Returns:
A document.

getTargetURL

public java.lang.String getTargetURL(boolean success)
If setTargetDocument(Document)was not called, the URL of the source document ( getSourceDocument()) is returned.

Specified by:
getTargetURL in interface Usecase
Overrides:
getTargetURL in class AbstractUsecase
Parameters:
success - If the usecase was completed successfully.
Returns:
A web application URL.
See Also:
Usecase.getTargetURL(boolean)

getSourceURL

public java.lang.String getSourceURL()
Specified by:
getSourceURL in interface Usecase
Overrides:
getSourceURL in class AbstractUsecase
Returns:
The web application URL the usecase was invoked on.
See Also:
AbstractUsecase.getSourceURL()

setDefaultTargetURL

protected void setDefaultTargetURL(java.lang.String url)
Description copied from class: AbstractUsecase
Sets the default target URL which should be used if no explicit target URL is set.

Overrides:
setDefaultTargetURL in class AbstractUsecase
Parameters:
url - A URL string.
See Also:
AbstractUsecase.setDefaultTargetURL(java.lang.String)


Copyright $ Apache Software Foundation. All Rights Reserved.