Search in sources :

Example 1 with BundleMessagesResponse

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;
}
Also used : ActualMeterReadsResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.ActualMeterReadsResponse) BundleResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleResponse) GetConfigurationObjectResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetConfigurationObjectResponse) BundleMessagesResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.BundleMessagesResponse) PeriodicMeterReadsResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.PeriodicMeterReadsResponse) UpdateFirmwareResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.UpdateFirmwareResponse) ReadAlarmRegisterResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.ReadAlarmRegisterResponse) GetMbusEncryptionKeyStatusResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetMbusEncryptionKeyStatusResponse) GetKeysResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetKeysResponse) FirmwareVersionGasResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.FirmwareVersionGasResponse) PeriodicMeterReadsGasResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.PeriodicMeterReadsGasResponse) ScanMbusChannelsResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.ScanMbusChannelsResponse) GetFirmwareVersionResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetFirmwareVersionResponse) FaultResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.FaultResponse) AdministrativeStatusResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.AdministrativeStatusResponse) GetOutagesResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetOutagesResponse) FindEventsResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.FindEventsResponse) CoupleMbusDeviceByChannelResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.CoupleMbusDeviceByChannelResponse) Response(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.Response) GetAllAttributeValuesResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetAllAttributeValuesResponse) GetPowerQualityProfileResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetPowerQualityProfileResponse) SetDeviceLifecycleStatusByChannelResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.SetDeviceLifecycleStatusByChannelResponse) ActualMeterReadsGasResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.ActualMeterReadsGasResponse) EventMessagesResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.EventMessagesResponse) GetMbusEncryptionKeyStatusByChannelResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetMbusEncryptionKeyStatusByChannelResponse) ActionResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ActionResponse) GetFirmwareVersionGasResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetFirmwareVersionGasResponse) AdministrativeStatusTypeResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AdministrativeStatusTypeResponse) GetGsmDiagnosticResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetGsmDiagnosticResponse) FirmwareVersionResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.FirmwareVersionResponse) ActualPowerQualityResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ActualPowerQualityResponse) DecoupleMbusDeviceByChannelResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.DecoupleMbusDeviceByChannelResponse) ObjectFactory(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.ObjectFactory) BundleResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleResponse) BundleMessagesResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.BundleMessagesResponse) ConfigurableMapper(ma.glasnost.orika.impl.ConfigurableMapper) AllResponses(org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.AllResponses) ActionResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ActionResponse)

Example 2 with BundleMessagesResponse

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());
}
Also used : BundleMessagesResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.BundleMessagesResponse) ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with BundleMessagesResponse

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);
}
Also used : ActionResponseDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ActionResponseDto) ArrayList(java.util.ArrayList) BundleMessagesResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.BundleMessagesResponse) ConfigurableMapper(ma.glasnost.orika.impl.ConfigurableMapper) ActionResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ActionResponse)

Aggregations

BundleMessagesResponse (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.BundleMessagesResponse)3 ConfigurableMapper (ma.glasnost.orika.impl.ConfigurableMapper)2 ActionResponse (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ActionResponse)2 ArrayList (java.util.ArrayList)1 ActualMeterReadsGasResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.ActualMeterReadsGasResponse)1 ActualMeterReadsResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.ActualMeterReadsResponse)1 AdministrativeStatusResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.AdministrativeStatusResponse)1 AllResponses (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.AllResponses)1 BundleResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.BundleResponse)1 FindEventsResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.FindEventsResponse)1 GetFirmwareVersionGasResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetFirmwareVersionGasResponse)1 GetFirmwareVersionResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetFirmwareVersionResponse)1 GetGsmDiagnosticResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetGsmDiagnosticResponse)1 GetMbusEncryptionKeyStatusByChannelResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetMbusEncryptionKeyStatusByChannelResponse)1 GetMbusEncryptionKeyStatusResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetMbusEncryptionKeyStatusResponse)1 GetOutagesResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetOutagesResponse)1 ObjectFactory (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.ObjectFactory)1 PeriodicMeterReadsGasResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.PeriodicMeterReadsGasResponse)1 PeriodicMeterReadsResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.PeriodicMeterReadsResponse)1 ReadAlarmRegisterResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.ReadAlarmRegisterResponse)1