com.highdeal.hci
Class NotAuthorizedException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by com.highdeal.hci.OperationFailureException
              extended by com.highdeal.hci.NotAuthorizedException
All Implemented Interfaces:
OperationResult, XMLMarshallable, java.io.Serializable

public class NotAuthorizedException
extends OperationFailureException

Generic exception thrown when the SAP CC user is not allowed to request an operation for one of the following reasons:

See Also:
UserModel, CatalogEntryModel, Serialized Form

XML API for HCI

The XML APIs specify the following XSD fragment:

XSD Fragment

<xs:element name="notAuthorizedFault">
   <xs:complexType>
     <xs:attribute name="internalMsg" type="xs:string"/>
     <xs:attribute name="opID" type="xs:string"/>
     <xs:attribute name="message" type="xs:string"/>
     <xs:attribute name="opName" type="xs:string"/>
     <xs:attribute name="userID" type="xs:string"/>
     <xs:attribute name="reason" type="RefusualType"/>
   </xs:complexType>
 </xs:element>
<xs:simpleType name="RefusualType">
   <xs:restriction base="xs:string">
     <xs:enumeration value="operationNotAllowed"/> <!-- the user is not allowed to use the API -->
     <xs:enumeration value="catalogRestrictionViolation"/>
   </xs:restriction>
 </xs:simpleType>


Field Summary
static int CATALOG_RESTRICTION_VIOLATION
          1: This constant shows that the required API operation was called on an object which does not belong to the pricing catalog associated to the SAP CC user.
static int OPERATION_NOT_ALLOWED
          0: This constant shows that the required API operation is not allowed for the SAP CC user.
 
Constructor Summary
NotAuthorizedException()
          Constructs an empty exception.
NotAuthorizedException(int reasonCode, java.lang.String opName, java.lang.String id, java.lang.String userID, java.lang.String internalMsg)
          Constructs an exception for an unauthorized operation.
NotAuthorizedException(java.lang.String n, java.lang.String id)
          Constructs an exception for an unauthorized operation.
 
Method Summary
 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.
 java.lang.String getInternalMsg()
          Gets the text message corresponding to the server rejection.
 java.lang.String getMessage()
           
 java.lang.String getOperandReference()
          Gets the code or the reference (if no code exists) that identifies the operand of the operation request; If the operation is not auditable, the operand reference is null.
 java.lang.String getOperationName()
          Returns the name of the operation that has been refused.
 java.lang.String getOpID()
          Returns the ID of the operation that has been refused.
 int getReason()
          Returns the reason why the SAP CC user is rejected; The possible reasons are OPERATION_NOT_ALLOWED and CATALOG_RESTRICTION_VIOLATION.
 java.lang.String getUserID()
          Returns the ID (login) of the non authorized SAP CC user.
 void marshal(XMLOutputter output)
          Gives an XML representation of this object, including its children.
 int parseReason(java.lang.String str)
          Parses the reason string into the related integer.
 java.lang.String reasonToString()
          Transforms the reason into an XML attribute string.
 void setAttributes(XMLAttributes atts)
          Sets the attributes of the XML representation of the element being processed.
 
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
 

Field Detail

OPERATION_NOT_ALLOWED

public static final int OPERATION_NOT_ALLOWED
0: This constant shows that the required API operation is not allowed for the SAP CC user.

See Also:
Constant Field Values

CATALOG_RESTRICTION_VIOLATION

public static final int CATALOG_RESTRICTION_VIOLATION
1: This constant shows that the required API operation was called on an object which does not belong to the pricing catalog associated to the SAP CC user.

See Also:
Constant Field Values
Constructor Detail

NotAuthorizedException

public NotAuthorizedException()
Constructs an empty exception.


NotAuthorizedException

public NotAuthorizedException(java.lang.String n,
                              java.lang.String id)
Constructs an exception for an unauthorized operation.

Parameters:
n - The name of the unauthorized operation
id - The ID of the unauthorized operation

NotAuthorizedException

public NotAuthorizedException(int reasonCode,
                              java.lang.String opName,
                              java.lang.String id,
                              java.lang.String userID,
                              java.lang.String internalMsg)
Constructs an exception for an unauthorized operation.

Parameters:
opName - The name of the unauthorized operation
id - The ID of the unauthorized operation
userID - The login of the SAP CC user who tries to request the operation
internalMsg - The internal message why the authorization is rejected.
Method Detail

getOpID

public java.lang.String getOpID()
Returns the ID of the operation that has been refused.

Returns:
The ID of the refused operation

getOperationName

public java.lang.String getOperationName()
Returns the name of the operation that has been refused.

Returns:
The name of the refused operation

getUserID

public java.lang.String getUserID()
Returns the ID (login) of the non authorized SAP CC user.

Returns:
The user login

getReason

public int getReason()
Returns the reason why the SAP CC user is rejected; The possible reasons are OPERATION_NOT_ALLOWED and CATALOG_RESTRICTION_VIOLATION.

Returns:
The exception related reason
See Also:
OPERATION_NOT_ALLOWED, CATALOG_RESTRICTION_VIOLATION

getInternalMsg

public java.lang.String getInternalMsg()
Gets the text message corresponding to the server rejection.

Returns:
The exception related text message

reasonToString

public java.lang.String reasonToString()
Transforms the reason into an XML attribute string.

Returns:
The readable reason

parseReason

public int parseReason(java.lang.String str)
Parses the reason string into the related integer.

Parameters:
str - The reason code
Returns:
The reason constant value

setAttributes

public 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 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 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 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

getOperandReference

public java.lang.String getOperandReference()
Description copied from interface: OperationResult
Gets the code or the reference (if no code exists) that identifies the operand of the operation request; If the operation is not auditable, the operand reference is null.

Specified by:
getOperandReference in interface OperationResult
Overrides:
getOperandReference in class OperationFailureException
Returns:
The operand reference of the operation result

getMessage

public java.lang.String getMessage()
Overrides:
getMessage in class java.lang.Throwable

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