Class AbstractBackofficeEndpoint<E,MIT,MRT extends es.kukenan.smartfi.microservice.backoffice.dtos.core.response.CoreResponse<MIT>,M extends AbstractBackofficeResponseMapper<E,MIT>>

java.lang.Object
es.kukenan.smartfi.microservice.onboarding.service.backoffice.AbstractEndpointClient
es.kukenan.smartfi.microservice.onboarding.service.backoffice.api.AbstractBackofficeEndpoint<E,MIT,MRT,M>
Type Parameters:
E - Skyline entity to return.
MIT - Backoffice item.
MRT - Backoffice response.
M - Mapper to transform a Backoffice item in a Skyline entity.
Direct Known Subclasses:
BackofficeRequestedFilesEndpoint

public abstract class AbstractBackofficeEndpoint<E,MIT,MRT extends es.kukenan.smartfi.microservice.backoffice.dtos.core.response.CoreResponse<MIT>,M extends AbstractBackofficeResponseMapper<E,MIT>> extends AbstractEndpointClient
Base class with backoffice functionality for any endpoint implementation.
  • Field Details

  • Constructor Details

    • AbstractBackofficeEndpoint

      protected AbstractBackofficeEndpoint(M mapper, Class<MRT> backofficeResponseClass)
      Constructor.
      Parameters:
      mapper - The mapper
      backofficeResponseClass - Response class
  • Method Details

    • defaultRequestHeaders

      protected org.springframework.http.HttpHeaders defaultRequestHeaders(String contentType)
      Create the default request HTTP headers used in any Backoffice API method.
      Parameters:
      contentType - request body content type. Can be null.
      Returns:
      the default request HTTP headers used in any Backoffice API method.
    • defaultRequestHeaders

      protected org.springframework.http.HttpHeaders defaultRequestHeaders(String contentType, String userId)
      Create the default request HTTP headers used in any Backoffice API method.
      Parameters:
      contentType - request body content type. Can be null.
      userId - user identifier, mandatory.
      Returns:
      the default request HTTP headers used in any Backoffice API method.
    • defaultRequestHeaders

      protected org.springframework.http.HttpHeaders defaultRequestHeaders(String contentType, String userIP, String userAgent, String userId)
      Create the default request HTTP headers used in any Backoffice API method.
      Parameters:
      contentType - request body content type. Can be null.
      userIP - ip to call backoffice endpoint
      userAgent - user-agent to call backoffice endpoint
      userId - user identifier, mandatory.
      Returns:
      the default request HTTP headers used in any Backoffice API method.
    • doExecute

      protected E doExecute(org.springframework.http.RequestEntity<?> requestEntity)
      Request execution with response map.
      Parameters:
      requestEntity - the request entity to call.
      Returns:
      the response.
    • callRest

      private MRT callRest(org.springframework.http.RequestEntity<?> requestEntity)
      Do call to request.
      Parameters:
      requestEntity - the request entity to call.
      Returns:
      the response.
    • extractResponseBody

      private MRT extractResponseBody(org.springframework.http.ResponseEntity<MRT> responseEntity)
      Extract the response body from the given ResponseEntity.
      Parameters:
      responseEntity - ResponseEntity.
      Returns:
      backoffice response body.