Search in sources :

Example 1 with FirmwareVersionGasResponse

use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.FirmwareVersionGasResponse in project open-smart-grid-platform by OSGP.

the class ConfigurationService method handleGetFirmwareVersionGasResponse.

public void handleGetFirmwareVersionGasResponse(final MessageMetadata messageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception, final FirmwareVersionGasDto firmwareVersionGas) {
    log.info("handleGetFirmwareVersionGasResponse for MessageType: {}", messageMetadata.getMessageType());
    ResponseMessageResultType result = deviceResult;
    if (exception != null) {
        log.error("Get firmware version response not ok. Unexpected Exception", exception);
        result = ResponseMessageResultType.NOT_OK;
    }
    final FirmwareVersion firmwareVersion = this.configurationMapper.map(firmwareVersionGas, FirmwareVersion.class);
    final FirmwareVersionGasResponse firmwareVersionGasResponse = new FirmwareVersionGasResponse(firmwareVersion);
    final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withResult(result).withOsgpException(exception).withDataObject(firmwareVersionGasResponse).build();
    this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
    this.firmwareService.saveFirmwareVersionsReturnedFromDevice(firmwareVersionGas.getMbusDeviceIdentification(), Arrays.asList(firmwareVersion));
}
Also used : FirmwareVersionGasResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.FirmwareVersionGasResponse) ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage) ResponseMessageResultType(org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType) FirmwareVersion(org.opensmartgridplatform.domain.core.valueobjects.FirmwareVersion)

Example 2 with FirmwareVersionGasResponse

use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.FirmwareVersionGasResponse in project open-smart-grid-platform by OSGP.

the class SmartMeteringConfigurationEndpoint method getGetFirmwareVersionGasResponse.

@PayloadRoot(localPart = "GetFirmwareVersionGasAsyncRequest", namespace = SMARTMETER_CONFIGURATION_NAMESPACE)
@ResponsePayload
public GetFirmwareVersionGasResponse getGetFirmwareVersionGasResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final GetFirmwareVersionGasAsyncRequest request) throws OsgpException {
    log.info("GetFirmwareVersionGasResponse request received from organisation {} for device: {}.", organisationIdentification, request.getDeviceIdentification());
    final GetFirmwareVersionGasResponse response = new GetFirmwareVersionGasResponse();
    try {
        final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), ComponentType.WS_SMART_METERING);
        if (responseData != null) {
            response.setResult(OsgpResultType.fromValue(responseData.getResultType().getValue()));
            if (responseData.getMessageData() != null) {
                final FirmwareVersionGasResponse firmwareVersionGasResponse = (FirmwareVersionGasResponse) responseData.getMessageData();
                final FirmwareVersionGas firmwareVersionGas = this.configurationMapper.map(firmwareVersionGasResponse.getFirmwareVersion(), FirmwareVersionGas.class);
                response.setFirmwareVersion(firmwareVersionGas);
            } else {
                log.info("GetFirmwareVersionGas: firmware is null");
            }
        }
    } catch (final Exception e) {
        this.handleException(e);
    }
    return response;
}
Also used : FirmwareVersionGasResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.FirmwareVersionGasResponse) GetFirmwareVersionGasResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetFirmwareVersionGasResponse) FirmwareVersionGas(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.FirmwareVersionGas) GetKeysResponseData(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetKeysResponseData) ResponseData(org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData) GetFirmwareVersionGasResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetFirmwareVersionGasResponse) IOException(java.io.IOException) OsgpException(org.opensmartgridplatform.shared.exceptionhandling.OsgpException) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Aggregations

FirmwareVersionGasResponse (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.FirmwareVersionGasResponse)2 IOException (java.io.IOException)1 ResponseData (org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData)1 FirmwareVersionGas (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.FirmwareVersionGas)1 GetFirmwareVersionGasResponse (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetFirmwareVersionGasResponse)1 GetKeysResponseData (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetKeysResponseData)1 FirmwareVersion (org.opensmartgridplatform.domain.core.valueobjects.FirmwareVersion)1 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)1 ResponseMessage (org.opensmartgridplatform.shared.infra.jms.ResponseMessage)1 ResponseMessageResultType (org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType)1 PayloadRoot (org.springframework.ws.server.endpoint.annotation.PayloadRoot)1 ResponsePayload (org.springframework.ws.server.endpoint.annotation.ResponsePayload)1