biz.hammurapi.web
Class FileActions

java.lang.Object
  extended bybiz.hammurapi.web.ActionsBase
      extended bybiz.hammurapi.web.FileActions

public class FileActions
extends ActionsBase

Performs file operations

Author:
Pavel Vlasov

Nested Class Summary
static class FileActions.DbFileEx
           
static class FileActions.FileInfoEx
           
 
Nested classes inherited from class biz.hammurapi.web.ActionsBase
ActionsBase.ErrorMessage
 
Field Summary
static java.lang.String ACTION_ID
           
static java.lang.String ACTION_INFO_PREFIX
          Parameters and referrers of file actions are stored in session under keys ACTION_INFO_PREFIX<invocation id; Info is an object array with first element being a map of parameters and the second being referrer if any
static java.lang.String ROOT_CONTENT_TYPE
           
 
Fields inherited from class biz.hammurapi.web.ActionsBase
compositeDomSerializer, converter, REFERRER_HEADER
 
Constructor Summary
FileActions()
           
 
Method Summary
 java.lang.Object actionInfo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Returns action info by actionId parameter and also request parameters
 void create(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Uploads file content to database (update).
 java.lang.Object delete(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Deletes file from the databse.
 void download(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ActionServlet servlet, java.lang.String path)
          Retrieves content of the file.
 void get(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ActionServlet servlet, java.lang.String path)
          Retrieves content of the file.
 java.lang.Object getActions(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Returns a list of actions available for a given file or file type
 java.lang.Object getAsText(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Returns file record with content as text
 java.lang.Object getCreateFileTypes(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected static biz.hammurapi.web.file.sql.FileEngine getEngine(javax.servlet.http.HttpServletRequest request)
           
 java.lang.Object getInfo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Returns file info by ID parameter or ownerId and ownerType parameters.
 java.lang.Object performAction(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Performs action on a file.
 java.lang.Object redirectTo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Returns file record with content as text
 void update(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Uploads file content to database (update).
 
Methods inherited from class biz.hammurapi.web.ActionsBase
getGlobal, getMatched, getMenu, getReferrer, getRemoted, getUid, hasPermission, includeThisInPath, invoke, isBlank, java, request2xml, setReferrer, sql
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTION_ID

public static final java.lang.String ACTION_ID
See Also:
Constant Field Values

ROOT_CONTENT_TYPE

public static final java.lang.String ROOT_CONTENT_TYPE
See Also:
Constant Field Values

ACTION_INFO_PREFIX

public static final java.lang.String ACTION_INFO_PREFIX
Parameters and referrers of file actions are stored in session under keys ACTION_INFO_PREFIX<invocation id; Info is an object array with first element being a map of parameters and the second being referrer if any

Constructor Detail

FileActions

public FileActions()
Method Detail

getEngine

protected static biz.hammurapi.web.file.sql.FileEngine getEngine(javax.servlet.http.HttpServletRequest request)

download

public void download(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response,
                     ActionServlet servlet,
                     java.lang.String path)
              throws java.io.IOException,
                     java.sql.SQLException
Retrieves content of the file.

Parameters:
request -
response -
Throws:
java.io.IOException
java.sql.SQLException

get

public void get(javax.servlet.http.HttpServletRequest request,
                javax.servlet.http.HttpServletResponse response,
                ActionServlet servlet,
                java.lang.String path)
         throws java.io.IOException,
                java.sql.SQLException
Retrieves content of the file.

Parameters:
request -
response -
Throws:
java.io.IOException
java.sql.SQLException

update

public void update(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws java.lang.Exception
Uploads file content to database (update).

Parameters:
request -
response -
Throws:
java.io.IOException
java.sql.SQLException
biz.hammurapi.config.ConfigurationException
org.apache.commons.fileupload.FileUploadException
HammurapiWebException
java.security.NoSuchAlgorithmException
java.lang.Exception

create

public void create(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws java.io.IOException,
                   java.sql.SQLException,
                   biz.hammurapi.config.ConfigurationException,
                   org.apache.commons.fileupload.FileUploadException,
                   HammurapiWebException
Uploads file content to database (update).

Parameters:
request -
response -
Throws:
java.io.IOException
java.sql.SQLException
biz.hammurapi.config.ConfigurationException
org.apache.commons.fileupload.FileUploadException
HammurapiWebException

getInfo

public java.lang.Object getInfo(javax.servlet.http.HttpServletRequest request,
                                javax.servlet.http.HttpServletResponse response)
                         throws java.sql.SQLException,
                                biz.hammurapi.config.ConfigurationException
Returns file info by ID parameter or ownerId and ownerType parameters.

Parameters:
request -
response -
Returns:
Throws:
java.sql.SQLException
biz.hammurapi.config.ConfigurationException

getAsText

public java.lang.Object getAsText(javax.servlet.http.HttpServletRequest request,
                                  javax.servlet.http.HttpServletResponse response)
                           throws java.sql.SQLException
Returns file record with content as text

Throws:
java.sql.SQLException

redirectTo

public java.lang.Object redirectTo(javax.servlet.http.HttpServletRequest request,
                                   javax.servlet.http.HttpServletResponse response)
                            throws java.sql.SQLException
Returns file record with content as text

Throws:
java.sql.SQLException

delete

public java.lang.Object delete(javax.servlet.http.HttpServletRequest request,
                               javax.servlet.http.HttpServletResponse response)
                        throws java.sql.SQLException
Deletes file from the databse.

Parameters:
request - Shall have ID parameter.
response -
Throws:
java.sql.SQLException

performAction

public java.lang.Object performAction(javax.servlet.http.HttpServletRequest request,
                                      javax.servlet.http.HttpServletResponse response)
                               throws java.sql.SQLException
Performs action on a file.

Parameters:
request - Parameters ID, action
response -
Returns:
Throws:
java.sql.SQLException

getCreateFileTypes

public java.lang.Object getCreateFileTypes(javax.servlet.http.HttpServletRequest request,
                                           javax.servlet.http.HttpServletResponse response)
Parameters:
request -
response -
Returns:
List of file types with 'create' action.

getActions

public java.lang.Object getActions(javax.servlet.http.HttpServletRequest request,
                                   javax.servlet.http.HttpServletResponse response)
                            throws java.sql.SQLException,
                                   HammurapiWebException
Returns a list of actions available for a given file or file type

Parameters:
request - Parameters ID of fileType
response -
Returns:
Throws:
java.sql.SQLException
HammurapiWebException

actionInfo

public java.lang.Object actionInfo(javax.servlet.http.HttpServletRequest request,
                                   javax.servlet.http.HttpServletResponse response)
Returns action info by actionId parameter and also request parameters

Parameters:
request -
response -
Returns:


Copyright © 2006 Hammurapi Group. All Rights Reserved.