Package de.digitalcollections.client
Class BaseRestClient<T>
- java.lang.Object
-
- de.digitalcollections.client.BaseRestClient<T>
-
- Direct Known Subclasses:
CudamiConfigClient,CudamiEntityRelationsClient,CudamiLocalesClient,CudamiPredicatesClient,CudamiRestClient,CudamiUrlAliasClient
public abstract class BaseRestClient<T> extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected StringbaseEndpointprotected HttpClienthttpprotected com.fasterxml.jackson.databind.ObjectMappermapperprotected com.fasterxml.jackson.databind.ObjectReaderreaderprotected URIserverUriprotected Class<T>targetType
-
Constructor Summary
Constructors Constructor Description BaseRestClient(HttpClient http, String serverUrl, Class<T> targetType, com.fasterxml.jackson.databind.ObjectMapper mapper, String baseEndpoint)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tcreate()URIcreateFullUri(String requestUrl)protected StringdoDeleteRequestForString(String requestUrl)protected TdoGetRequestForObject(String requestUrl)protected ObjectdoGetRequestForObject(String requestUrl, Class<?> targetType)protected List<T>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)protected List<Class<?>>doPostRequestForObjectList(String requestUrl, List<Class<?>> list, Class<?> targetType)protected List<T>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)protected List<Class<?>>doPutRequestForObjectList(String requestUrl, List<Class<?>> list, Class<?> targetType)protected StringdoPutRequestForString(String requestUrl, Object object)protected StringfilterCriterionToUrlParam(de.digitalcollections.model.list.filtering.FilterCriterion filterCriterion)StringgetBaseEndpoint()Get the base endpoint path for testing purposes
-
-
-
Field Detail
-
baseEndpoint
protected final String baseEndpoint
-
http
protected final HttpClient http
-
mapper
protected final com.fasterxml.jackson.databind.ObjectMapper mapper
-
reader
protected final com.fasterxml.jackson.databind.ObjectReader reader
-
serverUri
protected final URI serverUri
-
-
Constructor Detail
-
BaseRestClient
public BaseRestClient(HttpClient http, String serverUrl, Class<T> targetType, com.fasterxml.jackson.databind.ObjectMapper mapper, String baseEndpoint)
-
-
Method Detail
-
create
public T create() throws de.digitalcollections.model.exception.TechnicalException
- Throws:
de.digitalcollections.model.exception.TechnicalException
-
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
-
filterCriterionToUrlParam
protected String filterCriterionToUrlParam(de.digitalcollections.model.list.filtering.FilterCriterion filterCriterion)
-
getBaseEndpoint
public String getBaseEndpoint()
Get the base endpoint path for testing purposes- Returns:
- the relative base endpoint of the client
-
-