org.apache.lenya.cms.site.usecases
Class Create

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.site.usecases.Create
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, org.apache.lenya.cms.usecase.Usecase
Direct Known Subclasses:
CreateDocument, CreateLanguage

public abstract class Create
extends org.apache.lenya.cms.usecase.AbstractUsecase

Abstract superclass for usecases to create a document.

You can pass the following parameters into the usecase:

Version:
$Id: Create.java 571550 2007-08-31 19:18:54Z rfrovarp $

Field Summary
protected static java.lang.String DUBLIN_CORE_PREFIX
           
protected static java.lang.String LANGUAGE
           
protected static java.lang.String LANGUAGES
           
protected static java.lang.String NODE_NAME
           
protected static java.lang.String PATH
           
protected static java.lang.String RESOURCE_TYPES
           
protected static java.lang.String SAMPLE
           
protected static java.lang.String SAMPLES
           
protected static java.lang.String VISIBLEINNAV
           
 
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
Create()
          Ctor.
 
Method Summary
protected abstract  boolean createVersion()
           
protected  void doCheckExecutionConditions()
           
protected  void doCheckPreconditions()
           
protected  void doExecute()
           
 java.lang.String getArea()
           
protected abstract  java.lang.String getDocumentTypeName()
           
protected  java.lang.String getDublinCoreParameter(java.lang.String name)
           
protected  org.apache.lenya.cms.publication.Document getInitialDocument()
          If the document created in the usecase shall have initial contents copied from an existing document, construct that document in this method.
protected  org.apache.lenya.cms.publication.Document getNewDocument()
           
protected abstract  java.lang.String getNewDocumentName()
           
protected abstract  java.lang.String getNewDocumentPath()
           
protected  org.apache.lenya.cms.repository.Node[] getNodesToLock()
           
protected  org.apache.lenya.cms.publication.Publication getPublication()
          Access to the current publication.
protected  org.apache.lenya.cms.publication.Document getSourceDocument()
           
protected abstract  java.lang.String getSourceExtension()
           
protected  boolean getVisibleInNav()
           
protected  void initParameters()
           
protected  void initSampleParameters()
           
protected  boolean isPathValid()
          This method is used by doCheckExecutionConditions() to check if the path entered by the user is valid.
protected  void setDublinCoreParameter(java.lang.String name, java.lang.String value)
           
protected  void setMetaData(org.apache.lenya.cms.publication.Document document)
          Sets the meta data of the created document.
 
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, doCheckPostconditions, doInitialize, dumpErrorMessages, execute, getBooleanCheckboxParameter, getContext, getDocumentFactory, getErrorMessages, getExitQueryString, getInfoMessages, getName, getParameter, getParameter, getParameterAsBoolean, getParameterAsInteger, getParameterAsString, getParameterAsString, getParameterNames, getParameters, getPart, getSession, getSourceURL, getStateMachine, getTargetURL, getView, hasErrors, hasInfoMessages, initialize, initializeParametersIfNotDone, isOptimistic, lockInvolvedObjects, lockInvolvedObjects, prepareView, service, setDefaultTargetURL, 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

RESOURCE_TYPES

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

LANGUAGE

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

LANGUAGES

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

PATH

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

NODE_NAME

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

VISIBLEINNAV

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

SAMPLE

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

SAMPLES

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

DUBLIN_CORE_PREFIX

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

Create

public Create()
Ctor.

Method Detail

doCheckPreconditions

protected void doCheckPreconditions()
                             throws java.lang.Exception
Overrides:
doCheckPreconditions in class org.apache.lenya.cms.usecase.AbstractUsecase
Throws:
java.lang.Exception
See Also:
AbstractUsecase.doCheckPreconditions()

getNodesToLock

protected org.apache.lenya.cms.repository.Node[] getNodesToLock()
                                                         throws org.apache.lenya.cms.usecase.UsecaseException
Overrides:
getNodesToLock in class org.apache.lenya.cms.usecase.AbstractUsecase
Throws:
org.apache.lenya.cms.usecase.UsecaseException
See Also:
AbstractUsecase.getNodesToLock()

doCheckExecutionConditions

protected void doCheckExecutionConditions()
                                   throws java.lang.Exception
Overrides:
doCheckExecutionConditions in class org.apache.lenya.cms.usecase.AbstractUsecase
Throws:
java.lang.Exception
See Also:
AbstractUsecase.doCheckExecutionConditions()

isPathValid

protected boolean isPathValid()
This method is used by doCheckExecutionConditions() to check if the path entered by the user is valid. If not, checking the existence of the new document in the site structure is omitted because this operation could cause errors.

Returns:
A boolean value.

doExecute

protected void doExecute()
                  throws java.lang.Exception
Overrides:
doExecute in class org.apache.lenya.cms.usecase.AbstractUsecase
Throws:
java.lang.Exception
See Also:
AbstractUsecase.doExecute()

getDublinCoreParameter

protected java.lang.String getDublinCoreParameter(java.lang.String name)

setDublinCoreParameter

protected void setDublinCoreParameter(java.lang.String name,
                                      java.lang.String value)

createVersion

protected abstract boolean createVersion()

getSourceExtension

protected abstract java.lang.String getSourceExtension()
Returns:
the extension to use for the document source.

getNewDocumentName

protected abstract java.lang.String getNewDocumentName()
Returns:
the name of the document being created in the usecase

getNewDocumentPath

protected abstract java.lang.String getNewDocumentPath()
Returns:
the id of the new document being created in the usecase

getInitialDocument

protected org.apache.lenya.cms.publication.Document getInitialDocument()
If the document created in the usecase shall have initial contents copied from an existing document, construct that document in this method.

Returns:
A document.

getDocumentTypeName

protected abstract java.lang.String getDocumentTypeName()
Returns:
The type of the created document.

setMetaData

protected void setMetaData(org.apache.lenya.cms.publication.Document document)
                    throws org.apache.lenya.cms.metadata.MetaDataException
Sets the meta data of the created document.

Parameters:
document - The document.
Throws:
org.apache.lenya.cms.metadata.MetaDataException - if an error occurs.

initParameters

protected void initParameters()
Overrides:
initParameters in class org.apache.lenya.cms.usecase.AbstractUsecase
See Also:
AbstractUsecase.initParameters()

initSampleParameters

protected void initSampleParameters()

getSourceDocument

protected org.apache.lenya.cms.publication.Document getSourceDocument()
Returns:
The source document or null if the usecase was not invoked on a document.

getNewDocument

protected org.apache.lenya.cms.publication.Document getNewDocument()
Returns:
The new document.

getArea

public java.lang.String getArea()
Returns:
The area without the "info-" prefix.

getPublication

protected org.apache.lenya.cms.publication.Publication getPublication()
Access to the current publication. Use this when the publication is not yet known in the usecase: e.g. when creating a global asset. When adding a resource or a child to a document, access the publication via that document's interface instead.

Returns:
the publication in which the use-case is being executed

getVisibleInNav

protected boolean getVisibleInNav()
Returns:
the visibleInNav Attribute of the document being created in the usecase


Copyright © $ Apache Software Foundation. All Rights Reserved.