gov.grants.apply.struts.actions
Class SubmitApplicationAction

java.lang.Object
  extended byorg.apache.struts.action.Action
      extended byorg.apache.struts.actions.DispatchAction
          extended byorg.apache.struts.actions.LookupDispatchAction
              extended bygov.grants.apply.struts.actions.SubmitApplicationAction
All Implemented Interfaces:
Constants

public class SubmitApplicationAction
extends org.apache.struts.actions.LookupDispatchAction
implements Constants

Action class for uploading and submitting an application with attachments via web services to Grants.gov.

Author:
Brian Husted

Field Summary
(package private) static org.apache.log4j.Logger log
           
 
Fields inherited from class org.apache.struts.actions.LookupDispatchAction
keyMethodMap, localeMap
 
Fields inherited from class org.apache.struts.actions.DispatchAction
clazz, messages, methods, types
 
Fields inherited from class org.apache.struts.action.Action
ACTION_SERVLET_KEY, APPLICATION_KEY, DATA_SOURCE_KEY, defaultLocale, ERROR_KEY, EXCEPTION_KEY, FORM_BEANS_KEY, FORWARDS_KEY, LOCALE_KEY, MAPPING_KEY, MAPPINGS_KEY, MESSAGE_KEY, MESSAGES_KEY, MULTIPART_KEY, PLUG_INS_KEY, REQUEST_PROCESSOR_KEY, servlet, SERVLET_KEY, TRANSACTION_TOKEN_KEY
 
Fields inherited from interface gov.grants.apply.struts.Constants
ACTION_CONTINUE, ACTION_FAILURE, ACTION_SUCCESS, APP_RECEIPT_DATE, APPLICATION_INFO, APPLICATION_XML, ATTACHMENTS, ERROR_DETAIL, GETOPPORTUNITY_LIST, GG_TRACKING_ID, SOAP_SERVER_PROPERTY_FILE, STATUS_DETAIL, XML_FILE_NAME
 
Constructor Summary
SubmitApplicationAction()
           
 
Method Summary
 org.apache.struts.action.ActionForward addApplicationXml(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Add the application XML file.
 org.apache.struts.action.ActionForward addAttachment(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Adds an attachment.
 org.apache.struts.action.ActionForward calculateAndInsertHash(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method calculates the hash value of the <grant:Forms> tag inside of the uploaded Grant application XML file.
protected  void cleanUp(javax.servlet.http.HttpServletRequest request)
           
protected  java.util.Map getKeyMethodMap()
           
protected  boolean isWellFormedXML(javax.servlet.http.HttpServletRequest request, java.lang.String xml)
           
 org.apache.struts.action.ActionForward removeApplicationXml(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Removes the selected xml file from the session.
 org.apache.struts.action.ActionForward removeAttachments(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Removes any attachments that were previously added.
 org.apache.struts.action.ActionForward submitApplication(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Submits the application package to the server for processing.
 org.apache.struts.action.ActionForward validateApplicationXml(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Validates a Grant Application xml file using strict validation.
 
Methods inherited from class org.apache.struts.actions.LookupDispatchAction
execute
 
Methods inherited from class org.apache.struts.actions.DispatchAction
dispatchMethod, getMethod, unspecified
 
Methods inherited from class org.apache.struts.action.Action
execute, generateToken, getDataSource, getDataSource, getLocale, getResources, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, perform, perform, resetToken, saveErrors, saveMessages, saveToken, setLocale, setServlet, toHex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

static final org.apache.log4j.Logger log
Constructor Detail

SubmitApplicationAction

public SubmitApplicationAction()
Method Detail

getKeyMethodMap

protected java.util.Map getKeyMethodMap()

submitApplication

public org.apache.struts.action.ActionForward submitApplication(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
Submits the application package to the server for processing.

Parameters:
mapping - the ActionMapping
form - the ActionForm
request - the HttpServletRequest
response - the HttpServletResponse
Returns:
the ActionForward
Throws:
java.lang.Exception

isWellFormedXML

protected boolean isWellFormedXML(javax.servlet.http.HttpServletRequest request,
                                  java.lang.String xml)
                           throws InvalidXmlException
Throws:
InvalidXmlException

cleanUp

protected void cleanUp(javax.servlet.http.HttpServletRequest request)

addApplicationXml

public org.apache.struts.action.ActionForward addApplicationXml(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
Add the application XML file. Validates that the file is well-formed xml and contains a GrantApplication element.

Parameters:
mapping -
form -
request -
response -
Returns:
Throws:
java.lang.Exception

removeApplicationXml

public org.apache.struts.action.ActionForward removeApplicationXml(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
Removes the selected xml file from the session.

Parameters:
mapping -
form -
request -
response -
Returns:
Throws:
java.lang.Exception

validateApplicationXml

public org.apache.struts.action.ActionForward validateApplicationXml(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
Validates a Grant Application xml file using strict validation.

Parameters:
mapping -
form -
request -
response -
Returns:
Throws:
java.lang.Exception

calculateAndInsertHash

public org.apache.struts.action.ActionForward calculateAndInsertHash(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
This method calculates the hash value of the <grant:Forms> tag inside of the uploaded Grant application XML file. After the computation, the hash value is inserted into the Header portion of the Grant application XML.

Parameters:
mapping - Struts action mapping object.
form - The form bean holding user parameters.
request - The HTTP request object.
response - The HTTP response object.
Returns:
The next action back to the Struts framework.
Throws:
java.lang.Exception - When the application XML cannot be parsed.

addAttachment

public org.apache.struts.action.ActionForward addAttachment(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
Adds an attachment. Uploads the attachment to the server.

Parameters:
mapping -
form -
request -
response -
Returns:
Throws:
java.lang.Exception

removeAttachments

public org.apache.struts.action.ActionForward removeAttachments(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
Removes any attachments that were previously added.

Parameters:
mapping -
form -
request -
response -
Returns:
Throws:
java.lang.Exception