com.indexdata.mkjsf.pazpar2.data
Class CommandError

java.lang.Object
  extended by com.indexdata.mkjsf.pazpar2.data.ResponseDataObject
      extended by com.indexdata.mkjsf.pazpar2.data.CommandError
All Implemented Interfaces:
ErrorInterface, Serializable

public class CommandError
extends ResponseDataObject
implements ErrorInterface

Holds an error encountered during the execution of a command. An error can be received by a command thread as an exception message or as an error XML. In both cases the error (string or xml) will be embedded in a new 'applicationerror' element which in turn will be embedded in a command XML (i.e. a 'search' or a 'show' response XML) The command response XML is subsequently parsed by ResponseParser, which will then create the CommandError object.

Author:
Niels Erik
See Also:
Serialized Form

Constructor Summary
CommandError()
           
 
Method Summary
static String createErrorXml(String commandName, String statusCode, String exception, String errorMessage, String response)
          Creates an XML string error message, embedded in an XML string document named by the command This is the XML that ResponseParser will turn into a CommandError object.
 ErrorHelper.ErrorCode getApplicationErrorCode()
           
 String getException()
           
 String getLabel()
           
 String getMessage()
           
 ServiceError getServiceError()
           
 List<String> getSuggestions()
           
static String insertErrorXml(String commandName, String statusCode, String exception, String pazpar2ErrorXml)
          Embeds a Pazpar2 (or Pazpar2 client) error response document as a child element of a command response document (like 'search' or 'show').
 boolean isPazpar2Error()
           
 boolean isServiceError()
           
 boolean isServiceProxyError()
           
 void setApplicationErrorCode(ErrorHelper.ErrorCode code)
           
 void setErrorHelper(ErrorHelper errorHelper)
          Sets the object that should be used to analyze the error
 
Methods inherited from class com.indexdata.mkjsf.pazpar2.data.ResponseDataObject
addElement, appendContent, getApplicationError, getAttribute, getBinary, getElements, getHasResults, getIntValue, getIsBinary, getOneElement, getOneValue, getProperty, getType, getValue, getValueArray, getXml, hasApplicationError, hasServiceError, setAttribute, setBinary, setType, setXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandError

public CommandError()
Method Detail

getLabel

public String getLabel()
Specified by:
getLabel in interface ErrorInterface

getMessage

public String getMessage()
Specified by:
getMessage in interface ErrorInterface

getException

public String getException()
Specified by:
getException in interface ErrorInterface

getSuggestions

public List<String> getSuggestions()
Specified by:
getSuggestions in interface ErrorInterface

createErrorXml

public static String createErrorXml(String commandName,
                                    String statusCode,
                                    String exception,
                                    String errorMessage,
                                    String response)
Creates an XML string error message, embedded in an XML string document named by the command This is the XML that ResponseParser will turn into a CommandError object.

Parameters:
commandName -
exception -
errorMessage -
Returns:

insertErrorXml

public static String insertErrorXml(String commandName,
                                    String statusCode,
                                    String exception,
                                    String pazpar2ErrorXml)
Embeds a Pazpar2 (or Pazpar2 client) error response document as a child element of a command response document (like 'search' or 'show'). This is the XML that ResponseParser will turn into a CommandError object.

Parameters:
commandName - The name of the command during which's execution the error was encountered
exception - The (possibly loosely defined) name of the exception that was thrown
pazpar2ErrorXml - The error document as created by Pazpar2, or the Service Proxy or by the Pazpar2 client itself.
Returns:

setErrorHelper

public void setErrorHelper(ErrorHelper errorHelper)
Sets the object that should be used to analyze the error

Specified by:
setErrorHelper in interface ErrorInterface

setApplicationErrorCode

public void setApplicationErrorCode(ErrorHelper.ErrorCode code)
Specified by:
setApplicationErrorCode in interface ErrorInterface

getApplicationErrorCode

public ErrorHelper.ErrorCode getApplicationErrorCode()
Specified by:
getApplicationErrorCode in interface ErrorInterface

isServiceError

public boolean isServiceError()
Specified by:
isServiceError in interface ErrorInterface

getServiceError

public ServiceError getServiceError()
Specified by:
getServiceError in interface ErrorInterface
Overrides:
getServiceError in class ResponseDataObject

isServiceProxyError

public boolean isServiceProxyError()

isPazpar2Error

public boolean isPazpar2Error()


Copyright © 2013. All Rights Reserved.