org.apache.lenya.cms.cocoon.transformation
Class WorkflowMenuTransformer

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.xml.AbstractXMLProducer
          extended by org.apache.cocoon.xml.AbstractXMLPipe
              extended by org.apache.cocoon.transformation.AbstractTransformer
                  extended by org.apache.cocoon.transformation.AbstractSAXTransformer
                      extended by org.apache.lenya.cms.cocoon.transformation.WorkflowMenuTransformer
All Implemented Interfaces:
org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.component.Component, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.cocoon.sitemap.SitemapModelComponent, org.apache.cocoon.transformation.Transformer, org.apache.cocoon.xml.XMLPipe, org.apache.cocoon.xml.XMLProducer, org.apache.excalibur.xml.sax.XMLConsumer, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler

public class WorkflowMenuTransformer
extends org.apache.cocoon.transformation.AbstractSAXTransformer

This transformer disables menu items (by removing the href attribute) which are not allowed with respect to the current workflow state.


Field Summary
static java.lang.String EVENT_ATTRIBUTE
          EVENT_ATTRIBUTE The event attribute
static java.lang.String ITEM_ELEMENT
          ITEM_ELEMENT The item element
static java.lang.String MENU_ELEMENT
          MENU_ELEMENT The menu element
 
Fields inherited from class org.apache.cocoon.transformation.AbstractSAXTransformer
context, defaultNamespaceURI, EMPTY_ATTRIBUTES, emptyAttributes, ignoreEmptyCharacters, ignoreEventsCount, ignoreHooksCount, ignoreWhitespaces, manager, namespaceURI, objectModel, parameters, recorderStack, request, resolver, response, source, stack
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.transformation.Transformer
ROLE
 
Constructor Summary
WorkflowMenuTransformer()
           
 
Method Summary
protected  boolean hasWorkflow()
          Returns if the current document has a workflow.
 void setHasWorkflow(boolean _hasWorkflow)
          Sets if the current document has a workflow.
 void setup(org.apache.cocoon.environment.SourceResolver _resolver, java.util.Map _objectModel, java.lang.String src, org.apache.avalon.framework.parameters.Parameters _parameters)
           
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String raw, org.xml.sax.Attributes attr)
          (non-Javadoc)
 
Methods inherited from class org.apache.cocoon.transformation.AbstractSAXTransformer
addRecorder, characters, comment, configure, dispose, endCDATA, endDocument, endDTD, endElement, endEntity, endParametersRecording, endParametersRecording, endPrefixMapping, endRecording, endSAXRecording, endSerializedXMLRecording, endTextRecording, endTransformingElement, findPrefixMapping, getMutableAttributes, ignorableWhitespace, processingInstruction, recycle, removeRecorder, sendEndElementEvent, sendEndElementEventNS, sendEndPrefixMapping, sendEvents, sendParametersEvents, sendStartElementEvent, sendStartElementEvent, sendStartElementEventNS, sendStartElementEventNS, sendStartPrefixMapping, sendTextEvent, service, setDocumentLocator, setupTransforming, skippedEntity, startCDATA, startDocument, startDTD, startEntity, startParametersRecording, startPrefixMapping, startRecording, startSAXRecording, startSerializedXMLRecording, startTextRecording, startTransformingElement
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
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
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

MENU_ELEMENT

public static final java.lang.String MENU_ELEMENT
MENU_ELEMENT The menu element

See Also:
Constant Field Values

ITEM_ELEMENT

public static final java.lang.String ITEM_ELEMENT
ITEM_ELEMENT The item element

See Also:
Constant Field Values

EVENT_ATTRIBUTE

public static final java.lang.String EVENT_ATTRIBUTE
EVENT_ATTRIBUTE The event attribute

See Also:
Constant Field Values
Constructor Detail

WorkflowMenuTransformer

public WorkflowMenuTransformer()
Method Detail

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String raw,
                         org.xml.sax.Attributes attr)
                  throws org.xml.sax.SAXException
(non-Javadoc)

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.apache.cocoon.transformation.AbstractSAXTransformer
Throws:
org.xml.sax.SAXException
See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

setup

public void setup(org.apache.cocoon.environment.SourceResolver _resolver,
                  java.util.Map _objectModel,
                  java.lang.String src,
                  org.apache.avalon.framework.parameters.Parameters _parameters)
           throws org.apache.cocoon.ProcessingException,
                  org.xml.sax.SAXException,
                  java.io.IOException
Specified by:
setup in interface org.apache.cocoon.sitemap.SitemapModelComponent
Overrides:
setup in class org.apache.cocoon.transformation.AbstractSAXTransformer
Throws:
org.apache.cocoon.ProcessingException
org.xml.sax.SAXException
java.io.IOException
See Also:
SitemapModelComponent.setup(org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)

hasWorkflow

protected boolean hasWorkflow()
Returns if the current document has a workflow.

Returns:
A boolean value.

setHasWorkflow

public void setHasWorkflow(boolean _hasWorkflow)
Sets if the current document has a workflow.

Parameters:
_hasWorkflow - A boolean value.


Copyright $ Apache Software Foundation. All Rights Reserved.