org.outerj.xreporter.report.instance
Class Condition

java.lang.Object
  extended byorg.outerj.xreporter.report.instance.InputField
      extended byorg.outerj.xreporter.report.instance.Condition
Direct Known Subclasses:
QbeCondition

public class Condition
extends InputField

A Condition in a report instance. This contains the chosen operator and the value or values of the condition.


Nested Class Summary
protected  class Condition.ValueEntry
           
 
Field Summary
protected static java.lang.String CONDITION_EL
           
protected  ConditionDefinition definition
           
protected static java.lang.String NAME_ATTR
           
protected  boolean noValue
          boolean to check whether the user has selected this condition.
protected  Operator operator
           
protected static java.lang.String OPERATOR_EL
           
protected static java.lang.String REQUIRED_ATTR
           
protected static java.lang.String SELECTED_ATTR
           
protected static java.lang.String VALID_ATTR
           
protected static java.lang.String VALID_MSG_ATTR
           
protected static java.lang.String VALUE_EL
           
protected  java.util.List values
           
protected static java.lang.String VALUES_EL
           
 
Constructor Summary
Condition(ConditionDefinition conditionDefinition)
           
 
Method Summary
 int bind(java.sql.PreparedStatement statement, int start, ExecutionContext reportContext)
           
protected  Condition.ValueEntry createRequiredValueEntry(ExecutionContext executionContext)
           
 void generateInfoSaxFragment(org.xml.sax.ContentHandler contentHandler, ExecutionContext executionContext, ResourceHandle resourceHandle)
          Similar to generateSaxFragment, but only contains the state of the inputfield, not other information like the datatype or validation errors.
 void generateSaxFragment(org.xml.sax.ContentHandler contentHandler, ExecutionContext executionContext, ResourceHandle resourceHandle)
          Generates a piece of SAX representing the state and metadata of this inputfield.
 int getArgumentCount()
           
 DataType getDataType()
           
 java.lang.String[] getFormattedValues(ResourceHandle resourceHandle)
          Returns the string representation of the values of this condition.
 java.lang.String getName()
           
 Operator getOperator()
           
 boolean hasValue()
           
 boolean isRequired()
           
 boolean isValid()
           
 void readStoredEntry(UserEntryStore userEntryStore, User user, ResourceHandle resourceHandle)
          Allows an inputfield to initialize itself using a previously stored value.
 void reset()
           
protected  void store(ReportState reportState, java.lang.String key, java.lang.String value)
           
 void storeEntry(UserEntryStore userEntryStore, User user)
          Allows an inputfield to store its value into the user entry store.
 void storeState(ReportState reportState)
           
 void submit(java.util.Map submitValues, ExecutionContext executionContext)
          Same as submit(values, executionContext, false).
 void submit(java.util.Map submitValues, ExecutionContext executionContext, boolean rawLocale)
          Submit (user input) values to this inputField.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

definition

protected ConditionDefinition definition

values

protected java.util.List values

operator

protected Operator operator

noValue

protected boolean noValue
boolean to check whether the user has selected this condition. Normally this could be checked by looking whether the values List is not empty, but there are also operators that don't take a value, so...


CONDITION_EL

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

VALUES_EL

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

VALUE_EL

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

NAME_ATTR

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

VALID_ATTR

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

VALID_MSG_ATTR

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

OPERATOR_EL

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

SELECTED_ATTR

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

REQUIRED_ATTR

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

Condition

public Condition(ConditionDefinition conditionDefinition)
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in class InputField

isRequired

public boolean isRequired()

generateSaxFragment

public void generateSaxFragment(org.xml.sax.ContentHandler contentHandler,
                                ExecutionContext executionContext,
                                ResourceHandle resourceHandle)
                         throws java.lang.Exception
Description copied from class: InputField
Generates a piece of SAX representing the state and metadata of this inputfield. For example, this could be its name, value, validation errors, information about the datatype. The methods startDocument and endDocument will not be called.

Specified by:
generateSaxFragment in class InputField
Throws:
java.lang.Exception

generateInfoSaxFragment

public void generateInfoSaxFragment(org.xml.sax.ContentHandler contentHandler,
                                    ExecutionContext executionContext,
                                    ResourceHandle resourceHandle)
                             throws org.xml.sax.SAXException
Description copied from class: InputField
Similar to generateSaxFragment, but only contains the state of the inputfield, not other information like the datatype or validation errors. Only inputfields that have a non-empty value will generate something here.

The purpose of this method is to include information about the InputFields on the output page. Hence this method should only be called after the containing step has been completed successfully.

Specified by:
generateInfoSaxFragment in class InputField
Throws:
org.xml.sax.SAXException

submit

public void submit(java.util.Map submitValues,
                   ExecutionContext executionContext,
                   boolean rawLocale)
Description copied from class: InputField
Submit (user input) values to this inputField. The Map can contain values for all inputFields, it is the responsiblity of the InputField implementation to take only the appropriate values from the map.

Specified by:
submit in class InputField
Parameters:
submitValues - a Map wherein the values are Strings.
rawLocale - ignore the user locale and use the built-in default locale

submit

public void submit(java.util.Map submitValues,
                   ExecutionContext executionContext)
Description copied from class: InputField
Same as submit(values, executionContext, false).

Specified by:
submit in class InputField

createRequiredValueEntry

protected Condition.ValueEntry createRequiredValueEntry(ExecutionContext executionContext)

isValid

public boolean isValid()
Specified by:
isValid in class InputField
Returns:
true if this input field has a valid value or if it has no value and is not required to have one.

hasValue

public boolean hasValue()
Specified by:
hasValue in class InputField
Returns:
true if this input field has a value.

getDataType

public DataType getDataType()
Specified by:
getDataType in class InputField

getOperator

public Operator getOperator()

getArgumentCount

public int getArgumentCount()

bind

public int bind(java.sql.PreparedStatement statement,
                int start,
                ExecutionContext reportContext)
         throws java.sql.SQLException
Throws:
java.sql.SQLException

reset

public void reset()
Specified by:
reset in class InputField

getFormattedValues

public java.lang.String[] getFormattedValues(ResourceHandle resourceHandle)
Returns the string representation of the values of this condition.

This method should only be called on a successfully validated condition!


readStoredEntry

public void readStoredEntry(UserEntryStore userEntryStore,
                            User user,
                            ResourceHandle resourceHandle)
                     throws UserEntryStoreException
Description copied from class: InputField
Allows an inputfield to initialize itself using a previously stored value.

Specified by:
readStoredEntry in class InputField
Throws:
UserEntryStoreException

storeEntry

public void storeEntry(UserEntryStore userEntryStore,
                       User user)
                throws UserEntryStoreException
Description copied from class: InputField
Allows an inputfield to store its value into the user entry store.

Specified by:
storeEntry in class InputField
Throws:
UserEntryStoreException

storeState

public void storeState(ReportState reportState)
Specified by:
storeState in class InputField

store

protected void store(ReportState reportState,
                     java.lang.String key,
                     java.lang.String value)