EntityT
- The type of the result entity.public class GetAllRequestBuilder<EntityT extends VdmEntity<?>> extends Object implements ReadRequestBuilder<List<EntityT>>
executing
it.Constructor and Description |
---|
GetAllRequestBuilder(String servicePath,
Class<EntityT> entityClass)
Instantiates this request builder using the given service path to send the requests.
|
Modifier and Type | Method and Description |
---|---|
List<EntityT> |
execute(HttpDestinationProperties destination)
Execute the OData request.
|
GetAllRequestBuilder<EntityT> |
filter(FilterableBoolean<EntityT>... filters)
Filter on properties of EntityT.
|
String |
getEncodedQueryString()
Return the percentage encoded string representation of the underlying request that is being build by this request
builder.
|
protected Class<EntityT> |
getEntityClass()
Returns a class object of the type this request builder works with.
|
protected Map<String,String> |
getHeaders()
A map containing the headers to be used only for the actual request of this FluentHelper implementation.
|
protected List<ODataRequestListener> |
getListeners() |
protected Map<String,String> |
getParametersForRequestOnly()
A map containing the custom query parameters to be used only for the actual request of this FluentHelper
implementation.
|
String |
getQueryString()
Return the string representation of the underlying request that is being build by this request builder.
|
protected ODataResourcePath |
getResourcePath() |
protected String |
getServicePath() |
protected BuilderT |
getThis()
Get the reference to this instance.
|
RequestBuilderExecutable<Iterable<EntityT>> |
iteratingEntities()
Iterate through all entities from the result-set.
|
RequestBuilderExecutable<Iterable<List<EntityT>>> |
iteratingPages()
Manually explore the individual pages from the result-set.
|
GetAllRequestBuilder<EntityT> |
orderBy(FieldOrdering<EntityT>... ordering)
Sort the set of returned entities by non-complex fields.
|
GetAllRequestBuilder<EntityT> |
search(SearchExpression expression)
Request modifier to return the set of entities corresponding to the specified boolean expression.
|
GetAllRequestBuilder<EntityT> |
search(String search)
Request modifier to return the set of entities that contain the specified value.
|
GetAllRequestBuilder<EntityT> |
select(Property<EntityT>... fields)
Query modifier to limit which field values of the entity EntityT get fetched and populated.
|
GetAllRequestBuilder<EntityT> |
skip(int skip)
Determine the how many first N entities of the result set should be skipped.
|
RequestBuilderExecutable<Stream<EntityT>> |
streamingEntities()
Stream through all entities from the result-set.
|
GetAllRequestBuilder<EntityT> |
top(int top)
Limit the number of results of this request.
|
ODataRequestRead |
toRequest()
Creates an instance of the
ODataRequestRead based on the Entity class. |
BuilderT |
withHeader(String key,
String value)
Gives the option to specify custom HTTP headers.
|
BuilderT |
withHeaders(Map<String,String> map)
Gives the option to specify a map of custom HTTP headers.
|
BuilderT |
withListener(ODataRequestListener listener)
An error handling class that implements the error result handler interface can be attached to this request
builder.
|
GetAllRequestBuilder<EntityT> |
withPreferredPageSize(int size)
Set the preferred page size of the OData response.
|
BuilderT |
withQueryParameter(String key,
String value)
Gives the option to specify custom query parameters for the request.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
withHeader, withHeaders
tryExecute
public GetAllRequestBuilder(@Nonnull String servicePath, @Nonnull Class<EntityT> entityClass)
servicePath
- The service path to direct the requests to.entityClass
- The expected entity type.@Nonnull @Beta public ODataRequestRead toRequest()
ODataRequestRead
based on the Entity class.
The following settings are used:
toRequest
in interface RequestBuilder<List<EntityT extends VdmEntity<?>>>
ODataRequestRead
.@Beta @Nonnull public String getEncodedQueryString()
@Beta @Nonnull public String getQueryString()
@Nonnull public List<EntityT> execute(@Nonnull HttpDestinationProperties destination)
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()
and
iteratingPages()
.
execute
in interface RequestBuilderExecutable<List<EntityT extends VdmEntity<?>>>
destination
- The destination to be used as request target.@Beta @Nonnull public RequestBuilderExecutable<Iterable<List<EntityT>>> iteratingPages()
RequestBuilderExecutable
with a response object to lazily iterate through the
pages of entities.@Beta @Nonnull public RequestBuilderExecutable<Iterable<EntityT>> iteratingEntities()
RequestBuilderExecutable
with a response object to lazily iterate through the
entities.@Beta @Nonnull public RequestBuilderExecutable<Stream<EntityT>> streamingEntities()
RequestBuilderExecutable
with a response object to lazily iterate through the
entities.@Nonnull @Beta public GetAllRequestBuilder<EntityT> withPreferredPageSize(int size)
Note: The OData service might ignore the preferred page size setting and may not use pagination at all.
size
- The preferred page size@SafeVarargs @Nonnull public final GetAllRequestBuilder<EntityT> select(@Nonnull Property<EntityT>... fields)
fields
- Properties of EntityT to be selected.@SafeVarargs @Nonnull public final GetAllRequestBuilder<EntityT> filter(@Nonnull FilterableBoolean<EntityT>... filters)
filters
- Filter expressions to be added to the request.@Nonnull public GetAllRequestBuilder<EntityT> top(int top)
top
- The maximum amount of elements this request shall return.@Nonnull public GetAllRequestBuilder<EntityT> skip(int skip)
skip
- The amount of elements this request will skip.@SafeVarargs @Nonnull @Beta public final GetAllRequestBuilder<EntityT> orderBy(@Nonnull FieldOrdering<EntityT>... ordering)
ordering
- Fields to sort by.@Nonnull public GetAllRequestBuilder<EntityT> search(@Nonnull String search)
search
- A string value as the search criteria.@Nonnull public GetAllRequestBuilder<EntityT> search(@Nonnull SearchExpression expression)
expression
- SearchExpression as the search criteria@Nonnull protected Class<EntityT> getEntityClass()
@Nonnull protected BuilderT getThis()
@Nonnull @Beta public BuilderT withListener(@Nonnull ODataRequestListener listener)
execute
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.listener
- Instance of an error handler class that implements the error result handler interface.@Nonnull public BuilderT withHeader(@Nonnull String key, @Nullable String value)
RequestBuilder
withHeader
in interface RequestBuilder<ResultT>
key
- Name of the (first) desired HTTP header parameter.value
- Value of the (first) desired HTTP header parameter.@Nonnull public BuilderT withHeaders(@Nonnull Map<String,String> map)
RequestBuilder
withHeaders
in interface RequestBuilder<ResultT>
map
- A map of HTTP header key/value pairs.@Nonnull @Beta public BuilderT withQueryParameter(@Nonnull String key, @Nullable String value)
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")
key
- Name of the query parameter.value
- Value of the query parameter.@Nonnull protected ODataResourcePath getResourcePath()
@Nonnull protected Map<String,String> getHeaders()
@Nonnull protected Map<String,String> getParametersForRequestOnly()
@Nonnull protected List<ODataRequestListener> getListeners()
Copyright © 2021 SAP SE. All rights reserved.