net.jspcontrols.dialogs.actions.crud
Interface ICRUDForm

All Known Implementing Classes:
CRUDForm

public interface ICRUDForm

this interface must be implemented by an action form, which handles CRUD events.

Author:
Michael Jouravlev

Field Summary
static java.lang.String CRUD_UI_MODE_EDIT
          Editing UI mode: business data must have been already created or loaded.
static java.lang.String CRUD_UI_MODE_INACTIVE
          Default UI mode: no business data loaded.
static java.lang.String CRUD_UI_MODE_NEW
          Creating and editing of a new item.
static java.lang.String CRUD_UI_MODE_READONLY
          View-only UI mode: business data must have been already created or loaded.
static java.lang.String CRUD_UI_MODE_UPDATE
          Editing an existing item.
 
Method Summary
 void changeCrudUIMode(java.lang.String mode)
          Sets UI mode.
 org.apache.struts.action.ActionMessages crudCancel()
          Cancels process of updating existing or new item.
 org.apache.struts.action.ActionMessages crudClose()
          Closes preview from of existing item.
 org.apache.struts.action.ActionMessages crudCreate()
          Creates new business data
 org.apache.struts.action.ActionMessages crudDelete()
          Deletes business data from underlying persistent layer
 org.apache.struts.action.ActionMessages crudDuplicate()
          Duplicates new business data from existing object
 org.apache.struts.action.ActionMessages crudLoadForPreview()
          Load business data from persistence layer into the action form or into nested property of action form, and switches to view mode.
 org.apache.struts.action.ActionMessages crudLoadForUpdate()
          Load business data from persistence layer into the action form or into nested property of action form, and switches to edit mode.
 org.apache.struts.action.ActionMessages crudReset()
          Resets content of existing form.
 org.apache.struts.action.ActionMessages crudStore()
          Stores business data in the persistence layer.
 java.lang.String getCrudUIMode()
          Returns current UI mode for this action form.
 

Field Detail

CRUD_UI_MODE_INACTIVE

public static final java.lang.String CRUD_UI_MODE_INACTIVE
Default UI mode: no business data loaded. Operations allowed in this mode:

See Also:
Constant Field Values

CRUD_UI_MODE_EDIT

public static final java.lang.String CRUD_UI_MODE_EDIT
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: For finer control of edit state see CRUD_UI_MODE_UPDATE and CRUD_UI_MODE_NEW. Whenever one of these two states is set, this state must be true as well.

See Also:
CRUD_UI_MODE_UPDATE, CRUD_UI_MODE_NEW, Constant Field Values

CRUD_UI_MODE_NEW

public static final java.lang.String CRUD_UI_MODE_NEW
Creating and editing of a new item. Corresponding JSP should allow to save data. Operations allowed in this mode:

See Also:
CRUD_UI_MODE_UPDATE, CRUD_UI_MODE_EDIT, Constant Field Values

CRUD_UI_MODE_UPDATE

public static final java.lang.String CRUD_UI_MODE_UPDATE
Editing an existing item. Business data must have been loaded from persistent storage. Corresponding JSP should allow to change and save data. Operations allowed in this mode:

See Also:
CRUD_UI_MODE_EDIT, CRUD_UI_MODE_NEW, Constant Field Values

CRUD_UI_MODE_READONLY

public static final java.lang.String CRUD_UI_MODE_READONLY
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:

See Also:
Constant Field Values
Method Detail

changeCrudUIMode

public void changeCrudUIMode(java.lang.String mode)
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.

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.

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.

Parameters:
mode - UI mode for this action form
See Also:
CRUD_UI_MODE_INACTIVE, CRUD_UI_MODE_EDIT, CRUD_UI_MODE_READONLY

getCrudUIMode

public java.lang.String getCrudUIMode()
Returns current UI mode for this action form.

See Also:
CRUD_UI_MODE_INACTIVE, CRUD_UI_MODE_EDIT, CRUD_UI_MODE_READONLY

crudCreate

public org.apache.struts.action.ActionMessages crudCreate()
Creates new business data

Returns:
non-empty ActionMessages object if could not create item.

crudDuplicate

public org.apache.struts.action.ActionMessages crudDuplicate()
Duplicates new business data from existing object

Returns:
non-empty ActionMessages object if could not duplicate item.

crudLoadForUpdate

public org.apache.struts.action.ActionMessages crudLoadForUpdate()
Load business data from persistence layer into the action form or into nested property of action form, and switches to edit mode.

Returns:
non-empty ActionMessages object if could not load business item.

crudLoadForPreview

public org.apache.struts.action.ActionMessages crudLoadForPreview()
Load business data from persistence layer into the action form or into nested property of action form, and switches to view mode.

Returns:
non-empty ActionMessages object if could not load business item.

crudDelete

public org.apache.struts.action.ActionMessages crudDelete()
Deletes business data from underlying persistent layer

Returns:
non-empty ActionMessages object if could not delete item.

crudCancel

public org.apache.struts.action.ActionMessages crudCancel()
Cancels process of updating existing or new item. This method usually returns null.

Returns:
non-empty ActionMessages object if could not cancel update process.

crudReset

public org.apache.struts.action.ActionMessages crudReset()
Resets content of existing form. This method usually returns null.

Returns:
non-empty ActionMessages object if could not reset form.

crudClose

public org.apache.struts.action.ActionMessages crudClose()
Closes preview from of existing item. This method usually returns null.

Returns:
non-empty ActionMessages object if could not close view.

crudStore

public org.apache.struts.action.ActionMessages crudStore()
Stores business data in the persistence layer.

Returns:
non-empty ActionMessages object if could not store business data.