Class BaseRestClient<T>

java.lang.Object
de.digitalcollections.client.BaseRestClient<T>
Direct Known Subclasses:
CudamiConfigClient, CudamiEntityRelationsClient, CudamiLocalesClient, CudamiRestClient, CudamiUrlAliasClient

public abstract class BaseRestClient<T> extends Object
  • Field Details

    • 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
    • targetType

      protected final Class<T> targetType
  • Constructor Details

    • BaseRestClient

      public BaseRestClient(HttpClient http, String serverUrl, Class<T> targetType, com.fasterxml.jackson.databind.ObjectMapper mapper, String baseEndpoint)
  • Method Details

    • create

      public T create() throws de.digitalcollections.model.exception.TechnicalException
      Throws:
      de.digitalcollections.model.exception.TechnicalException
    • createFullUri

      public URI createFullUri(String requestUrl)
    • 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

      public String 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

      public String getSortParams(de.digitalcollections.model.list.ListRequest listRequest)