com.dakuupa.struts.crud
Class CrudAction<T extends CrudModel>

java.lang.Object
  extended by com.opensymphony.xwork2.ActionSupport
      extended by com.dakuupa.struts.crud.CrudAction<T>
All Implemented Interfaces:
com.opensymphony.xwork2.Action, com.opensymphony.xwork2.LocaleProvider, com.opensymphony.xwork2.ModelDriven<T>, com.opensymphony.xwork2.TextProvider, com.opensymphony.xwork2.Validateable, com.opensymphony.xwork2.ValidationAware, Serializable, org.apache.struts2.interceptor.ServletRequestAware, org.apache.struts2.interceptor.SessionAware

public abstract class CrudAction<T extends CrudModel>
extends com.opensymphony.xwork2.ActionSupport
implements org.apache.struts2.interceptor.SessionAware, org.apache.struts2.interceptor.ServletRequestAware, com.opensymphony.xwork2.ModelDriven<T>

Author:
etwilliams
See Also:
Serialized Form

Field Summary
static String CREATE_ACTION
           
static String CREATE_RELOAD_ACTION
           
static String DELETE_ACTION
           
static String LIST_ACTION
           
protected  Logger logger
           
protected  T model
           
static String RELOAD_ACTION
           
protected  javax.servlet.http.HttpServletRequest request
           
protected  Map session
           
static String UPDATE_ACTION
           
static String UPDATE_RELOAD_ACTION
           
 
Fields inherited from class com.opensymphony.xwork2.ActionSupport
LOG
 
Fields inherited from interface com.opensymphony.xwork2.Action
ERROR, INPUT, LOGIN, NONE, SUCCESS
 
Constructor Summary
CrudAction()
           
 
Method Summary
 void addErrorMessage(String msg)
           
 void addHelpMessage(String msg)
           
 void addInfoMessage(String msg)
           
 void addSuccessMessage(String msg)
           
 void addWarningMessage(String msg)
           
protected abstract  int create()
           
protected  void createReload()
           
protected abstract  boolean delete()
           
protected  String doAction()
           
 String execute()
           
 T getModel()
           
 Map getSession()
           
protected  void list()
           
protected  void postAction(String returnValue)
           
protected  void preAction()
           
protected  String processForm()
           
protected abstract  void read()
           
 void setServletRequest(javax.servlet.http.HttpServletRequest req)
           
 void setSession(Map<String,Object> session)
           
protected abstract  void update()
           
protected  void updateReload()
           
protected  boolean validateForm()
           
 
Methods inherited from class com.opensymphony.xwork2.ActionSupport
addActionError, addActionMessage, addFieldError, clearActionErrors, clearErrors, clearErrorsAndMessages, clearFieldErrors, clearMessages, clone, doDefault, getActionErrors, getActionMessages, getErrorMessages, getErrors, getFieldErrors, getLocale, getText, getText, getText, getText, getText, getText, getText, getText, getText, getTexts, getTexts, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, hasKey, input, pause, setActionErrors, setActionMessages, setContainer, setFieldErrors, validate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

request

protected javax.servlet.http.HttpServletRequest request

model

protected T extends CrudModel model

session

protected Map session

logger

protected Logger logger

LIST_ACTION

public static final String LIST_ACTION
See Also:
Constant Field Values

CREATE_ACTION

public static final String CREATE_ACTION
See Also:
Constant Field Values

UPDATE_ACTION

public static final String UPDATE_ACTION
See Also:
Constant Field Values

DELETE_ACTION

public static final String DELETE_ACTION
See Also:
Constant Field Values

RELOAD_ACTION

public static final String RELOAD_ACTION
See Also:
Constant Field Values

CREATE_RELOAD_ACTION

public static final String CREATE_RELOAD_ACTION
See Also:
Constant Field Values

UPDATE_RELOAD_ACTION

public static final String UPDATE_RELOAD_ACTION
See Also:
Constant Field Values
Constructor Detail

CrudAction

public CrudAction()
Method Detail

execute

public String execute()
               throws Exception
Specified by:
execute in interface com.opensymphony.xwork2.Action
Overrides:
execute in class com.opensymphony.xwork2.ActionSupport
Throws:
Exception

doAction

protected String doAction()

preAction

protected void preAction()

postAction

protected void postAction(String returnValue)

processForm

protected String processForm()

create

protected abstract int create()

read

protected abstract void read()

update

protected abstract void update()

delete

protected abstract boolean delete()

list

protected void list()

createReload

protected void createReload()

updateReload

protected void updateReload()

validateForm

protected boolean validateForm()

addHelpMessage

public final void addHelpMessage(String msg)

addSuccessMessage

public final void addSuccessMessage(String msg)

addInfoMessage

public final void addInfoMessage(String msg)

addWarningMessage

public final void addWarningMessage(String msg)

addErrorMessage

public final void addErrorMessage(String msg)

setServletRequest

public void setServletRequest(javax.servlet.http.HttpServletRequest req)
Specified by:
setServletRequest in interface org.apache.struts2.interceptor.ServletRequestAware

getModel

public T getModel()
Specified by:
getModel in interface com.opensymphony.xwork2.ModelDriven<T extends CrudModel>

getSession

public Map getSession()

setSession

public void setSession(Map<String,Object> session)
Specified by:
setSession in interface org.apache.struts2.interceptor.SessionAware


Copyright © 2012. All Rights Reserved.