Class PatchBuilder<T extends ResourceNode>
java.lang.Object
de.captaingoldfish.scim.sdk.client.builder.RequestBuilder<T>
de.captaingoldfish.scim.sdk.client.builder.ETagRequestBuilder<T>
de.captaingoldfish.scim.sdk.client.builder.PatchBuilder<T>
allows to build a patch request that can be sent to the server
created at: 01.05.2020
created at: 01.05.2020
- Author:
- Pascal Knüppel
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classused to build a simple patch operation -
Constructor Summary
ConstructorsConstructorDescriptionPatchBuilder(String fullUrl, Class<T> responseEntityType, ScimHttpClient scimHttpClient) if the resource should be retrieved by using the fully qualified urlPatchBuilder(String baseUrl, String endpoint, String resourceId, Class<T> responseEntityType, ScimHttpClient scimHttpClient) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.http.client.methods.HttpUriRequestbuilds the request for the serverprotected org.apache.http.client.methods.HttpUriRequestgetHttpUriRequest(List<PatchRequestOperation> operations) builds the http-request for the apache http clientfinal Stringthe resource that should be sent to the service providerfinal StringgetResource(List<PatchRequestOperation> operations) allows to set a specific set of operations.protected booleanisExpectedResponseCode(int httpStatus) tells this abstract class if the http status from the server is the expected success statussendRequestWithMultiHeaders(Map<String, String[]> httpHeaders) this method will split the operations into the appropriate number of max operations per requests and will send all patch-requests one by one to the remote SCIM provider.setExpectedResponseHeaders(Map<String, String> requiredResponseHeaders) Set this if the SCIM provider is not behaving SCIM compliant by manipulating the expected headers that will be returned from the server null: The headers are checked as normally for the content-type "application/scim+json" empty map: The check of response headers is disabled filled map: The check of the response headers will be done with the entries of this mapsetPatchResource(PatchOpRequest resource) sets the patch request directly if already build into the request contextsetPatchResource(String resource) sets the patch request directly if already build into the request contextprotected List<List<PatchRequestOperation>>splitOperations(int maxNumberOfOperations) splits the operations list into several lists with a maximum number of the given parameterMethods inherited from class de.captaingoldfish.scim.sdk.client.builder.ETagRequestBuilder
getVersion, isUseIfMatch, isUseIfNoneMatch, setETagForIfMatch, setETagForIfMatch, setETagForIfNoneMatch, setETagForIfNoneMatchMethods inherited from class de.captaingoldfish.scim.sdk.client.builder.RequestBuilder
addHeaderToRequest, getBaseUrl, getEndpoint, getRequiredHttpHeaders, getRequiredResponseHeaders, getResponseEntityType, getScimHttpClient, isResponseParseable, sendRequest, sendRequest, setResource, setResource, toResponse
-
Constructor Details
-
PatchBuilder
if the resource should be retrieved by using the fully qualified url- Parameters:
fullUrl- the fully qualified url to the required resourceresponseEntityType- the type of the resource that should be returnedscimHttpClient- the http client instance
-
PatchBuilder
-
-
Method Details
-
setExpectedResponseHeaders
Set this if the SCIM provider is not behaving SCIM compliant by manipulating the expected headers that will be returned from the server- null: The headers are checked as normally for the content-type "application/scim+json"
- empty map: The check of response headers is disabled
- filled map: The check of the response headers will be done with the entries of this map
- Overrides:
setExpectedResponseHeadersin classRequestBuilder<T extends ResourceNode>
-
isExpectedResponseCode
protected boolean isExpectedResponseCode(int httpStatus) tells this abstract class if the http status from the server is the expected success status- Specified by:
isExpectedResponseCodein classRequestBuilder<T extends ResourceNode>- Parameters:
httpStatus- the http status from the server- Returns:
- true if the response status shows success
-
setPatchResource
sets the patch request directly if already build into the request context- Parameters:
resource- the patch request representation
-
setPatchResource
sets the patch request directly if already build into the request context- Parameters:
resource- the patch request representation
-
addOperation
- Returns:
- an operation builder to add a new operation
-
getHttpUriRequest
protected org.apache.http.client.methods.HttpUriRequest getHttpUriRequest()builds the request for the server- Specified by:
getHttpUriRequestin classRequestBuilder<T extends ResourceNode>
-
getHttpUriRequest
protected org.apache.http.client.methods.HttpUriRequest getHttpUriRequest(List<PatchRequestOperation> operations) builds the http-request for the apache http client -
getResource
Description copied from class:RequestBuilderthe resource that should be sent to the service provider- Overrides:
getResourcein classRequestBuilder<T extends ResourceNode>- Returns:
- the resource that will be sent to the server
-
getResource
allows to set a specific set of operations. We use this method if we automatically split the patch request into several requests due to the amount of operations -
sendRequestWithMultiHeaders
this method will split the operations into the appropriate number of max operations per requests and will send all patch-requests one by one to the remote SCIM provider.- Overrides:
sendRequestWithMultiHeadersin classRequestBuilder<T extends ResourceNode>- Parameters:
httpHeaders- allows the user to add additional http headers to the request- Returns:
- the response from the given request. A response must not be returned in any case from the service provider so the returned type is still optional
-
splitOperations
splits the operations list into several lists with a maximum number of the given parameter
-