Package de.digitalcollections.client
Class BaseRestClient<T>
java.lang.Object
de.digitalcollections.client.BaseRestClient<T>
- Direct Known Subclasses:
CudamiConfigClient,CudamiEntityRelationsClient,CudamiLocalesClient,CudamiRestClient,CudamiUrlAliasClient
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Stringprotected final HttpClientprotected final com.fasterxml.jackson.databind.ObjectMapperprotected final com.fasterxml.jackson.databind.ObjectReaderprotected final URI -
Constructor Summary
ConstructorsConstructorDescriptionBaseRestClient(HttpClient http, String serverUrl, Class<T> targetType, com.fasterxml.jackson.databind.ObjectMapper mapper, String baseEndpoint) -
Method Summary
Modifier and TypeMethodDescriptioncreate()createFullUri(String requestUrl) protected StringdoDeleteRequestForString(String requestUrl) protected TdoGetRequestForObject(String requestUrl) protected ObjectdoGetRequestForObject(String requestUrl, Class<?> targetType) doGetRequestForObjectList(String requestUrl) protected ListdoGetRequestForObjectList(String requestUrl, Class<?> targetType) protected ListdoGetRequestForObjectList(String requestUrl, Class<?> targetType, de.digitalcollections.model.list.filtering.Filtering filtering) protected de.digitalcollections.model.list.paging.PageResponse<T>doGetRequestForPagedObjectList(String requestUrl, de.digitalcollections.model.list.paging.PageRequest pageRequest) protected de.digitalcollections.model.list.paging.PageResponsedoGetRequestForPagedObjectList(String requestUrl, de.digitalcollections.model.list.paging.PageRequest pageRequest, Class<?> targetType) protected StringdoGetRequestForString(String requestUrl) protected StringdoPatchRequestForString(String requestUrl) protected StringdoPatchRequestForString(String requestUrl, Object object) protected TdoPostRequestForObject(String requestUrl) protected ObjectdoPostRequestForObject(String requestUrl, Class<?> targetType) protected ObjectdoPostRequestForObject(String requestUrl, Object bodyObject, Class<?> targetType) protected TdoPostRequestForObject(String requestUrl, T object) doPostRequestForObjectList(String requestUrl, List<Class<?>> list, Class<?> targetType) doPostRequestForObjectList(String requestUrl, List<T> list) protected StringdoPostRequestForString(String requestUrl) protected StringdoPostRequestForString(String requestUrl, Object object) protected ObjectdoPutRequestForObject(String requestUrl, Object bodyObject, Class<?> targetType) protected TdoPutRequestForObject(String requestUrl, T object) doPutRequestForObjectList(String requestUrl, List<Class<?>> list, Class<?> targetType) protected StringdoPutRequestForString(String requestUrl, Object object) Get the base endpoint path for testing purposesgetFilterParamsAsString(de.digitalcollections.model.list.filtering.Filtering filtering) Converts the given list of filter criterias to a request stringgetFindParamsAsString(de.digitalcollections.model.list.paging.PageRequest pageRequest) Converts the given pagerequest to a request stringgetSortParams(de.digitalcollections.model.list.ListRequest listRequest)
-
Field Details
-
baseEndpoint
-
http
-
mapper
protected final com.fasterxml.jackson.databind.ObjectMapper mapper -
reader
protected final com.fasterxml.jackson.databind.ObjectReader reader -
serverUri
-
targetType
-
-
Constructor Details
-
BaseRestClient
public BaseRestClient(HttpClient http, String serverUrl, Class<T> targetType, com.fasterxml.jackson.databind.ObjectMapper mapper, String baseEndpoint)
-
-
Method Details
-
create
- Throws:
de.digitalcollections.model.exception.TechnicalException
-
createFullUri
-
doDeleteRequestForString
protected String doDeleteRequestForString(String requestUrl) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doGetRequestForObject
protected T doGetRequestForObject(String requestUrl) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doGetRequestForObject
protected Object doGetRequestForObject(String requestUrl, Class<?> targetType) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doGetRequestForObjectList
protected List<T> doGetRequestForObjectList(String requestUrl) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doGetRequestForObjectList
protected List doGetRequestForObjectList(String requestUrl, Class<?> targetType) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doGetRequestForObjectList
protected List doGetRequestForObjectList(String requestUrl, Class<?> targetType, de.digitalcollections.model.list.filtering.Filtering filtering) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doGetRequestForPagedObjectList
protected de.digitalcollections.model.list.paging.PageResponse<T> doGetRequestForPagedObjectList(String requestUrl, de.digitalcollections.model.list.paging.PageRequest pageRequest) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doGetRequestForPagedObjectList
protected de.digitalcollections.model.list.paging.PageResponse doGetRequestForPagedObjectList(String requestUrl, de.digitalcollections.model.list.paging.PageRequest pageRequest, Class<?> targetType) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doGetRequestForString
protected String doGetRequestForString(String requestUrl) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doPatchRequestForString
protected String doPatchRequestForString(String requestUrl) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doPatchRequestForString
protected String doPatchRequestForString(String requestUrl, Object object) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doPostRequestForObject
protected T doPostRequestForObject(String requestUrl, T object) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doPostRequestForObject
protected Object doPostRequestForObject(String requestUrl, Object bodyObject, Class<?> targetType) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doPostRequestForObject
protected T doPostRequestForObject(String requestUrl) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doPostRequestForObject
protected Object doPostRequestForObject(String requestUrl, Class<?> targetType) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doPostRequestForObjectList
protected List<T> doPostRequestForObjectList(String requestUrl, List<T> list) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doPostRequestForObjectList
protected List<Class<?>> doPostRequestForObjectList(String requestUrl, List<Class<?>> list, Class<?> targetType) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doPostRequestForString
protected String doPostRequestForString(String requestUrl) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doPostRequestForString
protected String doPostRequestForString(String requestUrl, Object object) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doPutRequestForObject
protected T doPutRequestForObject(String requestUrl, T object) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doPutRequestForObject
protected Object doPutRequestForObject(String requestUrl, Object bodyObject, Class<?> targetType) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doPutRequestForObjectList
protected List<Class<?>> doPutRequestForObjectList(String requestUrl, List<Class<?>> list, Class<?> targetType) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
doPutRequestForString
protected String doPutRequestForString(String requestUrl, Object object) throws de.digitalcollections.model.exception.TechnicalException - Throws:
de.digitalcollections.model.exception.TechnicalException
-
getBaseEndpoint
Get the base endpoint path for testing purposes- Returns:
- the relative base endpoint of the client
-
getFilterParamsAsString
public String getFilterParamsAsString(de.digitalcollections.model.list.filtering.Filtering filtering) Converts the given list of filter criterias to a request string- Parameters:
filtering- a filtering with a list of filter criterias- Returns:
- the filter criterias as request string
-
getFindParamsAsString
public String getFindParamsAsString(de.digitalcollections.model.list.paging.PageRequest pageRequest) Converts the given pagerequest to a request string- Parameters:
pageRequest- source for find params- Returns:
- the find params as request string
-
getSortParams
-