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

java.lang.Object
  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>

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

Field Summary
 
Fields inherited from class org.apache.empire.struts2.actionsupport.RecordFormActionSupport
persistence
 
Fields inherited from class org.apache.empire.struts2.actionsupport.FormActionSupport
action, log, propertyName
 
Constructor Summary
BeanActionSupport(ActionBase action, BeanClass beanClass, SessionPersistence persistence)
           
BeanActionSupport(ActionBase action, BeanClass beanClass, SessionPersistence persistence, String propertyName)
           
BeanActionSupport(ActionBase action, BeanRecordProxy<T> record, SessionPersistence persistence)
           
BeanActionSupport(ActionBase action, BeanRecordProxy<T> record, SessionPersistence persistence, String propertyName)
           
BeanActionSupport(ActionBase action, List<Column> updateColumns, Column[] keyColumns, SessionPersistence persistence)
           
BeanActionSupport(ActionBase action, List<Column> updateColumns, Column[] keyColumns, SessionPersistence persistence, String propertyName)
           
BeanActionSupport(ActionBase action, List<Column> updateColumns, 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.
 Record getRecord()
          returns the Record interface implementation for the bean
 Object[] getRecordKeyValues()
          Returns the current key values of the bean attached to the record proxy.
 void 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
compareKey, getActionParamKey, getActionParamNewFlag, getPersistence, getRecordFromSession, getRecordKeyString, getRequestFieldName, hasActionKey, isNewRecord, loadFormData, persistOnSession, removeFromSession, setRecordFieldValue, setUpdateFields
 
Methods inherited from class org.apache.empire.struts2.actionsupport.FormActionSupport
addFieldError, getActionParam, getRecordPropertyName, isEnableFieldErrors, setEnableFieldErrors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanActionSupport

public BeanActionSupport(ActionBase action,
                         BeanRecordProxy<T> record,
                         SessionPersistence persistence,
                         String propertyName)

BeanActionSupport

public BeanActionSupport(ActionBase action,
                         BeanRecordProxy<T> record,
                         SessionPersistence persistence)

BeanActionSupport

public BeanActionSupport(ActionBase action,
                         BeanClass beanClass,
                         SessionPersistence persistence,
                         String propertyName)

BeanActionSupport

public BeanActionSupport(ActionBase action,
                         BeanClass beanClass,
                         SessionPersistence persistence)

BeanActionSupport

public BeanActionSupport(ActionBase action,
                         List<Column> updateColumns,
                         Column[] keyColumns,
                         SessionPersistence persistence,
                         String propertyName)

BeanActionSupport

public BeanActionSupport(ActionBase action,
                         List<Column> updateColumns,
                         Column[] keyColumns,
                         SessionPersistence persistence)

BeanActionSupport

public BeanActionSupport(ActionBase action,
                         List<Column> updateColumns,
                         Column keyColumn,
                         SessionPersistence persistence)
Method Detail

getRecord

public 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 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 void initKeyColumns()
Initializes the key columns of the current record from the action parameters.



Copyright © 2008-2012 Apache Software Foundation. All Rights Reserved.