Class AbstractInternalEndpointClient
java.lang.Object
es.kukenan.smartfi.microservice.smartficore.service.api.AbstractEndpointClient
es.kukenan.smartfi.microservice.smartficore.service.api.AbstractInternalEndpointClient
- Direct Known Subclasses:
ApcEndpoints,BacAuthEndpoint,BackofficeEndpoints,BacTcdEndpoint,EFacturaPtyEndpoint,UltraFaceEndpoint
Base class with core funcionality for any endpoint implementation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate es.kukenan.smartfi.common.context.RequestContextManagerRequest context manager.protected final StringAPI base path.static final StringUser profile identifier header.private es.kukenan.smartfi.common.context.config.ContextPropagationPropertiesContext propagation properties.Rest template.static final Stringuser ip internal header attribute. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddAuthorization(org.springframework.http.HttpHeaders httpHeaders) Add authorization parameters to the given http headers.protected org.springframework.http.HttpHeadersdefaultRequestHeaders(String contentType, String userId) Create the default request HTTP headers used in any Core API method.protected org.springframework.http.HttpHeadersdefaultRequestHeaders(String contentType, String userId, String userIp) protected <T extends es.kukenan.smartfi.microservice.backoffice.dtos.core.response.CoreResponse<?>>
TextractResponseBody(org.springframework.http.ResponseEntity<T> responseEntity) Extract the response data from the givenResponseEntity.protected <T> TextractResponseData(org.springframework.http.ResponseEntity<T> responseEntity) Extract the response data from the givenResponseEntity.Methods inherited from class es.kukenan.smartfi.microservice.smartficore.service.api.AbstractEndpointClient
createUri, createUri, defaultRequestHeaders, handleConnectionException, message
-
Field Details
-
HEADER_USERPROFILEID
User profile identifier header.- See Also:
-
USER_IP_HEADER
user ip internal header attribute.- See Also:
-
endpointBasePath
API base path. -
restTemplate
@Autowired protected InternalProductApiRestTemplateFactory.InternalProductApiRestTemplate restTemplateRest template. -
properties
@Autowired private es.kukenan.smartfi.common.context.config.ContextPropagationProperties propertiesContext propagation properties. -
contextManager
@Autowired private es.kukenan.smartfi.common.context.RequestContextManager contextManagerRequest context manager.
-
-
Constructor Details
-
AbstractInternalEndpointClient
Base constructor.- Parameters:
endpointBasePath- the base path of this endpoint.
-
-
Method Details
-
extractResponseData
protected <T> T extractResponseData(org.springframework.http.ResponseEntity<T> responseEntity) Extract the response data from the givenResponseEntity.- Type Parameters:
T- MinsaitResponse type.- Parameters:
responseEntity-ResponseEntity.- Returns:
- minsait response data.
-
addAuthorization
private void addAuthorization(org.springframework.http.HttpHeaders httpHeaders) Add authorization parameters to the given http headers.- Parameters:
httpHeaders- http headers to update with the correct credentials to invoke Core API.
-
defaultRequestHeaders
protected org.springframework.http.HttpHeaders defaultRequestHeaders(String contentType, String userId) Create the default request HTTP headers used in any Core API method.- Parameters:
contentType- request body content type. Can be null.userId- user identifier, mandatory.- Returns:
- the default request HTTP headers used in any Core API method.
-
defaultRequestHeaders
-
extractResponseBody
protected <T extends es.kukenan.smartfi.microservice.backoffice.dtos.core.response.CoreResponse<?>> T extractResponseBody(org.springframework.http.ResponseEntity<T> responseEntity) Extract the response data from the givenResponseEntity.- Type Parameters:
T- CoreResponse type.- Parameters:
responseEntity-ResponseEntity.- Returns:
- core response data.
-