Class CardinalityResponseImpl
java.lang.Object
se.liu.ida.hefquin.engine.federation.access.impl.response.CardinalityResponseImpl
- All Implemented Interfaces:
CardinalityResponse
,DataRetrievalResponse<Integer>
- Direct Known Subclasses:
CardinalityResponseImplWithoutCardinality
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final int
protected final DataRetrievalRequest
protected final DataRetrievalResponse
<?> -
Constructor Summary
ConstructorsConstructorDescriptionCardinalityResponseImpl
(DataRetrievalResponse<?> wrappedResponse, DataRetrievalRequest request, int cardinality) Constructs a cardinality response that wraps the given data retrieval response and associates it with a request and a cardinality value. -
Method Summary
Modifier and TypeMethodDescriptionReturns a short description of the error from the wrapped response, if available.Returns the error status code from the wrapped response, if any.Returns the federation member associated with the wrapped response.Returns the data retrieval request associated with this response.Returns the duration between the request start and the retrieval end time, as reported by the wrapped response.Returns the timestamp indicating when the original request was initiated.Returns the cardinality value as the response data.Returns the timestamp indicating when the retrieval of the wrapped response completed.Returns the original data retrieval response that this object wraps.boolean
isError()
Indicates whether an error occurred during data retrieval, based on the wrapped response.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface se.liu.ida.hefquin.engine.federation.access.CardinalityResponse
getCardinality
-
Field Details
-
wrappedResponse
-
request
-
cardinality
protected final int cardinality
-
-
Constructor Details
-
CardinalityResponseImpl
public CardinalityResponseImpl(DataRetrievalResponse<?> wrappedResponse, DataRetrievalRequest request, int cardinality) Constructs a cardinality response that wraps the given data retrieval response and associates it with a request and a cardinality value.- Parameters:
wrappedResponse
- the wrapped data retrieval response (must not be null)request
- the original data retrieval request (must not be null)cardinality
- the cardinality of the request
-
-
Method Details
-
getWrappedResponse
Returns the original data retrieval response that this object wraps.- Returns:
- the wrapped
DataRetrievalResponse
instance
-
getFederationMember
Returns the federation member associated with the wrapped response.- Specified by:
getFederationMember
in interfaceDataRetrievalResponse<Integer>
- Returns:
- the corresponding federation member
-
getRequest
Returns the data retrieval request associated with this response.- Specified by:
getRequest
in interfaceDataRetrievalResponse<Integer>
- Returns:
- the associated
DataRetrievalRequest
-
getRequestStartTime
Returns the timestamp indicating when the original request was initiated.- Specified by:
getRequestStartTime
in interfaceDataRetrievalResponse<Integer>
- Returns:
- the request start time
-
getRetrievalEndTime
Returns the timestamp indicating when the retrieval of the wrapped response completed.- Specified by:
getRetrievalEndTime
in interfaceDataRetrievalResponse<Integer>
- Returns:
- the retrieval end time
-
getRequestDuration
Returns the duration between the request start and the retrieval end time, as reported by the wrapped response.- Specified by:
getRequestDuration
in interfaceDataRetrievalResponse<Integer>
- Returns:
- the total duration of the request
-
isError
public boolean isError()Indicates whether an error occurred during data retrieval, based on the wrapped response.- Specified by:
isError
in interfaceDataRetrievalResponse<Integer>
- Returns:
true
if an error occurred. otherwisefalse
-
getErrorStatusCode
Returns the error status code from the wrapped response, if any.- Specified by:
getErrorStatusCode
in interfaceDataRetrievalResponse<Integer>
- Returns:
- the HTTP status code representing the error, or
null
if no error occurred
-
getErrorDescription
Returns a short description of the error from the wrapped response, if available.- Specified by:
getErrorDescription
in interfaceDataRetrievalResponse<Integer>
- Returns:
- the error description, or
null
if no error occurred
-
getResponseData
Returns the cardinality value as the response data. If the wrapped response indicates an error, this method throws an exception instead of returning a value.- Specified by:
getResponseData
in interfaceDataRetrievalResponse<Integer>
- Returns:
- the cardinality value
- Throws:
UnsupportedOperationDueToRetrievalError
- if the wrapped response indicates an error
-