Class DefaultOutboundMonitoringRequestDecorator
java.lang.Object
de.hybris.platform.outboundservices.decorator.impl.DefaultOutboundMonitoringRequestDecorator
- All Implemented Interfaces:
OutboundRequestDecorator
public class DefaultOutboundMonitoringRequestDecorator
extends Object
implements OutboundRequestDecorator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringDecodes integration key value.decorate(org.springframework.http.HttpHeaders httpHeaders, Map<String, Object> payload, DecoratorContext context, DecoratorExecution execution) Decorates an Outbound requestprotected StringextractHttpEntityFrom(org.springframework.http.HttpHeaders httpHeaders, Map<String, Object> payload, DecoratorContext context, DecoratorExecution execution) protected StringextractIntegrationKey(org.springframework.http.HttpEntity<Map<String, Object>> httpEntity) Extracts integration key value from the HTTP entity, to be associated with theInboundRequestModel.protected StringextractSapPassportFrom(org.springframework.http.HttpEntity<Map<String, Object>> httpEntity, DecoratorContext context) Extracts SAP-PASSPORT from the HTTP entity, to be associated with theInboundRequestModel.protected ModelServicebooleanisApplicable(DecoratorContext decoratorContext) Determines if the decorator is applicable.booleanDetermines if the decorator is enabled.protected OutboundRequestModelsaveOutboundRequest(String messageId, String sapPassport, String integrationKey, IntegrationRequestStatus status, DecoratorContext context) Creates and persistsOutboundRequestModelwith the specified parameters.protected OutboundRequestModelsaveOutboundRequest(String messageId, String sapPassport, String integrationKey, DecoratorContext context, Throwable exception) Creates and persistsOutboundRequestModelhavingIntegrationRequestStatus.ERRORand the specified parameters.voidsetExceptionErrorParser(MonitoredRequestErrorParser<MonitoredRequestErrorModel> exceptionErrorParser) voidsetModelService(ModelService modelService) voidsetOutboundServicesConfiguration(OutboundServicesConfiguration outboundServicesConfiguration)
-
Constructor Details
-
DefaultOutboundMonitoringRequestDecorator
public DefaultOutboundMonitoringRequestDecorator()
-
-
Method Details
-
isApplicable
Description copied from interface:OutboundRequestDecoratorDetermines if the decorator is applicable.- Specified by:
isApplicablein interfaceOutboundRequestDecorator- Parameters:
decoratorContext- with the information about the request being decorated.- Returns:
trueif the decorator is applicable;falseif not
-
isEnabled
public boolean isEnabled()Description copied from interface:OutboundRequestDecoratorDetermines if the decorator is enabled.- Specified by:
isEnabledin interfaceOutboundRequestDecorator- Returns:
trueif the decorator is enabled;falseif not
-
decorate
public org.springframework.http.HttpEntity<Map<String,Object>> decorate(org.springframework.http.HttpHeaders httpHeaders, Map<String, Object> payload, DecoratorContext context, DecoratorExecution execution) Description copied from interface:OutboundRequestDecoratorDecorates an Outbound request- Specified by:
decoratein interfaceOutboundRequestDecorator- Parameters:
httpHeaders- The headers to be used for the outgoing request.payload- The payload used for the requestcontext- Some extra information that can be used by decorators.execution- The execution chain.- Returns:
- An
HttpEntitycontaining the result of the decoration. Normally by callingexecution.createHttpEntity()
-
extractSapPassportFrom
protected String extractSapPassportFrom(org.springframework.http.HttpEntity<Map<String, Object>> httpEntity, DecoratorContext context) Extracts SAP-PASSPORT from the HTTP entity, to be associated with theInboundRequestModel. If SAP-PASSPORT is not present, then an ERRORInboundRequestModelis persisted for the entity.- Parameters:
httpEntity- an entity to extract SAP-PASSPORT from.context- context for the HTTP entity- Returns:
- SAP-PASSPORT value
- Throws:
OutboundMonitoringException- when SAP-PASSPORT value is not found in the entity
-
extractHttpEntityFrom
protected org.springframework.http.HttpEntity<Map<String,Object>> extractHttpEntityFrom(org.springframework.http.HttpHeaders httpHeaders, Map<String, Object> payload, DecoratorContext context, DecoratorExecution execution) -
extractError
-
saveOutboundRequest
protected OutboundRequestModel saveOutboundRequest(String messageId, String sapPassport, String integrationKey, IntegrationRequestStatus status, DecoratorContext context) Creates and persistsOutboundRequestModelwith the specified parameters.- Parameters:
messageId- value forMonitoredRequestModel.setMessageId(String)sapPassport- value forMonitoredRequestModel.setSapPassport(String)integrationKey- value forMonitoredRequestModel.setIntegrationKey(String)status- value forMonitoredRequestModel.setStatus(IntegrationRequestStatus)context- context to derive otherOutboundRequestModelproperties from.- Returns:
- persisted outbound request
-
saveOutboundRequest
protected OutboundRequestModel saveOutboundRequest(String messageId, String sapPassport, String integrationKey, DecoratorContext context, Throwable exception) Creates and persistsOutboundRequestModelhavingIntegrationRequestStatus.ERRORand the specified parameters.- Parameters:
messageId- value forMonitoredRequestModel.setMessageId(String)sapPassport- value forMonitoredRequestModel.setSapPassport(String)integrationKey- value forMonitoredRequestModel.setIntegrationKey(String)context- context to derive otherOutboundRequestModelproperties from.exception- an exception that happened while processing the outbound request.- Returns:
- persisted outbound request
-
extractIntegrationKey
protected String extractIntegrationKey(org.springframework.http.HttpEntity<Map<String, Object>> httpEntity) Extracts integration key value from the HTTP entity, to be associated with theInboundRequestModel.- Parameters:
httpEntity- an entity to extract SAP-PASSPORT from.- Returns:
- integration key value of
null, if the payload does not contain integration key.
-
decode
Decodes integration key value.- Parameters:
value- value of the integration key in the payload, which might be encoded.- Returns:
- a decoded integration key value
-
getModelService
-
setModelService
-
setOutboundServicesConfiguration
public void setOutboundServicesConfiguration(OutboundServicesConfiguration outboundServicesConfiguration) -
getExceptionErrorParser
-
setExceptionErrorParser
public void setExceptionErrorParser(MonitoredRequestErrorParser<MonitoredRequestErrorModel> exceptionErrorParser)
-