com.ibm.itim.remoteservices.provider
Class RequestStatus

java.lang.Object
  |
  +--com.ibm.itim.remoteservices.provider.RequestStatus
All Implemented Interfaces:
java.io.Serializable

public class RequestStatus
extends java.lang.Object
implements java.io.Serializable

Class encapsulates a response from a remote resource, including the status and any message.

See Also:
Serialized Form

Field Summary
static int AUTHENTICATION_ERROR
          Reason: Authentication error type for an unsuccessful request
static int COMMUNICATION_ERROR
          Reason: Communications error type for an unsuccessful request
static int CONFIGURATION_ERROR
          Reason: Communications error type for an unsuccessful request
static int INVALID_SEARCH_CONTROLS_ERROR
          Reason: Error type for an unsuccessful request indicating that the search controls specified in the request was invalid.
static int INVALID_SEARCH_FILTER_ERROR
          Reason: Error type for an unsuccessful request indicating that the search filter specified in the request was invalid.
static int NAME_ALREADY_BOUND_ERROR
          Reason: Error type for an unsuccessful request indicating that the name requested was already in use.
static int NAME_INVALID_ERROR
          Reason: Error type for an unsuccessful request indicating that the format of the name of the entity was invalid.
static int NAME_NOT_FOUND_ERROR
          Reason: Error type for an unsuccessful request indicating that the name requested was not found.
static int NO_SUCH_ATTRIBUTE_ERROR
          Reason: Error type for an unsuccessful request indicating that there was no such attribute matching an attribute specified in the request.
static int OPERATION_NOT_SUPPORTED_ERROR
          Reason: Error type for an unsuccessful request indicating that the operation requested was not implemented.
static int PENDING
          Status: The request has been made but a response is pending.
static int PROCESSING_ERROR
          Reason: Processing error type for an unsuccessful request
static int SIZE_LIMIT_EXCEEDED_ERROR
          Reason: Error type for an unsuccessful request indicating that the search matched more results than could be returned.
static int SUCCESSFUL
          Status: The request was successful.
static int SUCCESSFUL_WARNING
          Status: The request was partially successful.
static int TIME_LIMIT_EXCEEDED_ERROR
          Reason: Error type for an unsuccessful request indicating that the time limited was exceeded for the resource to respond.
static int UNSUCCESSFUL
          Status: The request failed.
static int USER_ABORTED
          Reason: Error type for an unsuccessful request indicating that the search controls specified in the request was invalid.
 
Constructor Summary
RequestStatus(int status)
          Construct with a status code.
RequestStatus(int status, int reason, java.lang.String reasonMessage)
          Construct with a status code and a text message.
RequestStatus(int status, java.lang.String reasonMessage)
          Construct with a status code and a text message.
RequestStatus(RequestStatus requestStatus)
          Construct a RequestStatus from another, making an exact copy.
 
Method Summary
 void addNotChangedAttributes(AttributeValue unchangedAttribute)
          Adds an attribute that was not able to be added / updated on the remote resouce.
 void addReasonMessageArg(java.lang.String arg)
          Adds a reason message token for internationalization
 boolean failed()
          Accessor method for whether the status is unsuccessful
 AttributeValues getNotChangedAttributes()
          Gets a map of attributes that were not able to be added / updated on the remote resouce.
 int getReason()
          Gets the reason for an unsuccessful response from the remote resource.
 java.lang.String getReasonMessage()
          Gets a possible warning or error message from the remote resource
 java.util.Collection getReasonMessageArgs()
          The arguments for the reason message are used for internationalization
 AttributeValues getReturnAttributes()
          Gets a list of the return (output) attributes from the remote request.
 int getStatus()
          Gets the status of the response from the remote resource
 java.lang.String getXMLFormattedMessage()
          Gets an error message xml formatted as:
 boolean pending()
          Accessor method for whether the status is pending
 void setReason(int reason)
          Sets the reason for an unsuccessful response from the remote resource.
 void setReasonMessage(java.lang.String reasonMessage)
          Sets a possible warning or error message from the remote resource
 void setReasonMessageArgs(java.util.Collection args)
          The arguments for the reason message are used for internationalization
 void setReturnAttributes(AttributeValues returnAttributes)
          Sets a list of the output attributes from the remote request.
 void setStatus(int status)
          Sets the status of the response from the remote resource
 boolean succeeded()
          Accessor method for whether the status is successful or pending
 java.lang.String toString()
          Override method from java.lang.Object
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PENDING

public static final int PENDING
Status: The request has been made but a response is pending. This indicates the request is asynchronous

SUCCESSFUL

public static final int SUCCESSFUL
Status: The request was successful.

UNSUCCESSFUL

public static final int UNSUCCESSFUL
Status: The request failed. In this case the method getReason() will return the reason for the failure.

SUCCESSFUL_WARNING

public static final int SUCCESSFUL_WARNING
Status: The request was partially successful.

PROCESSING_ERROR

public static final int PROCESSING_ERROR
Reason: Processing error type for an unsuccessful request

COMMUNICATION_ERROR

public static final int COMMUNICATION_ERROR
Reason: Communications error type for an unsuccessful request

CONFIGURATION_ERROR

public static final int CONFIGURATION_ERROR
Reason: Communications error type for an unsuccessful request

AUTHENTICATION_ERROR

public static final int AUTHENTICATION_ERROR
Reason: Authentication error type for an unsuccessful request

NAME_INVALID_ERROR

public static final int NAME_INVALID_ERROR
Reason: Error type for an unsuccessful request indicating that the format of the name of the entity was invalid.

OPERATION_NOT_SUPPORTED_ERROR

public static final int OPERATION_NOT_SUPPORTED_ERROR
Reason: Error type for an unsuccessful request indicating that the operation requested was not implemented.

NO_SUCH_ATTRIBUTE_ERROR

public static final int NO_SUCH_ATTRIBUTE_ERROR
Reason: Error type for an unsuccessful request indicating that there was no such attribute matching an attribute specified in the request.

NAME_NOT_FOUND_ERROR

public static final int NAME_NOT_FOUND_ERROR
Reason: Error type for an unsuccessful request indicating that the name requested was not found.

INVALID_SEARCH_FILTER_ERROR

public static final int INVALID_SEARCH_FILTER_ERROR
Reason: Error type for an unsuccessful request indicating that the search filter specified in the request was invalid.

SIZE_LIMIT_EXCEEDED_ERROR

public static final int SIZE_LIMIT_EXCEEDED_ERROR
Reason: Error type for an unsuccessful request indicating that the search matched more results than could be returned.

TIME_LIMIT_EXCEEDED_ERROR

public static final int TIME_LIMIT_EXCEEDED_ERROR
Reason: Error type for an unsuccessful request indicating that the time limited was exceeded for the resource to respond.

NAME_ALREADY_BOUND_ERROR

public static final int NAME_ALREADY_BOUND_ERROR
Reason: Error type for an unsuccessful request indicating that the name requested was already in use.

INVALID_SEARCH_CONTROLS_ERROR

public static final int INVALID_SEARCH_CONTROLS_ERROR
Reason: Error type for an unsuccessful request indicating that the search controls specified in the request was invalid.

USER_ABORTED

public static final int USER_ABORTED
Reason: Error type for an unsuccessful request indicating that the search controls specified in the request was invalid.
Constructor Detail

RequestStatus

public RequestStatus(int status)
Construct with a status code.
Parameters:
status - Possible values are PENDING, SUCCESSFUL, UNSUCCESSFUL, SUCCESSFUL_WARNING

RequestStatus

public RequestStatus(int status,
                     java.lang.String reasonMessage)
Construct with a status code and a text message.
Parameters:
status - Possible values are PENDING, SUCCESSFUL, UNSUCCESSFUL, SUCCESSFUL_WARNING
reasonMessage - A message accompanying an unsuccessful or conditionally successful response.

RequestStatus

public RequestStatus(int status,
                     int reason,
                     java.lang.String reasonMessage)
Construct with a status code and a text message.
Parameters:
status - Possible values are PENDING, SUCCESSFUL, UNSUCCESSFUL, SUCCESSFUL_WARNING
reason - the reason for an unsuccessful response Possible values are PROCESSING_ERROR, COMMUNICATION_ERROR, AUTHENTICATION_ERROR, NAME_INVALID_ERROR, NAME_INVALID_ERROR, OPERATION_NOT_SUPPORTED_ERROR, NO_SUCH_ATTRIBUTE_ERROR, NAME_NOT_FOUND_ERROR, INVALID_SEARCH_FILTER_ERROR, SIZE_LIMIT_EXCEEDED_ERROR, TIME_LIMIT_EXCEEDED_ERROR.
reasonMessage - A message accompanying an unsuccessful or conditionally successful response.

RequestStatus

public RequestStatus(RequestStatus requestStatus)
Construct a RequestStatus from another, making an exact copy.
Parameters:
requestStatus - Copies the status and message from this RequestStatus object
Method Detail

getStatus

public int getStatus()
Gets the status of the response from the remote resource
Returns:
One of PENDING, SUCCESSFUL, UNSUCCESSFUL, SUCCESSFUL_WARNING

setStatus

public void setStatus(int status)
Sets the status of the response from the remote resource
Parameters:
status - One of PENDING, SUCCESSFUL, UNSUCCESSFUL, SUCCESSFUL_WARNING

getReason

public int getReason()
Gets the reason for an unsuccessful response from the remote resource. Possible values are PROCESSING_ERROR, COMMUNICATION_ERROR, AUTHENTICATION_ERROR, NAME_INVALID_ERROR, NAME_INVALID_ERROR, OPERATION_NOT_SUPPORTED_ERROR, NO_SUCH_ATTRIBUTE_ERROR, NAME_NOT_FOUND_ERROR, INVALID_SEARCH_FILTER_ERROR, SIZE_LIMIT_EXCEEDED_ERROR, TIME_LIMIT_EXCEEDED_ERROR.
Returns:
the reason for an unsuccessful response

setReason

public void setReason(int reason)
Sets the reason for an unsuccessful response from the remote resource. Possible values are PROCESSING_ERROR, COMMUNICATION_ERROR, AUTHENTICATION_ERROR, NAME_INVALID_ERROR, NAME_INVALID_ERROR, OPERATION_NOT_SUPPORTED_ERROR, NO_SUCH_ATTRIBUTE_ERROR, NAME_NOT_FOUND_ERROR, INVALID_SEARCH_FILTER_ERROR, SIZE_LIMIT_EXCEEDED_ERROR, TIME_LIMIT_EXCEEDED_ERROR.
Parameters:
reason - the reason for an unsuccessful response

getReasonMessage

public java.lang.String getReasonMessage()
Gets a possible warning or error message from the remote resource
Returns:
The error / warning message or an empty string if there was none

setReasonMessage

public void setReasonMessage(java.lang.String reasonMessage)
Sets a possible warning or error message from the remote resource
Parameters:
reasonMessage - The error / warning message or an empty string if there was none

setReasonMessageArgs

public void setReasonMessageArgs(java.util.Collection args)
The arguments for the reason message are used for internationalization
Parameters:
args - A collection of Strings

addReasonMessageArg

public void addReasonMessageArg(java.lang.String arg)
Adds a reason message token for internationalization
Parameters:
arg - A message token to be substituted into an internationalized message

getReasonMessageArgs

public java.util.Collection getReasonMessageArgs()
The arguments for the reason message are used for internationalization
Returns:
args A collection of Strings

pending

public boolean pending()
Accessor method for whether the status is pending
Returns:
True if the status is pending

failed

public boolean failed()
Accessor method for whether the status is unsuccessful
Returns:
True if the status was unsuccessful

succeeded

public boolean succeeded()
Accessor method for whether the status is successful or pending
Returns:
True if the status was successful or pending

getNotChangedAttributes

public AttributeValues getNotChangedAttributes()
Gets a map of attributes that were not able to be added / updated on the remote resouce. Should be used when an operation was conditionally successful with warnings.
Returns:
A map of the attributes not added / updated

addNotChangedAttributes

public void addNotChangedAttributes(AttributeValue unchangedAttribute)
Adds an attribute that was not able to be added / updated on the remote resouce. Should be used when an operation was conditionally successful with warnings.
Parameters:
unchangedAttribute - The attribute that did not change

getReturnAttributes

public AttributeValues getReturnAttributes()
Gets a list of the return (output) attributes from the remote request. This will usually be empty but for an add request may contain extra attributes generated by the remote resource. This method will be called by the provider framework to process those additional attributes.
Returns:
An Attributes set of output attributes.

setReturnAttributes

public void setReturnAttributes(AttributeValues returnAttributes)
Sets a list of the output attributes from the remote request. This will usually be empty but for an add request may contain extra attributes generated by the remote resource. This method should be called by the ServiceProvider implementer to set those attributes for the ServiceProvider framework to process later.
Parameters:
An - Attributes set of output attributes.

getXMLFormattedMessage

public java.lang.String getXMLFormattedMessage()
Gets an error message xml formatted as:

toString

public java.lang.String toString()
Override method from java.lang.Object
Overrides:
toString in class java.lang.Object
Returns:
a string including the class, status, reason, and message