org.apache.empire.struts2.actionsupport
Class BeanActionSupport<T>

java.lang.Object
  extended by org.apache.empire.commons.ErrorObject
      extended by org.apache.empire.struts2.actionsupport.FormActionSupport
          extended by org.apache.empire.struts2.actionsupport.RecordFormActionSupport
              extended by org.apache.empire.struts2.actionsupport.BeanActionSupport<T>
All Implemented Interfaces:
org.apache.empire.commons.ErrorInfo

public class BeanActionSupport<T>
extends RecordFormActionSupport

BeanActionSupport

This class provides functions for form data processing through ordinary JavaBean or Data Transfer Objects (DTO). Metadata for the Beans should be provided using the BeanClass and BeanProperty classes.
It is recommended (but not necessary) to create a subclass of the BeanRecordProxy class in order to provide further context specific metadata.

Author:
Rainer

Constructor Summary
BeanActionSupport(ActionBase action, org.apache.empire.data.bean.BeanClass beanClass, SessionPersistence persistence)
           
BeanActionSupport(ActionBase action, org.apache.empire.data.bean.BeanClass beanClass, SessionPersistence persistence, java.lang.String propertyName)
           
BeanActionSupport(ActionBase action, org.apache.empire.data.bean.BeanRecordProxy<T> record, SessionPersistence persistence)
           
BeanActionSupport(ActionBase action, org.apache.empire.data.bean.BeanRecordProxy<T> record, SessionPersistence persistence, java.lang.String propertyName)
           
BeanActionSupport(ActionBase action, java.util.List<org.apache.empire.data.Column> updateColumns, org.apache.empire.data.Column[] keyColumns, SessionPersistence persistence)
           
BeanActionSupport(ActionBase action, java.util.List<org.apache.empire.data.Column> updateColumns, org.apache.empire.data.Column[] keyColumns, SessionPersistence persistence, java.lang.String propertyName)
           
BeanActionSupport(ActionBase action, java.util.List<org.apache.empire.data.Column> updateColumns, org.apache.empire.data.Column keyColumn, SessionPersistence persistence)
           
 
Method Summary
 boolean checkKey()
          Checks wether the key supplied with the request is identical to the key of the current record.
 T getData()
          Gets the bean data.
 org.apache.empire.data.Record getRecord()
          returns the Record interface implementation for the bean
 java.lang.Object[] getRecordKeyValues()
          Returns the current key values of the bean attached to the record proxy.
 boolean initKeyColumns()
          Initializes the key columns of the current record from the action parameters.
 boolean isValid()
          Checks wether or not the record has a bean object attached
 void setData(T data)
          Sets the bean data.
 void updateSessionKey()
          Refreshes the record key stored on the session.
 
Methods inherited from class org.apache.empire.struts2.actionsupport.RecordFormActionSupport
getActionParamKey, getActionParamNewFlag, getPersistence, getRecordKeyString, getRequestFieldName, hasActionKey, isNewRecord, loadFormData
 
Methods inherited from class org.apache.empire.struts2.actionsupport.FormActionSupport
getRecordPropertyName, isEnableFieldErrors, setEnableFieldErrors
 
Methods inherited from class org.apache.empire.commons.ErrorObject
clearError, getErrorMessage, getErrorParams, getErrorSource, getErrorType, getMessage, hasError, isExceptionsEnabled, setExceptionsEnabled
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanActionSupport

public BeanActionSupport(ActionBase action,
                         org.apache.empire.data.bean.BeanRecordProxy<T> record,
                         SessionPersistence persistence,
                         java.lang.String propertyName)

BeanActionSupport

public BeanActionSupport(ActionBase action,
                         org.apache.empire.data.bean.BeanRecordProxy<T> record,
                         SessionPersistence persistence)

BeanActionSupport

public BeanActionSupport(ActionBase action,
                         org.apache.empire.data.bean.BeanClass beanClass,
                         SessionPersistence persistence,
                         java.lang.String propertyName)

BeanActionSupport

public BeanActionSupport(ActionBase action,
                         org.apache.empire.data.bean.BeanClass beanClass,
                         SessionPersistence persistence)

BeanActionSupport

public BeanActionSupport(ActionBase action,
                         java.util.List<org.apache.empire.data.Column> updateColumns,
                         org.apache.empire.data.Column[] keyColumns,
                         SessionPersistence persistence,
                         java.lang.String propertyName)

BeanActionSupport

public BeanActionSupport(ActionBase action,
                         java.util.List<org.apache.empire.data.Column> updateColumns,
                         org.apache.empire.data.Column[] keyColumns,
                         SessionPersistence persistence)

BeanActionSupport

public BeanActionSupport(ActionBase action,
                         java.util.List<org.apache.empire.data.Column> updateColumns,
                         org.apache.empire.data.Column keyColumn,
                         SessionPersistence persistence)
Method Detail

getRecord

public org.apache.empire.data.Record getRecord()
returns the Record interface implementation for the bean

Specified by:
getRecord in class RecordFormActionSupport

isValid

public boolean isValid()
Checks wether or not the record has a bean object attached

Returns:
true if the record has a bean associated with it or false otherwiese

getData

public T getData()
Gets the bean data.

Returns:
the bean data object

setData

public void setData(T data)
Sets the bean data. This can be a new or an existing object.

Parameters:
data - the bean data object

getRecordKeyValues

public java.lang.Object[] getRecordKeyValues()
Returns the current key values of the bean attached to the record proxy.


checkKey

public boolean checkKey()
Checks wether the key supplied with the request is identical to the key of the current record.


updateSessionKey

public void updateSessionKey()
Refreshes the record key stored on the session. This is required for new records when the key values have been set after saving. This function is only required if SessionPersistence.Key has been selected.


initKeyColumns

public boolean initKeyColumns()
Initializes the key columns of the current record from the action parameters.

Returns:
true if the key columns were set successfully of false otherwise