com.tenduke.services.objectmodel.formhandler
Class DeleteObjectsFormHandler

java.lang.Object
  extended by com.tenduke.services.objectmodel.formhandler.AbstractFormHandler
      extended by com.tenduke.services.objectmodel.formhandler.DeleteObjectsFormHandler
All Implemented Interfaces:
FormDataHandler

public class DeleteObjectsFormHandler
extends AbstractFormHandler

Form handler for generic object deletion.


Nested Class Summary
 class DeleteObjectsFormHandler.DeleteObjectDefinition
          Class that holds type and id of an object to delete.
 
Field Summary
static java.lang.String FORM_FIELD_NAME_PREFIX_FOR_OBJECT_ID
          Prefix for names of form fields carrying ids objects that should be deleted.
static java.lang.String FORM_FIELD_NAME_PREFIX_FOR_OBJECT_TYPE
          Prefix for names of form fields carrying types objects that should be deleted.
static java.lang.String FORM_FIELD_NAME_PREFIX_FOR_PARENT_OBJECT_TYPE
          Prefix for names of form fields carrying types objects that function as parent for objects to be deleted.
 
Constructor Summary
protected DeleteObjectsFormHandler(Profile modifiedBy, javax.servlet.http.HttpServletRequest request)
          Creates a new instance of the DeleteObjectsFormHandler class.
 
Method Summary
 void beginHandling()
          Begin form data handling.
static boolean deleteObjects(Profile modifiedBy, javax.servlet.http.HttpServletRequest request)
           Handle form submit request and delete objects defined by the request.
static OperationResult deleteObjects2(Profile modifiedBy, javax.servlet.http.HttpServletRequest request)
          Handle form submit request and delete objects defined by the request.
 void endHandling()
          End handling.
 java.io.File getPathForFileWrite(java.lang.String originalFilePath, java.lang.String originalFileName)
          Gets path where parsed files is written.
 void handleFilePart(java.lang.String originalFilePath, java.lang.String originalFileName, java.io.File fileInForm)
          Handle a File part.
 void handleHeader(java.lang.String headerName, java.lang.String headerValue)
          Empty method.
 void handleParameterPart(java.lang.String parameterName, java.lang.String parameterValue)
           Handle a request parameter.
 
Methods inherited from class com.tenduke.services.objectmodel.formhandler.AbstractFormHandler
getModifyingProfile, getRequest, getRequestParameters, setModifyingProfile, setRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORM_FIELD_NAME_PREFIX_FOR_OBJECT_ID

public static final java.lang.String FORM_FIELD_NAME_PREFIX_FOR_OBJECT_ID
Prefix for names of form fields carrying ids objects that should be deleted.

See Also:
Constant Field Values

FORM_FIELD_NAME_PREFIX_FOR_OBJECT_TYPE

public static final java.lang.String FORM_FIELD_NAME_PREFIX_FOR_OBJECT_TYPE
Prefix for names of form fields carrying types objects that should be deleted. Object type must correspond to a SerializableClass annotated class name.

See Also:
Constant Field Values

FORM_FIELD_NAME_PREFIX_FOR_PARENT_OBJECT_TYPE

public static final java.lang.String FORM_FIELD_NAME_PREFIX_FOR_PARENT_OBJECT_TYPE
Prefix for names of form fields carrying types objects that function as parent for objects to be deleted. This parent object type must correspond to a SerializableClass annotated class name.

See Also:
Constant Field Values
Constructor Detail

DeleteObjectsFormHandler

protected DeleteObjectsFormHandler(Profile modifiedBy,
                                   javax.servlet.http.HttpServletRequest request)
Creates a new instance of the DeleteObjectsFormHandler class.

Parameters:
modifiedBy - Profile used as modifying Profile for updates made by the handler.
request - Request that is parsed by the handler.
Method Detail

beginHandling

public void beginHandling()
Begin form data handling.


deleteObjects

public static boolean deleteObjects(Profile modifiedBy,
                                    javax.servlet.http.HttpServletRequest request)
                             throws java.io.IOException

Handle form submit request and delete objects defined by the request.

Internally calls deleteObjects2(com.tenduke.objectmodel.Profile, javax.servlet.http.HttpServletRequest) and returns the value of isSuccessful() method of the OperationResult object.

Parameters:
modifiedBy - Profile used as modifying Profile for updates made by the handler.
request - Request that is parsed by the handler
Returns:
True if handling successful
Throws:
java.io.IOException - Thrown if an error occurs when handling

deleteObjects2

public static OperationResult deleteObjects2(Profile modifiedBy,
                                             javax.servlet.http.HttpServletRequest request)
                                      throws java.io.IOException
Handle form submit request and delete objects defined by the request.

Parameters:
modifiedBy - Profile used as modifying Profile for updates made by the handler.
request - Request that is parsed by the handler
Returns:
Handling result
Throws:
java.io.IOException - Thrown if an error occurs when handling

endHandling

public void endHandling()
End handling.


getPathForFileWrite

public java.io.File getPathForFileWrite(java.lang.String originalFilePath,
                                        java.lang.String originalFileName)
Gets path where parsed files is written.

Parameters:
originalFilePath - Original file path.
originalFileName - Original file name.
Returns:
File where parsed files is written.

handleFilePart

public void handleFilePart(java.lang.String originalFilePath,
                           java.lang.String originalFileName,
                           java.io.File fileInForm)
Handle a File part.

Parameters:
originalFilePath - Original file path.
originalFileName - Original file name.
fileInForm - The file.

handleHeader

public void handleHeader(java.lang.String headerName,
                         java.lang.String headerValue)
Empty method.

Parameters:
headerName - Name of header.
headerValue - Value of header.

handleParameterPart

public void handleParameterPart(java.lang.String parameterName,
                                java.lang.String parameterValue)

Handle a request parameter. This implementation identifies request parameters by name starting with:

Specified by:
handleParameterPart in interface FormDataHandler
Overrides:
handleParameterPart in class AbstractFormHandler
Parameters:
parameterName - Name of parameter.
parameterValue - Parameter value.