com.highdeal.pnr.hci
Class DefaultHCIException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by com.highdeal.hci.OperationFailureException
              extended by com.highdeal.pnr.hci.DefaultHCIException
All Implemented Interfaces:
OperationResult, XMLMarshallable, java.io.Serializable
Direct Known Subclasses:
InvalidSubscriberAccountException

public abstract class DefaultHCIException
extends OperationFailureException

This class must be extended by all the operation failure exceptions. It provides the way to have meanful reason about the exception like a pretty name, a description, and a list of arguments.

See Also:
Serialized Form

Nested Class Summary
static class DefaultHCIException.ExceptionReason
          This class represents the reason of the exception; The reason has a code or a pretty name, a comprehensive message, and a list of arguments.
 
Constructor Summary
DefaultHCIException()
          Initializes an empty DefaultHCIException; It is initialized without arguments.
DefaultHCIException(DefaultHCIException.ExceptionReason reason, java.lang.String... args)
          Initializes a DefaultHCIException with a reason and an argument list.
 
Method Summary
protected  void _marshalAttributes(XMLOutputter output)
          Should be overwritten if the extending exception has specific attributes to be marshalled.
protected  void _marshalChildren(XMLOutputter output)
          Should be overwritten if the extending exception has a specific children to be marshalled.
protected  void _setAttributes(XMLAttributes atts)
          Should be overwritten if the extending exception expects specific attributes.
 void addCharacterData(java.lang.String cData)
          Adds character data to the content element.
 void addChild(java.lang.String tagName, XMLMarshallable child)
          Adds a child to the object, the child representing the marshallable object which must be added to the element.
protected static java.util.Map<java.lang.String,DefaultHCIException.ExceptionReason> generateReasons(java.lang.Class<?> clazz, java.lang.Class<?> reasonClazz)
          Builds the reason map of all the reasons defined in the the specified clazz and of type reasonClazz.
 java.util.List<java.lang.String> getArgs()
          Returns the arguments of this exception.
 java.lang.String getMessage()
          Returns the text message of this exception.
 DefaultHCIException.ExceptionReason getReason()
          Returns the reason of this exception.
protected abstract  java.util.Map<java.lang.String,DefaultHCIException.ExceptionReason> getReasons()
          Returns all the available reasons of the exception.
protected abstract  java.lang.String getTagName()
          Returns the tag of the extending exception.
 void marshal(XMLOutputter output)
          Gives an XML representation of this object, including its children.
 void setAttributes(XMLAttributes atts)
          Sets the attributes of the XML representation of the element being processed.
 
Methods inherited from class com.highdeal.hci.OperationFailureException
getOperandReference
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultHCIException

public DefaultHCIException()
Initializes an empty DefaultHCIException; It is initialized without arguments.

Note

Should only be used to be initialized using XML.


DefaultHCIException

public DefaultHCIException(DefaultHCIException.ExceptionReason reason,
                           java.lang.String... args)
Initializes a DefaultHCIException with a reason and an argument list.

Parameters:
reason - The reason of the exception. Is mandatory and cannot be null.
args - The arguments of the reason. Is optional and can be null. If specified, the argument count must be equals to the argument name count defined by the reason.
Method Detail

getArgs

public java.util.List<java.lang.String> getArgs()
Returns the arguments of this exception.

Returns:
The value of the arguments of this exception if exists, null otherwise

getReason

public DefaultHCIException.ExceptionReason getReason()
Returns the reason of this exception.

Returns:
The reason of the exception if exists, null otherwise

getMessage

public java.lang.String getMessage()
Returns the text message of this exception.

Overrides:
getMessage in class java.lang.Throwable
Returns:
The message of the exception is exists, null otherwise

setAttributes

public final void setAttributes(XMLAttributes atts)
Description copied from interface: XMLMarshallable
Sets the attributes of the XML representation of the element being processed.

Parameters:
atts - The XML attributes of the current element

addCharacterData

public final void addCharacterData(java.lang.String cData)
Description copied from interface: XMLMarshallable
Adds character data to the content element.

Parameters:
cData - The character data to be added

addChild

public final void addChild(java.lang.String tagName,
                           XMLMarshallable child)
Description copied from interface: XMLMarshallable
Adds a child to the object, the child representing the marshallable object which must be added to the element.

Parameters:
tagName - The name of tag for the child
child - The child to be added

marshal

public final void marshal(XMLOutputter output)
Description copied from interface: XMLMarshallable
Gives an XML representation of this object, including its children.

Parameters:
output - The XML output to marshal the object into

getReasons

protected abstract java.util.Map<java.lang.String,DefaultHCIException.ExceptionReason> getReasons()
Returns all the available reasons of the exception.

Returns:
The mapping between the pretty name reason and the reason

getTagName

protected abstract java.lang.String getTagName()
Returns the tag of the extending exception.

Returns:
The XML tag use to marshal the exception.

_setAttributes

protected void _setAttributes(XMLAttributes atts)
Should be overwritten if the extending exception expects specific attributes.

Parameters:
atts - The attribute list of the XML format of the extending exception

_marshalAttributes

protected void _marshalAttributes(XMLOutputter output)
Should be overwritten if the extending exception has specific attributes to be marshalled.

Parameters:
output - The marshaller

_marshalChildren

protected void _marshalChildren(XMLOutputter output)
Should be overwritten if the extending exception has a specific children to be marshalled.

Parameters:
output - The marshaller

generateReasons

protected static final java.util.Map<java.lang.String,DefaultHCIException.ExceptionReason> generateReasons(java.lang.Class<?> clazz,
                                                                                                           java.lang.Class<?> reasonClazz)
Builds the reason map of all the reasons defined in the the specified clazz and of type reasonClazz.

Parameters:
clazz - The class from which the reasons must be extracted
reasonClazz - The type of the reason to be extracted
Returns:
The mapping between the pretty name of the reason and the reason

Document Published: October 2015 (SAP CC 4.0 SP10 and Later)