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));
}
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;
}
Aggregations