From: <jm...@us...> - 2005-07-11 07:13:21
|
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/dialogs/actions/crud In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/dialogs/actions/crud Added Files: CRUDAction.java CRUDConstants.java CRUDForm.java ICRUDForm.java Log Message: --- NEW FILE: CRUDAction.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.actions.crud; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMessages; import org.apache.struts.Globals; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.util.Map; import java.util.HashMap; import net.jspcontrols.dialogs.actions.DialogAction; /** * CRUDAction facilitates the processing of the common use case * of an interactive application: <strong>cr</strong>eation, * <strong>u</strong>pdate and <strong>d</strong>eletion of a * <em>business object</em> (BO). Business object is also called * <i>item</i></p> * * <p><code>CRUDAction</code> has the following features:</p> * <ul> * <li>Handler methods for CRUD events</li> * <li>States and state transitions for BO</li> * <li>Mappings for result pages</li> * </ul> * * <p>These features are ihnerited from DialogAction:</p> * <ul> * <li>Event-based input handling</li> * <li>Two-phase I/O processing (POST-redirect-GET)</li> * <li>Buffering and removal of error messages</li> * <li>Safe use of Reload browser button</li> * <li>Improved protection from double submits</li> * <li>Cleaner browser page history</li> * </ul> * * <p>CRUDAction has a notion of <em>current item</em>. It is an existing * item, which is being viewed or edited, or a new item, which just has been * created and is being filled out. In other words, current item is the item * we currently working with.</p> * * <p>If current item does not exist, <code>CRUDAction</code> is switched * to <code>inactive</code> state. It is possible to switch to one of two * active states, by doing one of the following:</p> * <ul> * <li>Create new item from scratch and start populating its properties.</li> * <li>Create new item duplicating its data from existing one, and change * some of its properties.</li> * <li>Edit existing item, updating some or all of its properties.</li> * <li>View existing item in read-only mode.</li> * <li>Delete existing item.</li> * </ul> * * <p>After we created a new item or started to edit an existing one, * CRUDAction switches to one of the active states: <code>editable</code> * or <code>readonly</code>. <code>Editable</code> state permits to update * item data. <code>Readonly</code> state is used for preview mode and may * help to optimize item caching.</p> * * <p>CRUDAction must be paired with a form bean, implementing ICRUDForm, * to deliver its full power. See sample code for an example of how * a concrete CRUDAction can be implemented</p> * * @author Michael Jouravlev */ public class CRUDAction extends DialogAction { /** * Returns the initialization key or initialization prefix. * Must start with the same prefix as dialog buttons. For example, * if dialog buttons start with "DIALOG-EVENT", then "DIALOG-EVENT-INIT" * is a good name for initilization key, while "DIALOG-INIT" is not. */ protected String getInitKey() { return "DIALOG-EVENT-INIT"; } /** * Maps submit button names to handler methods; also maps initialization * keys to initialization methods. Events, external to CRUDAction, * are considered initializing events, and therefore must start with * initialization prefix. For example, if initialization prefix * starts with "DIALOG-EVENT-INIT", then "DIALOG-EVENT-INIT-CREATE" * is a good key for "Create new business object" event, while * "DIALOG-EVENT-CREATE" is not. * <p> * If you do not want to use all CRUD handlers, and want to protect * yourself from calling unneeded handler, you can subclass this class, * and override this method. Then you define only mappings that you need. * @see CRUDAction#getInitKey */ protected Map getKeyMethodMap() { Map map = new HashMap(); // // Events external to CRUDaction; initialize business data // // Create new item map.put(getInitKey()+"-CREATE", "onCreate"); // Create new item from existing one map.put(getInitKey()+"-DUPLICATE", "onDuplicate"); // Update existing item map.put(getInitKey()+"-UPDATE", "onEdit"); // View existing item map.put(getInitKey()+"-VIEW", "onPreview"); // // Events, which are triggered within CRUDAction for current item // // Delete current item map.put("DIALOG-EVENT-DELETE", "onDelete"); // Cancel viewing or editing of current item map.put("DIALOG-EVENT-CANCEL", "onCancel"); // Persist changes of current item map.put("DIALOG-EVENT-SAVE", "onSave"); // Close preview mode of existing item map.put("DIALOG-EVENT-CLOSE", "onClose"); return map; } /************************************************************************** * Input phase handlers *************************************************************************/ /** * Creates new item. Calls associated action form to create new * business object and to initialize action form fields. In case of * error, messages are saved in the session and removed automatically * during render phase. * @return ActionForward object, identifying the target location. * Possible values are: CRUDConstants.MAPPING_ON_CREATE_SUCCESS if * new business object was created successfully, or * CRUDConstants.MAPPING_ON_CREATE_FAILURE if failed to create * new business object. * @see CRUDConstants#MAPPING_ON_CREATE_SUCCESS * @see CRUDConstants#MAPPING_ON_CREATE_FAILURE */ public ActionForward onCreate (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Create new business object (item) ICRUDForm crudForm = (ICRUDForm) form; ActionMessages messages = crudForm.crudCreate(); // Successfully created new object and initialized action form if ((messages == null) || messages.isEmpty()) { // Need to handle this "forward" object in struts-config.xml return mapping.findForward(CRUDConstants.MAPPING_ON_CREATE_SUCCESS); // On error save messages into session. Struts 1.2.6+ has // a special method for it; but this code saves errors directly // to session for compatibility with older Struts versions. } else { HttpSession session = request.getSession(); session.setAttribute(Globals.ERROR_KEY, messages); // Need to handle this "forward" object in struts-config.xml return mapping.findForward(CRUDConstants.MAPPING_ON_CREATE_FAILURE); } } /** * Creates new item based on existing item. Calls associated action form * to create new business object and to initialize action form fields, * using existing business data. In case of error, messages are saved * in the session and removed automatically during render phase. * @return ActionForward object, identifying the target location. * Possible values are: CRUDConstants.MAPPING_ON_DUPLICATE_SUCCESS * if new business object was created successfully, or * CRUDConstants.MAPPING_ON_DUPLICATE_FAILURE if failed to create * new business object. * @see CRUDConstants#MAPPING_ON_DUPLICATE_SUCCESS * @see CRUDConstants#MAPPING_ON_DUPLICATE_FAILURE */ public ActionForward onDuplicate (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ICRUDForm crudForm = (ICRUDForm) form; ActionMessages messages = crudForm.crudDuplicate(); if ((messages == null) || messages.isEmpty()) { return mapping.findForward(CRUDConstants.MAPPING_ON_DUPLICATE_SUCCESS); } else { HttpSession session = request.getSession(); session.setAttribute(Globals.ERROR_KEY, messages); return mapping.findForward(CRUDConstants.MAPPING_ON_DUPLICATE_FAILURE); } } /** * Updates existing item. Calls associated action form to load existing * business object from persistence layer. In case of error, messages * are saved in the session and removed automatically during render phase. * @return ActionForward object, identifying the target location. * Possible values are: CRUDConstants.MAPPING_ON_EDIT_SUCCESS * if existing business object was successfully prepared for * editing, or CRUDConstants.MAPPING_ON_LOAD_FAILURE if failed * to load existing business object from persistence layer. * @see CRUDConstants#MAPPING_ON_EDIT_SUCCESS * @see CRUDConstants#MAPPING_ON_LOAD_FAILURE */ public ActionForward onEdit (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ICRUDForm crudForm = (ICRUDForm) form; ActionMessages messages = crudForm.crudLoadForUpdate(); if ((messages == null) || messages.isEmpty()) { return mapping.findForward(CRUDConstants.MAPPING_ON_EDIT_SUCCESS); } else { HttpSession session = request.getSession(); session.setAttribute(Globals.ERROR_KEY, messages); return mapping.findForward(CRUDConstants.MAPPING_ON_LOAD_FAILURE); } } /** * Previews existing item. Calls associated action form to load existing * business object from persistence layer. In case of error, messages * are saved in the session and removed automatically during render phase. * @return ActionForward object, identifying the target location. * Possible values are: CRUDConstants.MAPPING_ON_NOEDIT_SUCCESS * if existing business object was successfully prepared for * viewing, or CRUDConstants.MAPPING_ON_LOAD_FAILURE if failed * to load existing business object from persistence layer. * @see CRUDConstants#MAPPING_ON_PREVIEW_SUCCESS * @see CRUDConstants#MAPPING_ON_LOAD_FAILURE */ public ActionForward onPreview (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ICRUDForm crudForm = (ICRUDForm) form; ActionMessages messages = crudForm.crudLoadForPreview(); if ((messages == null) || messages.isEmpty()) { return mapping.findForward(CRUDConstants.MAPPING_ON_PREVIEW_SUCCESS); } else { HttpSession session = request.getSession(); session.setAttribute(Globals.ERROR_KEY, messages); return mapping.findForward(CRUDConstants.MAPPING_ON_LOAD_FAILURE); } } /** * Deletes existing item. This is the only event which can be triggered * from all three CRUD modes: Inactive, Edit and Noedit. This method calls * associated action form to perform actual removal of business object * from persistence layer. In case of error, messages are saved in * the session and removed automatically during render phase. * @return ActionForward object, identifying the target location. * Possible values are: CRUDConstants.MAPPING_ON_DELETE_SUCCESS * if existing business object was successfully deleted, * or CRUDConstants.MAPPING_ON_DELETE_FAILURE if failed * to delete existing business object from persistence layer. * @see CRUDConstants#MAPPING_ON_DELETE_SUCCESS * @see CRUDConstants#MAPPING_ON_DELETE_FAILURE */ public ActionForward onDelete (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ICRUDForm crudForm = (ICRUDForm) form; ActionMessages messages = crudForm.crudDelete(); if ((messages == null) || messages.isEmpty()) { return mapping.findForward(CRUDConstants.MAPPING_ON_DELETE_SUCCESS); } else { HttpSession session = request.getSession(); session.setAttribute(Globals.ERROR_KEY, messages); return mapping.findForward(CRUDConstants.MAPPING_ON_DELETE_FAILURE); } } /** * Cancels filling it new item, or editing existing item without saving it. * This method calls associated action form to perform needed cleanup. * No messages are generated for this event. * @return ActionForward object, identifying the target location. * Created using CRUDConstants.MAPPING_ON_CANCEL mapping. * @see CRUDConstants#MAPPING_ON_CANCEL */ public ActionForward onCancel (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ICRUDForm crudForm = (ICRUDForm) form; crudForm.crudCancel(); return mapping.findForward(CRUDConstants.MAPPING_ON_CANCEL); } /** * Closes business item preview page. This method calls associated * action form to perform needed cleanup. No messages are generated * for this event. * @return ActionForward object, identifying the target location. * Created using CRUDConstants.MAPPING_ON_CLOSE mapping. * @see CRUDConstants#MAPPING_ON_CLOSE */ public ActionForward onClose (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ICRUDForm crudForm = (ICRUDForm) form; crudForm.crudClose(); return mapping.findForward(CRUDConstants.MAPPING_ON_CLOSE); } /** * Event handler for Save button, persists form data. Called during * input phase of two-phase I/O process. * <p> * Internally, this method calls two methods on associated form bean: * standard <code>validate</code> method to check input data, * and <code>crudStore</code> method to persist input data if it is valid. * <p> * Both form bean methods should return non-empty ActionMessages object * to signal that either validation or persisting was unsuccessful. * <p> * Since this method handles POST requests, the outcome mappings * for this method should use redirection to avoid double submit * situations and POSTDATA messages. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * @return an <code>ActionForward</code> instance describing where and how * control should be handed over, or <code>null</code> to reload * the same action using GET request. * @exception java.lang.Exception if an exception occurs */ public ActionForward onSave (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Every event handler must clean old error messages HttpSession session = request.getSession(); ICRUDForm crudForm = (ICRUDForm) form; // Validate input data ActionMessages messages = form.validate(mapping, request); // Input data is not valid if (messages != null && messages.size() > 0) { session.setAttribute(Globals.ERROR_KEY, messages); return mapping.findForward(CRUDConstants.MAPPING_ON_INVALID_DATA); // Input data is valid } else { // Try to persist form data ActionMessages storeMessages = crudForm.crudStore(); // Could not persist form data if (storeMessages != null && storeMessages.size() > 0) { session.setAttribute(Globals.ERROR_KEY, storeMessages); return mapping.findForward(CRUDConstants.MAPPING_ON_STORE_FAILURE); // Successfully persisted } else { return mapping.findForward(CRUDConstants.MAPPING_ON_STORE_SUCCESS); } } } /************************************************************************** * Rendering phase handler *************************************************************************/ /** * Returns an <code>ActionForward</code> instance describing the View * for current dialog state, usually a forward to a JSP page. * <p> * If you want to use the default implementation, define the View * under "DIALOG-VIEW" name in <forward> element of your action * mapping. * <p> * To use different mapping name, define the view in <forward> * element of your action mapping, and override this method to return * ActionForward object for your mapping name. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * * @exception java.lang.Exception if an exception occurs * @return ActionForward instance describing the View for dialog state */ public ActionForward getDialogView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // CRUDAction works with form beans, implementing ICRUDForm ICRUDForm crudForm = (ICRUDForm) form; String uiMode = crudForm.getCrudUIMode(); return mapping.findForward(uiMode); } } --- NEW FILE: CRUDConstants.java --- /* * Copyright 2004-2005 Michael Jouravlev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.actions.crud; /** * CRUD action constants, used in Struts Dialogs package. * * @author Michael Jouravlev */ public interface CRUDConstants { /************************************************************************** * First phase mappings: where to go after input data processed *************************************************************************/ /** * Successfully created empty BO (usually redirect to self for editing) */ String MAPPING_ON_CREATE_SUCCESS = "ON-CREATE-SUCCESS"; /** * Failed to create empty BO (redirect to error page) */ String MAPPING_ON_CREATE_FAILURE = "ON-CREATE-FAILURE"; /** * Successfully duplicated BO (usually redirect to self for editing) */ String MAPPING_ON_DUPLICATE_SUCCESS = "ON-DUPLICATE-SUCCESS"; /** * Failed to duplicate existing BO (redirect to error page) */ String MAPPING_ON_DUPLICATE_FAILURE = "ON-DUPLICATE-FAILURE"; /** * Successfully loaded existing BO and prepared for preview (usually redirect to self for viewing) */ String MAPPING_ON_PREVIEW_SUCCESS = "ON-PREVIEW"; /** * Successfully loaded existing BO and prepared for editing (usually redirect to self for editing) */ String MAPPING_ON_EDIT_SUCCESS = "ON-EDIT"; /** * Failed to load existing BO for preview or editing (redirect to error page) */ String MAPPING_ON_LOAD_FAILURE = "ON-LOAD-FAILURE"; /** * Successfully deleted existing BO (usually redirect to BO list or success page) */ String MAPPING_ON_DELETE_SUCCESS = "ON-DELETE-SUCCESS"; /** * Failed to delete existing BO (redirect to error page) */ String MAPPING_ON_DELETE_FAILURE = "ON-DELETE-FAILURE"; /** * Canceled editing existing BO or new BO */ String MAPPING_ON_CANCEL = "ON-CANCEL"; /** * Closed preview of existing BO */ String MAPPING_ON_CLOSE = "ON-CLOSE"; /** * Successfully stored new BO or changes to existing BO */ String MAPPING_ON_STORE_SUCCESS = "ON-STORE-SUCCESS"; /** * Failed to store new BO or changes to existing BO */ String MAPPING_ON_STORE_FAILURE = "ON-STORE-FAILURE"; /** * Input data is invalid (when form bean's validate() returns errors) */ String MAPPING_ON_INVALID_DATA = "ON-INVALID-DATA"; } --- NEW FILE: CRUDForm.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.actions.crud; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import javax.servlet.http.HttpServletRequest; /** * Base action form, paired to CRUDAction. You can subclass this form, * or copy and paste its fields and methods, if you subclassing another * form class. * * @author Michael Jouravlev */ public abstract class CRUDForm extends ActionForm implements ICRUDForm { /************************************************************************** * Standard fields and methods for every ICRUDForm implementation **************************************************************************/ /** * UI Mode */ private String uiMode; /** * Returns current UT mode * @see ICRUDForm#CRUD_UI_MODE_INACTIVE * @see ICRUDForm#CRUD_UI_MODE_EDITABLE * @see ICRUDForm#CRUD_UI_MODE_READONLY */ public String getCrudUIMode() {return uiMode;} /** * Sets current UT mode, used by business logic code. * @see ICRUDForm#CRUD_UI_MODE_INACTIVE * @see ICRUDForm#CRUD_UI_MODE_EDITABLE * @see ICRUDForm#CRUD_UI_MODE_READONLY */ public void changeCrudUIMode(String mode) { this.uiMode = mode; } /** * Constructs CRUD form. UI Mode must be set to CRUD_UI_MODE_INACTIVE, * because no actual data is created or loaded yet. */ public CRUDForm() { uiMode = ICRUDForm.CRUD_UI_MODE_INACTIVE; } /** * Resets action form. Clear checkboxes here. This method is called before * form fields are populated, so here you can check request type, scope * and other action form parameters. * * @param mapping The ActionMapping used to select this instance * @param request The HTTP request we are processing */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); // This form must have session scope to store CRUD data if (!"session".equalsIgnoreCase(mapping.getScope())) { throw new IllegalStateException("Action " + mapping.getPath() + "should have session scope"); } } } --- NEW FILE: ICRUDForm.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.actions.crud; import org.apache.struts.action.ActionMessages; /** * this interface must be implemented by an action form, which handles CRUD events. * * @author Michael Jouravlev */ public interface ICRUDForm { /************************************************************************** * View Mode **************************************************************************/ /** * Default UI mode: no business data loaded. Operations allowed * in this mode: * <ul> * <li>Create New Item (create -> CRUD_UI_MODE_EDIT mode) * <li>Create Item From (Duplicate -> CRUD_UI_MODE_EDIT mode) * <li>Update Item (load -> CRUD_UI_MODE_EDIT mode) * <li>View Item (load -> CRUD_UI_MODE_NOEDIT mode) * </ul> */ public static final String CRUD_UI_MODE_INACTIVE = "CRUD-UI-MODE-INACTIVE"; /** * Editing UI mode: business data must have been already created * or loaded. Corresponding JSP should allow to change and save data. * Operations allowed in this mode: * <ul> * <li>Delete (delete -> CRUD-ON-DELETE-SUCCESS/CRUD-ON-DELETE-ERROR) * <li>Cancel (cancel -> CRUD-ON-CANCEL) * <li>Save (store -> CRUD-ON-STORE-SUCCESS/CRUD-ON-STORE-ERROR) * </ul> */ public static final String CRUD_UI_MODE_EDITABLE = "CRUD-UI-MODE-EDITABLE"; /** * View-only UI mode: business data must have been already created * or loaded. Corresponding JSP should not allow to change and save data. * Operations allowed in this mode: * <ul> * <li>Delete (delete -> CRUD-ON-DELETE-SUCCESS/CRUD-ON-DELETE-ERROR) * <li>Close (close -> CRUD-ON-CLOSE) * </ul> */ public static final String CRUD_UI_MODE_READONLY = "CRUD-UI-MODE-READONLY"; /** * Sets UI mode. Default mode is CRUD_VIEW_MODE_INACTIVE. In this mode * action form either does not contain data, or data is undefined state. * Thus, editing, viewing, and storing form data is prohibited. * <p> * Once new data is loaded from persistent storage, or created, mode * should be changed to either CRUD_VIEW_MODE_EDIT or CRUD_VIEW_MODE_NOEDIT * which allow to view/edit/delete/save the data. * <p> * After data is saved or edit mode is canceled, view mode should be * chaged back to CRUD_VIEW_MODE_INACTIVE to prevent responding to a browser * with a stale page, or accepting data from a stale page. * * @param mode UI mode for this action form * @see ICRUDForm#CRUD_UI_MODE_INACTIVE * @see ICRUDForm#CRUD_UI_MODE_EDITABLE * @see ICRUDForm#CRUD_UI_MODE_READONLY */ void changeCrudUIMode(String mode); /** * Returns current UI mode for this action form. * @see ICRUDForm#CRUD_UI_MODE_INACTIVE * @see ICRUDForm#CRUD_UI_MODE_EDITABLE * @see ICRUDForm#CRUD_UI_MODE_READONLY */ String getCrudUIMode(); /************************************************************************** * Business Object event handling **************************************************************************/ /** * Creates new business data * @return non-empty ActionMessages object if could not create item. */ ActionMessages crudCreate(); /** * Duplicates new business data from existing object * @return non-empty ActionMessages object if could not duplicate item. */ ActionMessages crudDuplicate(); /** * Load business data from persistence layer into the action form or * into nested property of action form, and switches to edit mode. * @return non-empty ActionMessages object if could not load business item. */ ActionMessages crudLoadForUpdate(); /** * Load business data from persistence layer into the action form or * into nested property of action form, and switches to view mode. * @return non-empty ActionMessages object if could not load business item. */ ActionMessages crudLoadForPreview(); /** * Deletes business data from underlying persistent layer * @return non-empty ActionMessages object if could not delete item. */ ActionMessages crudDelete(); /** * Cancels process of updating existing or new item. This method usually * returns null. * @return non-empty ActionMessages object if could not cancel update process. */ ActionMessages crudCancel(); /** * Closes preview from of existing item. This method usually returns null. * @return non-empty ActionMessages object if could not close view. */ ActionMessages crudClose(); /** * Stores business data in the persistence layer. * @return non-empty ActionMessages object if could not store business data. */ ActionMessages crudStore(); } |