use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.BundleMessagesResponse in project open-smart-grid-platform by OSGP.
the class ActionMapperResponseService method mapAllActions.
public BundleResponse mapAllActions(final Serializable actionList) throws FunctionalException {
final BundleMessagesResponse bundleResponseMessageDataContainer = (BundleMessagesResponse) actionList;
final AllResponses allResponses = new ObjectFactory().createAllResponses();
final List<? extends ActionResponse> actionValueList = bundleResponseMessageDataContainer.getBundleList();
for (final ActionResponse actionValueResponseObject : actionValueList) {
final ConfigurableMapper mapper = this.getMapper(actionValueResponseObject);
final Class<?> clazz = this.getClazz(actionValueResponseObject);
final Response response = this.doMap(actionValueResponseObject, mapper, clazz);
allResponses.getResponseList().add(response);
}
final BundleResponse bundleResponse = new ObjectFactory().createBundleResponse();
bundleResponse.setAllResponses(allResponses);
return bundleResponse;
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.BundleMessagesResponse in project open-smart-grid-platform by OSGP.
the class BundleService method handleBundleResponse.
@Transactional(value = "transactionManager")
public void handleBundleResponse(final MessageMetadata messageMetadata, final ResponseMessageResultType responseMessageResultType, final OsgpException osgpException, final BundleMessagesRequestDto bundleMessagesRequestDto) throws FunctionalException {
LOGGER.info("handleBundle response for organisationIdentification: {} for deviceIdentification: {}", messageMetadata.getOrganisationIdentification(), messageMetadata.getDeviceIdentification());
this.checkIfAdditionalActionIsNeeded(messageMetadata, bundleMessagesRequestDto);
// Convert bundleMessagesRequestDto (containing the list of actions from the request, along with
// their respective responses) back to core object.
final BundleMessagesResponse bundleMessagesResponse = this.actionMapperResponseService.mapAllActions(bundleMessagesRequestDto);
final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withResult(responseMessageResultType).withOsgpException(osgpException).withDataObject(bundleMessagesResponse).build();
LOGGER.info("Send response for CorrelationUID: {}", messageMetadata.getCorrelationUid());
this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
LOGGER.info("Response sent for CorrelationUID: {}", messageMetadata.getCorrelationUid());
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.BundleMessagesResponse in project open-smart-grid-platform by OSGP.
the class ActionMapperResponseService method mapAllActions.
public BundleMessagesResponse mapAllActions(final BundleMessagesRequestDto bundleMessageResponseDto) throws FunctionalException {
final List<ActionResponse> actionResponseList = new ArrayList<>();
for (final ActionResponseDto action : bundleMessageResponseDto.getAllResponses()) {
final ConfigurableMapper mapper = this.getMapper(action);
final Class<? extends ActionResponse> clazz = this.getClazz(action);
// mapper is monitoring mapper
final ActionResponse actionValueResponseObject = this.doMap(action, mapper, clazz);
actionResponseList.add(actionValueResponseObject);
}
return new BundleMessagesResponse(actionResponseList);
}
Aggregations