org.apache.empire.struts2.websample.web.actiontypes
Class BeanDetailAction<T>

java.lang.Object
  extended by org.apache.empire.struts2.actionsupport.ActionBase
      extended by org.apache.empire.struts2.action.WebAction
          extended by org.apache.empire.struts2.websample.web.actiontypes.Action
              extended by org.apache.empire.struts2.websample.web.actiontypes.DetailAction
                  extended by org.apache.empire.struts2.websample.web.actiontypes.BeanDetailAction<T>
All Implemented Interfaces:
com.opensymphony.xwork2.interceptor.NoParameters, com.opensymphony.xwork2.LocaleProvider, com.opensymphony.xwork2.TextProvider, ActionAccessValidator, ActionErrorProvider, ActionItemProperty, Disposable, ExceptionAware, RequestParamProvider, SampleContext

public abstract class BeanDetailAction<T>
extends DetailAction
implements com.opensymphony.xwork2.interceptor.NoParameters

BeanDetailAction

This class allows using a JavaBean or Data Transfer Object (DTO) for form data processing. Metadata for the Beans should be provided using the BeanClass and BeanProperty classes.

Author:
Rainer

Field Summary
protected  BeanActionSupport<T> beanSupport
           
 
Fields inherited from class org.apache.empire.struts2.websample.web.actiontypes.DetailAction
INPUT, RETURN
 
Fields inherited from class org.apache.empire.struts2.websample.web.actiontypes.Action
log
 
Fields inherited from class org.apache.empire.struts2.action.WebAction
DEFAULT_ITEM_PROPERTY_NAME
 
Fields inherited from interface org.apache.empire.struts2.action.Disposable
EXITCODE_ERROR, EXITCODE_SUCCESS
 
Constructor Summary
BeanDetailAction(BeanClass beanClass, SessionPersistence persistence)
          Constructs a BeanDetailAction from a BeanClass definition
BeanDetailAction(BeanRecordProxy<T> record, SessionPersistence persistence)
          Constructs a BeanDetailAction from a BeanRecordProxy object
 
Method Summary
protected abstract  T createBean()
          Returns the bean for the supplied object key.
protected abstract  boolean deleteBean(java.lang.Object[] key)
          Deletes a bean object
 java.lang.String doCreate()
           
 java.lang.String doDelete()
           
 java.lang.String doLoad()
           
 java.lang.String doSave()
           
 Record getRecord()
          Returns the Record interface implmentation for the bean.
protected abstract  T loadBean(java.lang.Object[] key)
          Returns the bean for the supplied object key.
protected abstract  boolean saveBean(T bean, boolean isNew)
          Saves a bean object
 
Methods inherited from class org.apache.empire.struts2.websample.web.actiontypes.DetailAction
doCancel
 
Methods inherited from class org.apache.empire.struts2.websample.web.actiontypes.Action
getApplication, getConnection, getDatabase, getLocale, getRequest, getSession, getUser, loginRequired
 
Methods inherited from class org.apache.empire.struts2.action.WebAction
addFieldError, addItemError, clearActionErrors, clearItem, dispose, getActionParam, getActionURL, getItem, getItemErrors, getItemKey, getItemNewFlag, getItemPropertyName, getLastActionError, getLastActionMessage, getListPageSize, getLocalizedErrorMessage, getRequestArrayParam, getRequestIntParam, getRequestParam, getRequestParameters, getText, getText, getText, getText, getText, getText, getText, getText, getText, getTexts, getTexts, handleException, hasAccess, hasActionError, hasItem, hasKey, hasRequestParam, init, isNewItem, putRequestParam, setActionError, setActionError, setActionError, setActionError, setActionMessage, setItem
 
Methods inherited from class org.apache.empire.struts2.actionsupport.ActionBase
getActionBean, getActionBean, getActionBeanName, getActionObject, getActionObjectName, getRecordKeyExpr, getRecordKeyFromString, getRecordKeyString, getRecordKeyString, getRecordNewFlagFromString, putActionBean, putActionBean, putActionObject, removeActionBean, removeActionBean, removeActionObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

beanSupport

protected final BeanActionSupport<T> beanSupport
Constructor Detail

BeanDetailAction

public BeanDetailAction(BeanRecordProxy<T> record,
                        SessionPersistence persistence)
Constructs a BeanDetailAction from a BeanRecordProxy object

Parameters:
record - the BeanRecordProxy for the bean
persistence - persistence level

BeanDetailAction

public BeanDetailAction(BeanClass beanClass,
                        SessionPersistence persistence)
Constructs a BeanDetailAction from a BeanClass definition

Parameters:
beanClass - the bean class defining the bean's metadata
persistence - persistence level
Method Detail

getRecord

public Record getRecord()
Returns the Record interface implmentation for the bean.

Returns:
the Record interface implmentation for the bean.

doCreate

public java.lang.String doCreate()
Specified by:
doCreate in class DetailAction

doLoad

public java.lang.String doLoad()
Specified by:
doLoad in class DetailAction

doDelete

public java.lang.String doDelete()
Specified by:
doDelete in class DetailAction

doSave

public java.lang.String doSave()
Specified by:
doSave in class DetailAction

createBean

protected abstract T createBean()
Returns the bean for the supplied object key. If an error occurs the fuction must set an action error and return null.

Returns:
the bean object

loadBean

protected abstract T loadBean(java.lang.Object[] key)
Returns the bean for the supplied object key. If an error occurs the fuction must set an action error and return null.

Parameters:
key - the bean's key values
Returns:
the bean object

saveBean

protected abstract boolean saveBean(T bean,
                                    boolean isNew)
Saves a bean object

Parameters:
bean -
isNew - true the bean is a newly created object or false otherwise
Returns:
true if the bean has been stored sucessfully or false otherwise

deleteBean

protected abstract boolean deleteBean(java.lang.Object[] key)
Deletes a bean object

Parameters:
bean -
Returns:
true if the bean has been stored sucessfully or false otherwise


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