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 Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractBackofficeEndpoint(M mapper, Class<MRT> backofficeResponseClass) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate MRTcallRest(org.springframework.http.RequestEntity<?> requestEntity) Do call to request.protected org.springframework.http.HttpHeadersdefaultRequestHeaders(String contentType) Create the default request HTTP headers used in any Backoffice API method.protected org.springframework.http.HttpHeadersdefaultRequestHeaders(String contentType, String userId) Create the default request HTTP headers used in any Backoffice API method.protected org.springframework.http.HttpHeadersdefaultRequestHeaders(String contentType, String userIP, String userAgent, String userId) Create the default request HTTP headers used in any Backoffice API method.protected EdoExecute(org.springframework.http.RequestEntity<?> requestEntity) Request execution with response map.private MRTextractResponseBody(org.springframework.http.ResponseEntity<MRT> responseEntity) Extract the response body from the givenResponseEntity.Methods inherited from class es.kukenan.smartfi.microservice.onboarding.service.backoffice.AbstractEndpointClient
createUri, createUri, defaultRequestHeaders, handleConnectionException, message
-
Field Details
-
HEADER_USERPROFILEID
User profile identifier header.- See Also:
-
OK_CODE
Ok code.- See Also:
-
mapper
Mapper. -
backofficeResponseClase
private final Class<MRT extends es.kukenan.smartfi.microservice.backoffice.dtos.core.response.CoreResponse<MIT>> backofficeResponseClaseBackoffice response class type. -
backofficeBasseUrl
Backoffice base url. -
restTemplate
Backoffice rest template.
-
-
Constructor Details
-
AbstractBackofficeEndpoint
Constructor.- Parameters:
mapper- The mapperbackofficeResponseClass- Response class
-
-
Method Details
-
defaultRequestHeaders
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 endpointuserAgent- user-agent to call backoffice endpointuserId- user identifier, mandatory.- Returns:
- the default request HTTP headers used in any Backoffice API method.
-
doExecute
Request execution with response map.- Parameters:
requestEntity- the request entity to call.- Returns:
- the response.
-
callRest
Do call to request.- Parameters:
requestEntity- the request entity to call.- Returns:
- the response.
-
extractResponseBody
Extract the response body from the givenResponseEntity.- Parameters:
responseEntity-ResponseEntity.- Returns:
- backoffice response body.
-