FluentHelperT
- The fluent helper type.EntityT
- The type of the result entity.SelectableT
- The type of the class that represents fields of the entity
.public abstract class FluentHelperRead<FluentHelperT,EntityT extends VdmEntity<?>,SelectableT> extends FluentHelperBasic<FluentHelperT,EntityT,List<EntityT>>
executing
it.Constructor and Description |
---|
FluentHelperRead(String servicePath)
Instantiates this fluent helper using the given service path to send the requests.
|
FluentHelperRead(String servicePath,
String entityCollection)
Instantiates this fluent helper using the given service path and entity collection to send the requests.
|
Modifier and Type | Method and Description |
---|---|
FluentHelperCount |
count()
Query modifier to return only the number of tuples that match the criteria specified in the query.
|
List<EntityT> |
execute(HttpDestinationProperties destination)
Deprecated.
Use the improved method
executeRequest(HttpDestinationProperties) instead. |
List<EntityT> |
executeRequest(HttpDestinationProperties destination)
Executes this request.
|
FluentHelperT |
filter(FilterExpressionHelper<EntityT> expression)
Query modifier to restrict the set of returned entities based on the values of one or more fields.
|
protected com.sap.cloud.sdk.odatav2.connectivity.ODataQueryBuilder |
getQueryBuilder()
Deprecated.
|
FluentHelperExecutable<Iterable<EntityT>> |
iteratingEntities()
Manually explore the individual entities from the lazy-loading entity result-set.
|
FluentHelperExecutable<Iterable<List<EntityT>>> |
iteratingPages()
Manually explore the individual pages from the lazy-loading entity result-set.
|
FluentHelperT |
orderBy(EntityField<EntityT,?> field,
Order order)
Query modifier to sort the set of returned entities by one or more fields.
|
FluentHelperT |
select(SelectableT... fields)
Query modifier to limit which field values of the entity get fetched and populated, and to specify which
navigation properties to expand.
|
FluentHelperT |
skip(Number skip)
Query modifier to not return the first N entities of the result set.
|
FluentHelperExecutable<Stream<EntityT>> |
streamingEntities()
Manually explore the individual entities from the lazy-loading entity result-set.
|
FluentHelperT |
top(Number top)
Query modifier to limit the number of entities returned.
|
com.sap.cloud.sdk.odatav2.connectivity.ODataQuery |
toQuery()
Deprecated.
Use the improved method
toRequest() instead. |
ODataRequestRead |
toRequest()
Translate this OData v2 request into a OData request object extending
ODataRequestGeneric . |
FluentHelperT |
withErrorHandler(com.sap.cloud.sdk.odatav2.connectivity.ErrorResultHandler<?> errorResultHandler)
Deprecated.
Obsolete, refer to
ODataException and its subclasses to achieve fine-grained separation of
error causes. |
FluentHelperT |
withPreferredPageSize(int size)
Set the preferred page size of the OData response.
|
FluentHelperT |
withQueryParameter(String key,
String value)
Gives the option to specify custom query parameters for the request.
|
and, cachingMetadata, getEntityClass, getHeaders, getHeadersForRequestAndImplicitRequests, getHeadersForRequestOnly, getParametersForRequestOnly, getServicePath, getThis, getVersionIdentifier, isCachingMetadata, onRequestAndImplicitRequests, onRequestOnly, withHeader, withHeaders, withoutCachingMetadata
public FluentHelperRead(@Nonnull String servicePath)
servicePath
- The service path to direct the requests to.public FluentHelperRead(@Nonnull String servicePath, @Nonnull String entityCollection)
servicePath
- The service path to direct the requests to.entityCollection
- The entity collection to direct the requests to.@Nonnull @Deprecated protected com.sap.cloud.sdk.odatav2.connectivity.ODataQueryBuilder getQueryBuilder()
ODataQueryBuilder
based on the Entity class.
The following settings are used to build the ODataQueryBuilder
:
ODataQueryBuilder
.@Beta @Nonnull public ODataRequestRead toRequest()
FluentHelperBasic
ODataRequestGeneric
.@Nonnull public FluentHelperT 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 fluent helper method calls can lead to unsupported response handling. There is no contract on the order or priority of parameters added to the query.
Example: Use the 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")
withQueryParameter
in class FluentHelperBasic<FluentHelperT,EntityT extends VdmEntity<?>,List<EntityT extends VdmEntity<?>>>
key
- Name of the query parameter.value
- Unencoded value of the query parameter.@Nonnull public FluentHelperT select(@Nonnull SelectableT... fields)
fields
- Fields to select and/or navigation properties to expand.@Nonnull public FluentHelperT orderBy(@Nonnull EntityField<EntityT,?> field, @Nonnull Order order)
field
- Field to sort by.order
- Sorting direction to use (ascending or descending).@Nonnull public FluentHelperT top(@Nonnull Number top)
top
- Number of entities to limit the result set to.@Nonnull public FluentHelperT skip(@Nonnull Number skip)
skip
- Number of entities to skip by.@Nonnull @Deprecated public FluentHelperT withErrorHandler(@Nonnull com.sap.cloud.sdk.odatav2.connectivity.ErrorResultHandler<?> errorResultHandler)
ODataException
and its subclasses to achieve fine-grained separation of
error causes.ErrorResultHandler
interface can be
attached to this fluent helper. This allows custom logic to be called when an error occurs in the execute
method. If this method is not called, then an instance of
ODataVdmErrorResultHandler
is used.
Only one handler can be attached at a time per fluent helper object, so calling this multiple times will replace
the handler.errorResultHandler
- Instance of an error handler class that implements the ErrorResultHandler
interface.@Nonnull @Deprecated public com.sap.cloud.sdk.odatav2.connectivity.ODataQuery toQuery()
toRequest()
instead.@Nonnull @Deprecated public List<EntityT> execute(@Nonnull HttpDestinationProperties destination) throws com.sap.cloud.sdk.odatav2.connectivity.ODataException
executeRequest(HttpDestinationProperties)
instead.execute
in class FluentHelperBasic<FluentHelperT,EntityT extends VdmEntity<?>,List<EntityT extends VdmEntity<?>>>
destination
- Supply the destination for executing the underlying OData query.com.sap.cloud.sdk.odatav2.connectivity.ODataException
- The exception occurred during request execution@Nonnull public List<EntityT> executeRequest(@Nonnull HttpDestinationProperties destination) throws ODataException
Note: This is an alternative to FluentHelperBasic.execute(HttpDestinationProperties)
. Contrary to
FluentHelperBasic.execute(HttpDestinationProperties)
this operation does not request the service metadata before
performing the actual request. As a consequence FluentHelperBasic.withoutCachingMetadata()
and FluentHelperBasic.cachingMetadata()
have no effect on this operation. Furthermore, error handlers registered via
withErrorHandler(ErrorResultHandler)
will not be respected.
executeRequest
in interface FluentHelperExecutable<Object>
executeRequest
in class FluentHelperBasic<FluentHelperT,EntityT extends VdmEntity<?>,List<EntityT extends VdmEntity<?>>>
destination
- The target system this request should be issued against.ODataException
- If the OData request execution failed.@Nonnull @Beta public FluentHelperExecutable<Iterable<List<EntityT>>> iteratingPages()
FluentHelperExecutable
that allows for lazy iteration through the result-set
pages.@Nonnull @Beta public FluentHelperExecutable<Iterable<EntityT>> iteratingEntities()
FluentHelperExecutable
that allows for lazy iteration through the result-set
pages.@Nonnull @Beta public FluentHelperExecutable<Stream<EntityT>> streamingEntities()
FluentHelperExecutable
that allows for lazy iteration through the result-set
pages.@Nonnull public FluentHelperT filter(@Nonnull FilterExpressionHelper<EntityT> expression)
expression
- Fluent helper that represents a field value expression. To create this, start with an
EntityField
constant in your respective
entity type for the desired entity field. Then call one of the comparison operators and provide a
comparison value. Optionally the resulting fluent helper can be chained with other expression fluent
helpers.@Nonnull public FluentHelperCount count()
@Nonnull @Beta public FluentHelperT 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 sizeCopyright © 2021 SAP SE. All rights reserved.