Class Request<RequestT extends Request<RequestT,RequestResultT>,RequestResultT extends RequestResult<RequestT,RequestResultT>>
java.lang.Object
com.sap.cloud.sdk.s4hana.connectivity.Request<RequestT,RequestResultT>
- Type Parameters:
RequestT- The generic request type.RequestResultT- The generic request result type.
public abstract class Request<RequestT extends Request<RequestT,RequestResultT>,RequestResultT extends RequestResult<RequestT,RequestResultT>>
extends Object
Common interface for ERP queries.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract RequestResultTexecute(Destination destination) Executes a given request using the givenDestination.abstract StringSet of HTTP headers to send to the underlying request executor.Custom execution duration threshold indicating that the request is long running.longRepresents an identifier that allows to correlate queries between the Cloud cloudplatform and the ERP.protected RequestTgetThis()Get the current instance reference.voidsetLongRunningRequestThreshold(Duration longRunningRequestThreshold) Custom execution duration threshold indicating that the request is long running.withHeader(Header header) Fluent method which adds a custom header to this request.withHeader(String name, String value) Fluent method which adds a custom HTTP header to this request.withSameCustomHttpHeadersAs(Request<?, ?> otherRequest) Fluent method which adds the custom headers from another request into this request.
-
Constructor Details
-
Request
protected Request()Default constructor.
-
-
Method Details
-
getConstructedByMethod
- Returns:
- The method name that originally constructed this ERP request. This information is used for debugging.
-
getReadAccessData
- Returns:
- A optional String representation of the data being access by this request. If present, an audit log entry is written using the given data.
-
getThis
Get the current instance reference.- Returns:
- The current object.
-
withHeader
Fluent method which adds a custom HTTP header to this request. Note that these headers will only be added to HTTP-based queries. If the header with the provided name already exists, the value is overwritten.- Parameters:
name- Header parameter name.value- Header parameter value.- Returns:
- The same
Requestinstance, so that this method can be used again in a fluent API style.
-
withHeader
Fluent method which adds a custom header to this request. Note that these headers will only be added to HTTP-based queries. If the header with the provided name already exists, the value is overwritten.- Parameters:
header- The custom header.- Returns:
- The same
Requestinstance, so that this method can be used again in a fluent API style.
-
withSameCustomHttpHeadersAs
Fluent method which adds the custom headers from another request into this request. Note that these headers will only be added to HTTP-based queries. If any headers in the other request already exist in this request, the values will be overwritten.- Parameters:
otherRequest- Other request to get header parameters from.- Returns:
- The same
Requestinstance, so that this method can be used again in a fluent API style.
-
execute
@Nonnull public abstract RequestResultT execute(@Nonnull Destination destination) throws RequestSerializationException, RequestExecutionException, DestinationNotFoundException, DestinationAccessException Executes a given request using the givenDestination.- Parameters:
destination- TheDestinationto be used for request execution.- Returns:
- The executed request result.
- Throws:
RequestSerializationException- If there is an issue while serializing the request.RequestExecutionException- If there is an issue while executing the request.DestinationNotFoundException- If no destination with the name specified in theDestinationcan be found.DestinationAccessException- If there is an issue while accessing destination information.
-
getRequestId
public long getRequestId()Represents an identifier that allows to correlate queries between the Cloud cloudplatform and the ERP.Important: The identifier does not provide any guarantees with respect to persistence across the application lifecycle. In particular, the identifier will be reset to 1 when restarting the application.
-
getLongRunningRequestThreshold
Custom execution duration threshold indicating that the request is long running. -
setLongRunningRequestThreshold
Custom execution duration threshold indicating that the request is long running. -
getCustomHttpHeaders
Set of HTTP headers to send to the underlying request executor. Note that these headers will only be added to HTTP-based queries.
-