org.apache.cocoon.forms.transformation
Class FormsPipelineConfig

java.lang.Object
  extended byorg.apache.cocoon.forms.transformation.FormsPipelineConfig

public class FormsPipelineConfig
extends Object

Version:
$Id: FormsPipelineConfig.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Nested Class Summary
static class FormsPipelineConfig.FormsVariables
           
 
Field Summary
static String CFORMSKEY
          Default key under which the Cocoon Forms form instance is stored in the JXPath context.
 
Method Summary
 void addFormAttributes(AttributesImpl attrs)
           
static FormsPipelineConfig createConfig(Map objectModel, Parameters parameters)
          Creates and initializes a FormsPipelineConfig object based on the passed arguments of the setup() of the specific Pipeline-component.
 Object evaluateExpression(String expression)
          Evaluates the passed xpath expression using the internal jxpath context holding the declared variables: continuation: as made available by flowscript request: as present in the cocoon processing environment session: as present in the cocoon processing environment parameters: as present in the cocoon sitemap node of the pipeline component
 Form findForm()
          Overloads findForm(String) by setting the jxpath-expression to null
 Form findForm(String jxpathExpression)
          Finds the form from the current request-context based on the settings of this configuration object.
 String getFormAction()
          The value for the wi:form-generated/@action.
 Attributes getFormAttributes()
          The grouped attributes to set on the wi:form-generated element.
 String getFormMethod()
          The value for the wi:form-generated/@method.
 Locale getLocale()
           
 Locale getLocaleParameter()
           
 void setFormMethod(String method)
          Sets the form method to use in the generator/transformer that uses this.
 void setLocale(Locale locale)
           
 String translateText(String original)
          Replaces JXPath expressions embedded inside #{ and } by their value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CFORMSKEY

public static final String CFORMSKEY
Default key under which the Cocoon Forms form instance is stored in the JXPath context.

See Also:
Constant Field Values
Method Detail

createConfig

public static FormsPipelineConfig createConfig(Map objectModel,
                                               Parameters parameters)
Creates and initializes a FormsPipelineConfig object based on the passed arguments of the setup() of the specific Pipeline-component.

Parameters:
objectModel - the objectmodel as passed in the setup()
parameters - the parameters as passed in the setup()
Returns:
an instance of FormsPipelineConfig initialized according to the settings in the sitemap.

findForm

public Form findForm()
              throws SAXException
Overloads findForm(String) by setting the jxpath-expression to null

Throws:
SAXException

findForm

public Form findForm(String jxpathExpression)
              throws SAXException
Finds the form from the current request-context based on the settings of this configuration object. The fall-back search-procedure is as follows:
  1. Use the provided jxpathExpression (if not null)
  2. Use the setting of the 'attribute-name' parameter on the request
  3. Obtain the form from it's default location in the flow context

Parameters:
jxpathExpression - that should be pointing to the form
Returns:
the found form if found
Throws:
SAXException - in any of the following cases:
  • The provided jxpathExpression (if not null) not point to a Form instance.
  • The request is not holding a Form instance under the key specified by 'attribute-name' (if specified)
  • Both jxpathExpression and 'attribute-name' were not specified AND also the default location was not holding a valid Form instance.

translateText

public String translateText(String original)
Replaces JXPath expressions embedded inside #{ and } by their value. This will parse the passed String looking for #{} occurences and then uses the evaluateExpression(String) to evaluate the found expression.

Returns:
the original String with it's #{}-parts replaced by the evaulated results.

evaluateExpression

public Object evaluateExpression(String expression)
Evaluates the passed xpath expression using the internal jxpath context holding the declared variables:
  1. continuation: as made available by flowscript
  2. request: as present in the cocoon processing environment
  3. session: as present in the cocoon processing environment
  4. parameters: as present in the cocoon sitemap node of the pipeline component

Parameters:
expression -
Returns:
the object-value resulting the expression evaluation.

getLocale

public Locale getLocale()

setLocale

public void setLocale(Locale locale)

getLocaleParameter

public Locale getLocaleParameter()

getFormAction

public String getFormAction()
The value for the wi:form-generated/@action. Note: wi:form-template copies this from its wt:form-template counterpart.

Returns:
the translateText(String) result of the 'form-action' sitemap parameter to the pipeline component, or null if that parameter was not set.

getFormMethod

public String getFormMethod()
The value for the wi:form-generated/@method. Note: wi:form-template copies this from its wt:form-template counterpart.

Returns:
the value of the 'form-method' sitemap parameter to the pipeline component. (or 'null' if it was not set.)

setFormMethod

public void setFormMethod(String method)
Sets the form method to use in the generator/transformer that uses this.

Parameters:
method - to use in the generated form should be "POST", "GET" or null

getFormAttributes

public Attributes getFormAttributes()
The grouped attributes to set on the wi:form-generated element. Note: wi:form-template copies this from its wt:form-template counterpart.

See Also:
getFormAction(), getFormMethod()

addFormAttributes

public void addFormAttributes(AttributesImpl attrs)


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.