net.fckeditor.response
Class GetResponse

java.lang.Object
  extended by net.fckeditor.response.GetResponse

public class GetResponse
extends Object

Represents the XML response for the File Browser GET requests.

Version:
$Id: GetResponse.java 3759 2009-06-22 20:02:26Z mosipov $

Field Summary
protected  Document document
          Underlying DOM document
static int EN_CREATE_FOLDER_SECURITY_ERROR
          Error number SECURITY ERROR
static int EN_CUSTOM_ERROR
          Error number CUSTOM ERROR
static int EN_FOLDER_ALREADY_EXISTS_ERROR
          Error number FOLDER ALREADY EXISTS
static int EN_INVALID_NEW_FOLDER_NAME_ERROR
          Error number INVALID NEW FOLDER NAME
static int EN_OK
          Error number OK
static int EN_UKNOWN_CREATE_FOLDER_ERROR
          Error number UNKNOWN ERROR
protected  Element errorElement
          Error element, in case of an invalid request
protected  Element filesElement
          Files element, in case of a GetResources request
protected  Element foldersElement
          Folders element, in case of a GetResources request
 
Constructor Summary
GetResponse(Command command, ResourceType type, String currentFolder, String constructedUrl)
          Constructs a successful response for a specific command and resource type.
GetResponse(int number)
          Constructs a response with a specific error number only.
GetResponse(int number, String message)
          Constructs a response with a specific error number and message.
 
Method Summary
static GetResponse getCreateFolderDisabledError()
          Creates a CREATE FOLDER DISABLED error.
static GetResponse getCreateFolderWriteError()
          Creates a CREATE FOLDER WRITE error.
static GetResponse getFolderAlreadyExistsError()
          Creates a FOLDER ALREADY EXISTS error.
static GetResponse getGetResourcesDisabledError()
          Creates a GET RESOURCES DISABLED error.
static GetResponse getGetResourcesReadError()
          Creates a GET RESOURCES READ error.
static GetResponse getInvalidCommandError()
          Creates an INVALID COMMAND error.
static GetResponse getInvalidCurrentFolderError()
          Creates an INVALID CURRENT FOLDER error.
static GetResponse getInvalidNewFolderNameError()
          Creates an INVALID NEW FOLDER NAME error.
static GetResponse getInvalidResourceTypeError()
          Creates an INVALID RESOURCE TYPE error.
static GetResponse getOK()
          Creates an OK response.
 void setError(int number)
          Sets the error number of this get response.
 void setError(int number, String message)
          Sets the error number and specific message of this get response.
 void setFiles(List<Map<String,Object>> files)
          Sets the folders of this get response.
 void setFolders(List<String> folders)
          Sets the folders of this get response.
 String toString()
          Creates the XML representation of this get response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

document

protected Document document
Underlying DOM document


errorElement

protected Element errorElement
Error element, in case of an invalid request


foldersElement

protected Element foldersElement
Folders element, in case of a GetResources request


filesElement

protected Element filesElement
Files element, in case of a GetResources request


EN_OK

public static final int EN_OK
Error number OK

See Also:
Constant Field Values

EN_CUSTOM_ERROR

public static final int EN_CUSTOM_ERROR
Error number CUSTOM ERROR

See Also:
Constant Field Values

EN_FOLDER_ALREADY_EXISTS_ERROR

public static final int EN_FOLDER_ALREADY_EXISTS_ERROR
Error number FOLDER ALREADY EXISTS

See Also:
Constant Field Values

EN_INVALID_NEW_FOLDER_NAME_ERROR

public static final int EN_INVALID_NEW_FOLDER_NAME_ERROR
Error number INVALID NEW FOLDER NAME

See Also:
Constant Field Values

EN_CREATE_FOLDER_SECURITY_ERROR

public static final int EN_CREATE_FOLDER_SECURITY_ERROR
Error number SECURITY ERROR

See Also:
Constant Field Values

EN_UKNOWN_CREATE_FOLDER_ERROR

public static final int EN_UKNOWN_CREATE_FOLDER_ERROR
Error number UNKNOWN ERROR

See Also:
Constant Field Values
Constructor Detail

GetResponse

public GetResponse(int number,
                   String message)
Constructs a response with a specific error number and message.

Parameters:
number - the error number of the new get response
message - the specific message of the new get response
Throws:
RuntimeException - if creation of the underlying DOM document failed

GetResponse

public GetResponse(Command command,
                   ResourceType type,
                   String currentFolder,
                   String constructedUrl)
Constructs a successful response for a specific command and resource type.

Parameters:
command - the current command of the new get response
type - the current resource type of the new get response
currentFolder - the current folder of the new get response
constructedUrl - the final URL of the new get response
Throws:
RuntimeException - if creation of the underlying DOM document failed

GetResponse

public GetResponse(int number)
Constructs a response with a specific error number only.

Parameters:
number - the error number of the new get response
Throws:
RuntimeException - if creation of the underlying DOM document failed
Method Detail

setError

public void setError(int number,
                     String message)
Sets the error number and specific message of this get response.

Parameters:
number - the error number of this get response
message - the specific message of this get response

setError

public void setError(int number)
Sets the error number of this get response.

Parameters:
number - the error number of this get response

setFolders

public void setFolders(List<String> folders)
Sets the folders of this get response.

Parameters:
folders - the folders of this get response
See Also:
Connector.getFolders(ResourceType, String)

setFiles

public void setFiles(List<Map<String,Object>> files)
Sets the folders of this get response.

Parameters:
files - the files of this get response
See Also:
Connector.getFiles(ResourceType, String)

toString

public String toString()
Creates the XML representation of this get response. The underlying DOM document will transformed to a string.

Overrides:
toString in class Object
Returns:
XML representation of this get response
Throws:
RuntimeException - if creation failed

getOK

public static GetResponse getOK()
Creates an OK response.


getInvalidCommandError

public static GetResponse getInvalidCommandError()
Creates an INVALID COMMAND error.


getInvalidResourceTypeError

public static GetResponse getInvalidResourceTypeError()
Creates an INVALID RESOURCE TYPE error.


getInvalidCurrentFolderError

public static GetResponse getInvalidCurrentFolderError()
Creates an INVALID CURRENT FOLDER error.


getGetResourcesDisabledError

public static GetResponse getGetResourcesDisabledError()
Creates a GET RESOURCES DISABLED error.


getGetResourcesReadError

public static GetResponse getGetResourcesReadError()
Creates a GET RESOURCES READ error.


getCreateFolderDisabledError

public static GetResponse getCreateFolderDisabledError()
Creates a CREATE FOLDER DISABLED error.


getInvalidNewFolderNameError

public static GetResponse getInvalidNewFolderNameError()
Creates an INVALID NEW FOLDER NAME error.


getFolderAlreadyExistsError

public static GetResponse getFolderAlreadyExistsError()
Creates a FOLDER ALREADY EXISTS error.


getCreateFolderWriteError

public static GetResponse getCreateFolderWriteError()
Creates a CREATE FOLDER WRITE error.



Copyright © 2004-2009 Frederico Caldeira Knabben. All Rights Reserved.