org.figure8.join.control.action
Class ResourceActions

java.lang.Object
  extended by org.apache.struts.action.Action
      extended by org.figure8.join.control.JoinAction
          extended by org.figure8.join.control.action.ResourceActions
Direct Known Subclasses:
GatewayActions

public class ResourceActions
extends JoinAction

This is a Struts action for managing all operations related to AbstractResource entities.

Version:
$Revision: 1.2 $
Author:
Laurent Broudoux

Field Summary
static java.lang.String CHANGES_OP
          Operation code for getting resource configuration changes for tracking period
static java.lang.String CONFIG_OP
          Operation code for getting resource configuration details at specified date
static java.lang.String DUPLICATE_RESOURCE_KEY
          The request scope attribute under which is stored the Resource that has raised a DuplicateEntityException during save of another one.
static java.lang.String FORM_OP
          Operation code for showing an empty resource creation form
static java.lang.String LOAD_OP
          Operation code for loading a specified Resource
static java.lang.String RESOURCE_KEY
          The session scope attribute under which the Resource object currently selected by our logged-in User is stored.
static java.lang.String RESOURCES_KEY
          The request scope attribute under which the retrieved Resources list is stored.
static java.lang.String SAVE_OP
          Operation code for saving (create or update) a specified Resource
static java.lang.String SEARCH_OP
          Operation code for searching resources using their type
 
Fields inherited from class org.figure8.join.control.JoinAction
BODY_ATTRIBUTE, BODY_PARAMETER, EXCEPTION_KEY, GUI_KEY, OP_PARAMETER, REND_MAIN, REND_NONE, REND_PARAMETER, REND_POPUP, XHR_PARAMETER
 
Fields inherited from class org.apache.struts.action.Action
defaultLocale, servlet
 
Constructor Summary
ResourceActions()
          Creates a new instance of ResourceActions
 
Method Summary
 AbstractResource createResourceInstance(ResourceForm form)
          Create a new resource instance from informations contained into ResourceForm.
 org.apache.struts.action.ActionForward doExecute(java.lang.String operation, org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Abstract method that subclasses must implement.
protected  org.apache.struts.action.ActionForward loadResource(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Load a specified resource from datastore and fill form with it.
protected  org.apache.struts.action.ActionForward saveResource(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Save a resource into datastore.
protected  org.apache.struts.action.ActionForward searchResources(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Retrieve a list of Resources using the resource type criteria.
 void setResourceManager(ResourceManager manager)
           
protected  org.apache.struts.action.ActionForward showResourceForm(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Prepare all we need for displaying a resource creation form
 
Methods inherited from class org.figure8.join.control.JoinAction
execute, getUserContainer, isLoggedIn, isXhrRequest, removeObsoleteForm
 
Methods inherited from class org.apache.struts.action.Action
addErrors, addMessages, execute, generateToken, getDataSource, getDataSource, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORM_OP

public static final java.lang.String FORM_OP
Operation code for showing an empty resource creation form

See Also:
Constant Field Values

LOAD_OP

public static final java.lang.String LOAD_OP
Operation code for loading a specified Resource

See Also:
Constant Field Values

SAVE_OP

public static final java.lang.String SAVE_OP
Operation code for saving (create or update) a specified Resource

See Also:
Constant Field Values

SEARCH_OP

public static final java.lang.String SEARCH_OP
Operation code for searching resources using their type

See Also:
Constant Field Values

CONFIG_OP

public static final java.lang.String CONFIG_OP
Operation code for getting resource configuration details at specified date

See Also:
Constant Field Values

CHANGES_OP

public static final java.lang.String CHANGES_OP
Operation code for getting resource configuration changes for tracking period

See Also:
Constant Field Values

RESOURCE_KEY

public static final java.lang.String RESOURCE_KEY
The session scope attribute under which the Resource object currently selected by our logged-in User is stored.

See Also:
Constant Field Values

RESOURCES_KEY

public static final java.lang.String RESOURCES_KEY
The request scope attribute under which the retrieved Resources list is stored.

See Also:
Constant Field Values

DUPLICATE_RESOURCE_KEY

public static final java.lang.String DUPLICATE_RESOURCE_KEY
The request scope attribute under which is stored the Resource that has raised a DuplicateEntityException during save of another one.

See Also:
Constant Field Values
Constructor Detail

ResourceActions

public ResourceActions()
Creates a new instance of ResourceActions

Method Detail

setResourceManager

public void setResourceManager(ResourceManager manager)
Parameters:
manager - The ResourceManager to use

createResourceInstance

public AbstractResource createResourceInstance(ResourceForm form)
Create a new resource instance from informations contained into ResourceForm. This is a hook to allow subclasses treating specific resource categories. This implementation maskes 1 assumption : Resource implementation needs to have a constructor with 2 parameters (the resource name and the resource type object).

Parameters:
form - The ResourceForm (or a subclass) to create persistent resource from
Returns:
The persistent AbstractResourceType corresponding to given form

doExecute

public org.apache.struts.action.ActionForward doExecute(java.lang.String operation,
                                                        org.apache.struts.action.ActionMapping mapping,
                                                        org.apache.struts.action.ActionForm form,
                                                        javax.servlet.http.HttpServletRequest request,
                                                        javax.servlet.http.HttpServletResponse response)
                                                 throws java.lang.Exception
Description copied from class: JoinAction
Abstract method that subclasses must implement. The real execution must be done here according to the specified operation. ActionForward returned by execution should only point on page fragment : this superclass is responsible of including them within a whole page.

Specified by:
doExecute in class JoinAction
Parameters:
operation - String representing the operation to invoke on Action
mapping - Mapping between forwards name and path for this action
form - The form object containing request parameters
request - The servlet container request wrapper
response - The servlet container response wrapper
Returns:
A forward to the next view to render and display
Throws:
java.lang.Exception - such as InfrastructureExceptions...

showResourceForm

protected org.apache.struts.action.ActionForward showResourceForm(org.apache.struts.action.ActionMapping mapping,
                                                                  org.apache.struts.action.ActionForm form,
                                                                  javax.servlet.http.HttpServletRequest request,
                                                                  javax.servlet.http.HttpServletResponse response)
                                                           throws java.lang.Exception
Prepare all we need for displaying a resource creation form

Returns:
A forward to the next view to render and display
Throws:
java.lang.Exception

loadResource

protected org.apache.struts.action.ActionForward loadResource(org.apache.struts.action.ActionMapping mapping,
                                                              org.apache.struts.action.ActionForm form,
                                                              javax.servlet.http.HttpServletRequest request,
                                                              javax.servlet.http.HttpServletResponse response)
                                                       throws java.lang.Exception
Load a specified resource from datastore and fill form with it.

Returns:
A forward to the next view to render and display
Throws:
java.lang.Exception

saveResource

protected org.apache.struts.action.ActionForward saveResource(org.apache.struts.action.ActionMapping mapping,
                                                              org.apache.struts.action.ActionForm form,
                                                              javax.servlet.http.HttpServletRequest request,
                                                              javax.servlet.http.HttpServletResponse response)
                                                       throws java.lang.Exception
Save a resource into datastore. The resource may be an already existing one or a new one (this is indeed a create or update method).

Returns:
A forward to the next view to render and display
Throws:
java.lang.Exception

searchResources

protected org.apache.struts.action.ActionForward searchResources(org.apache.struts.action.ActionMapping mapping,
                                                                 org.apache.struts.action.ActionForm form,
                                                                 javax.servlet.http.HttpServletRequest request,
                                                                 javax.servlet.http.HttpServletResponse response)
                                                          throws java.lang.Exception
Retrieve a list of Resources using the resource type criteria.

Returns:
A forward to the next view to render and display
Throws:
java.lang.Exception


Copyright © 2005-2008 Join. All Rights Reserved.