org.apache.lenya.cms.editors.tinymce
Class TinyMce

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
              extended by org.apache.lenya.cms.editors.tinymce.TinyMce
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

public class TinyMce
extends org.apache.lenya.cms.usecase.DocumentUsecase

TinyMce Usecase since there is no really tinymce-specific code in here, most methods should eventually be moved into DocumentUsecase and shared across all editor usecases.


Field Summary
 
Fields inherited from class org.apache.lenya.cms.usecase.DocumentUsecase
DOCUMENT, 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
TinyMce()
           
 
Method Summary
 void advance()
           
protected  void doCheckExecutionConditions()
           
protected  void doCheckPreconditions()
           
protected  void doExecute()
           
protected  java.lang.String getEncoding()
           
protected  java.lang.String getEvent()
          Add namespaces
protected  org.apache.lenya.cms.repository.Node[] getNodesToLock()
           
protected  org.w3c.dom.Document getXml()
           
protected  java.lang.String getXmlString(java.lang.String encoding)
           
protected  void initParameters()
           
protected  void saveDocument(java.lang.String encoding, java.lang.String content)
          Save the content to the document source.
protected  void validate(org.w3c.dom.Document xml)
           
 
Methods inherited from class org.apache.lenya.cms.usecase.DocumentUsecase
getSourceDocument, getSourceURL, getTargetDocument, getTargetURL, setDefaultTargetURL, setTargetDocument
 
Methods inherited from class org.apache.lenya.cms.usecase.AbstractUsecase
addErrorMessage, addErrorMessage, addErrorMessages, addInfoMessage, addInfoMessage, 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, getStateMachine, getView, hasErrors, hasInfoMessages, initialize, initializeParametersIfNotDone, 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
 

Constructor Detail

TinyMce

public TinyMce()
Method Detail

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()

initParameters

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

doCheckPreconditions

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

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()

getEncoding

protected java.lang.String getEncoding()

getXmlString

protected java.lang.String getXmlString(java.lang.String encoding)

advance

public void advance()
             throws org.apache.lenya.cms.usecase.UsecaseException
Specified by:
advance in interface org.apache.lenya.cms.usecase.Usecase
Overrides:
advance in class org.apache.lenya.cms.usecase.AbstractUsecase
Throws:
org.apache.lenya.cms.usecase.UsecaseException

doCheckExecutionConditions

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

validate

protected void validate(org.w3c.dom.Document xml)
                 throws java.lang.Exception
Throws:
java.lang.Exception

getXml

protected org.w3c.dom.Document getXml()
                               throws javax.xml.parsers.ParserConfigurationException,
                                      java.io.IOException
Throws:
javax.xml.parsers.ParserConfigurationException
java.io.IOException

saveDocument

protected void saveDocument(java.lang.String encoding,
                            java.lang.String content)
                     throws java.lang.Exception
Save the content to the document source. After saving, the XML is validated. If validation errors occur, the usecase transaction is rolled back, so the changes are not persistent. If the validation succeeded, the workflow event is invoked.

Parameters:
encoding - The encoding to use.
content - The content to save.
Throws:
java.lang.Exception - if an error occurs.

getEvent

protected java.lang.String getEvent()
Add namespaces

Parameters:
namespaces - The namespaces to add
content - The content to add them to
Returns:
The content with the added namespaces


Copyright $ Apache Software Foundation. All Rights Reserved.