Class GetAllRequestBuilder<EntityT extends VdmEntity<?>>
- Type Parameters:
EntityT
- The type of the result entity.
- All Implemented Interfaces:
ReadRequestBuilder<List<EntityT>>
,RequestBuilder<List<EntityT>>
,RequestBuilderExecutable<List<EntityT>>
executing
it.-
Field Summary
-
Constructor Summary
ConstructorDescriptionGetAllRequestBuilder
(String servicePath, Class<EntityT> entityClass, String entityCollection) Instantiates this request builder using the given service path to send the requests. -
Method Summary
Modifier and TypeMethodDescriptionexecute
(Destination destination) Execute the OData request.final GetAllRequestBuilder<EntityT>
filter
(FilterableBoolean<EntityT>... filters) Returns a class object of the type this request builder works with.protected Map<String,
Collection<String>> A map containing the headers to be used only for the actual request of this FluentHelper implementation.protected List<ODataRequestListener>
A map containing the custom query parameters to be used only for the actual request of this FluentHelper implementation.protected ODataResourcePath
protected String
protected GetAllRequestBuilder<EntityT>
getThis()
Get the reference to this instance.Iterate through all entities from the result-set.Manually explore the individual pages from the result-set.final GetAllRequestBuilder<EntityT>
orderBy
(FieldOrdering<EntityT>... ordering) search
(SearchExpression expression) final GetAllRequestBuilder<EntityT>
skip
(int skip) Stream through all entities from the result-set.top
(int top) Creates an instance of theODataRequestRead
based on the Entity class.Activates the CSRF token retrieval for this OData request.withHeader
(String key, String value) Gives the option to specify custom HTTP headers.withHeaders
(Map<String, String> map) Gives the option to specify a map of custom HTTP headers.withListener
(ODataRequestListener listener) An error handling class that implements the error result handler interface can be attached to this request builder.withPreferredPageSize
(int size) Set the preferred page size of the OData response.withQueryParameter
(String key, String value) Gives the option to specify custom query parameters for the request.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.sap.cloud.sdk.datamodel.odatav4.core.RequestBuilder
withHeader, withHeaders
Methods inherited from interface com.sap.cloud.sdk.datamodel.odatav4.core.RequestBuilderExecutable
tryExecute
-
Field Details
-
csrfTokenRetriever
-
-
Constructor Details
-
GetAllRequestBuilder
public GetAllRequestBuilder(@Nonnull String servicePath, @Nonnull Class<EntityT> entityClass, @Nonnull String entityCollection) Instantiates this request builder using the given service path to send the requests.- Parameters:
servicePath
- The service path to direct the requests to.entityClass
- The expected entity type.entityCollection
- The entity collection
-
-
Method Details
-
toRequest
Creates an instance of theODataRequestRead
based on the Entity class.The following settings are used:
- the endpoint URL
- the entity collection name
- the number of entries to select (top)
- the number of entries to ignore (skip)
- the order direction
- the filters to be applied
- the fields to be selected
- Specified by:
toRequest
in interfaceRequestBuilder<EntityT extends VdmEntity<?>>
- Returns:
- An initialized
ODataRequestRead
.
-
execute
Execute the OData request.Note: If the OData service responds with service-driven pagination, then the pages will be iterated automatically. The returned list is an eagerly loaded aggregation of all pages. Access to a lazy loading result-set can be enabled through the modifiers
iteratingEntities()
,streamingEntities()
anditeratingPages()
.- Specified by:
execute
in interfaceRequestBuilderExecutable<EntityT extends VdmEntity<?>>
- Parameters:
destination
- The destination to be used as request target.- Returns:
- The generic OData response result.
-
iteratingPages
Manually explore the individual pages from the result-set. The returning object allows for memory-efficient consumption of all data through server-driven pagination.- Returns:
- An instance of
RequestBuilderExecutable
with a response object to lazily iterate through the pages of entities.
-
iteratingEntities
Iterate through all entities from the result-set. The individual pages of the result-set are queried lazily. The returning object allows for memory-efficient consumption of all data through server-driven pagination.- Returns:
- An instance of
RequestBuilderExecutable
with a response object to lazily iterate through the entities.
-
streamingEntities
Stream through all entities from the result-set. The individual pages of the result-set are queried lazily. The returning object allows for memory-efficient consumption of all data through server-driven pagination.- Returns:
- An instance of
RequestBuilderExecutable
with a response object to lazily iterate through the entities.
-
withPreferredPageSize
Set the preferred page size of the OData response. A result-set may be split into multiple pages, each including a subset of the entities matching the query.Note: The OData service might ignore the preferred page size setting and may not use pagination at all.
- Parameters:
size
- The preferred page size- Returns:
- This request object with the added parameter.
-
select
@SafeVarargs @Nonnull public final GetAllRequestBuilder<EntityT> select(@Nonnull Property<EntityT>... fields) -
filter
@SafeVarargs @Nonnull public final GetAllRequestBuilder<EntityT> filter(@Nonnull FilterableBoolean<EntityT>... filters) -
top
-
skip
-
orderBy
@SafeVarargs @Nonnull public final GetAllRequestBuilder<EntityT> orderBy(@Nonnull FieldOrdering<EntityT>... ordering) -
search
-
search
-
withCsrfToken
Description copied from interface:ReadRequestBuilder
Activates the CSRF token retrieval for this OData request. This is useful if the server does require CSRF tokens as part of the request.- Specified by:
withCsrfToken
in interfaceReadRequestBuilder<EntityT extends VdmEntity<?>>
- Returns:
- The same builder
-
getEntityClass
Returns a class object of the type this request builder works with.- Returns:
- A class object of the handled type.
-
getThis
Get the reference to this instance.- Returns:
- The FluentHelper instance.
-
withListener
An error handling class that implements the error result handler interface can be attached to this request builder. This allows custom logic to be called when an error occurs in theexecute
method. If this method is not called, then an instance of ODataRequestListener is used. Only one handler can be attached at a time per request builder object, so calling this multiple times will replace the handler.- Parameters:
listener
- Instance of an error handler class that implements the error result handler interface.- Returns:
- The same request builder with its error handler set to the provided object.
-
withHeader
@Nonnull public GetAllRequestBuilder<EntityT> withHeader(@Nonnull String key, @Nullable String value) Description copied from interface:RequestBuilder
Gives the option to specify custom HTTP headers. Multiple headers with the same key can be specified. The returned object allows to specify the requests the headers should be used in.- Specified by:
withHeader
in interfaceRequestBuilder<BuilderT extends RequestBuilder<ResultT>>
- Parameters:
key
- Name of the (first) desired HTTP header parameter.value
- Value of the (first) desired HTTP header parameter.- Returns:
- A request builder to specify further headers and their intended usage.
-
withHeaders
Description copied from interface:RequestBuilder
Gives the option to specify a map of custom HTTP headers. The returned object allows to specify the requests the headers should be used in.- Specified by:
withHeaders
in interfaceRequestBuilder<BuilderT extends RequestBuilder<ResultT>>
- Parameters:
map
- A map of HTTP header key/value pairs.- Returns:
- A request builder to specify further headers and their intended usage.
-
withQueryParameter
@Nonnull public GetAllRequestBuilder<EntityT> withQueryParameter(@Nonnull String key, @Nullable String value) Gives the option to specify custom query parameters for the request.Note: It is recommended to only use this function for query parameters which are not supported by the VDM by default. Using this function to bypass request builder method calls can lead to unsupported response handling. There is no contract on the order or priority of parameters added to the request.
Example: Use the request query option
$search
to reduce the result set, leaving only entities which match the specified search expression. This feature is supported in protocol OData v4.new DefaultBusinessPartnerService().getAllBusinessPartner().withQueryParameter("$search", "Köln OR Cologne")
- Parameters:
key
- Name of the query parameter.value
- Value of the query parameter.- Returns:
- The same request builder.
-
getServicePath
-
getResourcePath
-
getHeaders
A map containing the headers to be used only for the actual request of this FluentHelper implementation. -
getParametersForRequestOnly
A map containing the custom query parameters to be used only for the actual request of this FluentHelper implementation. -
getListeners
-