Class FluentHelperByKey<FluentHelperT,EntityT extends VdmEntity<?>,SelectableT>
java.lang.Object
com.sap.cloud.sdk.datamodel.odata.helper.FluentHelperBasic<FluentHelperT,EntityT,EntityT>
com.sap.cloud.sdk.datamodel.odata.helper.FluentHelperByKey<FluentHelperT,EntityT,SelectableT>
- Type Parameters:
FluentHelperT
- The fluent helper type.EntityT
- The type of the result entity.SelectableT
- The type of the class that represents fields of the entity.
- All Implemented Interfaces:
FluentHelperExecutable<Object>
public abstract class FluentHelperByKey<FluentHelperT,EntityT extends VdmEntity<?>,SelectableT>
extends FluentHelperBasic<FluentHelperT,EntityT,EntityT>
Representation of an OData request to retrieve an entity by its key as a fluent interface for further configuring the
request and
executing
it.-
Field Summary
Fields inherited from class com.sap.cloud.sdk.datamodel.odata.helper.FluentHelperBasic
csrfTokenRetriever, entityCollection
-
Constructor Summary
ConstructorDescriptionFluentHelperByKey
(String servicePath, String entityCollection) Instantiates this fluent helper using the given service path and entity collection to send the requests. -
Method Summary
Modifier and TypeMethodDescriptionexecuteRequest
(Destination destination) Executes this request.getKey()
Getter for a map containing the OData name of key properties, each mapped to the value to search by.select
(SelectableT... fields) Query modifier to limit which field values of the entity get fetched & populated.Translate this OData v2 request into a OData request object extendingODataRequestGeneric
.Activates the CSRF token retrieval for this OData request.withQueryParameter
(String key, String value) Gives the option to specify custom query parameters for the request.Methods inherited from class com.sap.cloud.sdk.datamodel.odata.helper.FluentHelperBasic
getCsrfTokenRetriever, getEntityClass, getHeaders, getParametersForRequestOnly, getServicePath, getThis, withHeader, withHeaders
-
Constructor Details
-
FluentHelperByKey
Instantiates this fluent helper using the given service path and entity collection to send the requests.- Parameters:
servicePath
- The service path to direct the requests to.entityCollection
- The entity collection to direct the requests to.
-
-
Method Details
-
getKey
Getter for a map containing the OData name of key properties, each mapped to the value to search by.- Returns:
- A name-value mapping for the OData key properties.
-
toRequest
Description copied from class:FluentHelperBasic
Translate this OData v2 request into a OData request object extendingODataRequestGeneric
.- Specified by:
toRequest
in classFluentHelperBasic<FluentHelperT,
EntityT extends VdmEntity<?>, EntityT extends VdmEntity<?>> - Returns:
- A protocol agnostic OData request instance.
-
withQueryParameter
Description copied from class:FluentHelperBasic
Gives the option to specify custom query parameters for the request. The passed parameter value will be encoded with percentage encoding.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")
- Overrides:
withQueryParameter
in classFluentHelperBasic<FluentHelperT,
EntityT extends VdmEntity<?>, EntityT extends VdmEntity<?>> - Parameters:
key
- Name of the query parameter.value
- Unencoded value of the query parameter.- Returns:
- The same fluent helper.
-
select
Query modifier to limit which field values of the entity get fetched & populated. If this method is never called, then all fields will be fetched & populated. But if this method is called at least once, then only the specified fields will be fetched & populated. Calling this multiple times will combine the set(s) of fields of each call.- Parameters:
fields
- Array of fields to select.- Returns:
- The same fluent helper with the provided fields selected.
-
executeRequest
Description copied from interface:FluentHelperExecutable
Executes this request.- Specified by:
executeRequest
in interfaceFluentHelperExecutable<FluentHelperT>
- Specified by:
executeRequest
in classFluentHelperBasic<FluentHelperT,
EntityT extends VdmEntity<?>, EntityT extends VdmEntity<?>> - Parameters:
destination
- The target system this request should be issued against.- Returns:
- A response according to the query criteria.
-
withCsrfToken
Activates the CSRF token retrieval for this OData request. This is useful if the server does require CSRF tokens as part of the request.- Returns:
- The same builder
-