Search in sources :

Example 16 with ResponseMessageResultType

use of org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType in project open-smart-grid-platform by OSGP.

the class ConfigurationService method handleSetRandomisationSettingsResponse.

public void handleSetRandomisationSettingsResponse(final MessageMetadata messageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) {
    log.info("handle SetRandomisationSettings response for MessageType: {}", messageMetadata.getMessageType());
    ResponseMessageResultType result = deviceResult;
    if (exception != null) {
        log.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, exception);
        result = ResponseMessageResultType.NOT_OK;
    }
    final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withResult(result).withOsgpException(exception).build();
    this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
}
Also used : ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage) ResponseMessageResultType(org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType)

Example 17 with ResponseMessageResultType

use of org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType 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 18 with ResponseMessageResultType

use of org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType in project open-smart-grid-platform by OSGP.

the class ConfigurationService method handleSetActivityCalendarResponse.

public void handleSetActivityCalendarResponse(final MessageMetadata messageMetadata, final ResponseMessageResultType responseMessageResultType, final OsgpException exception, final String resultString) {
    log.info("handleSetActivityCalendarResponse for MessageType: {}", messageMetadata.getMessageType());
    ResponseMessageResultType result = responseMessageResultType;
    if (exception != null) {
        log.error("Set Activity Calendar Response not ok. Unexpected Exception", exception);
        result = ResponseMessageResultType.NOT_OK;
    }
    final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withResult(result).withOsgpException(exception).withDataObject(resultString).build();
    this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
}
Also used : ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage) ResponseMessageResultType(org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType)

Example 19 with ResponseMessageResultType

use of org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType in project open-smart-grid-platform by OSGP.

the class ConfigurationService method handleSetClockConfigurationResponse.

public void handleSetClockConfigurationResponse(final MessageMetadata messageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) {
    log.info("handleSetClockConfigurationResponse for MessageType: {}", messageMetadata.getMessageType());
    ResponseMessageResultType result = deviceResult;
    if (exception != null) {
        log.error("Set Clock Configuration Response not ok. Unexpected Exception", exception);
        result = ResponseMessageResultType.NOT_OK;
    }
    final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withResult(result).withOsgpException(exception).build();
    this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
}
Also used : ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage) ResponseMessageResultType(org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType)

Example 20 with ResponseMessageResultType

use of org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType in project open-smart-grid-platform by OSGP.

the class ConfigurationService method handleUpdateFirmwareResponse.

public void handleUpdateFirmwareResponse(final MessageMetadata messageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception, final UpdateFirmwareResponseDto updateFirmwareResponseDto) {
    log.info("handleUpdateFirmwareResponse for MessageType: {}", messageMetadata.getMessageType());
    ResponseMessageResultType result = deviceResult;
    if (exception != null) {
        log.error("Update firmware response not ok. Unexpected Exception", exception);
        result = ResponseMessageResultType.NOT_OK;
    }
    final UpdateFirmwareResponse updateFirmwareResponse = this.configurationMapper.map(updateFirmwareResponseDto, UpdateFirmwareResponse.class);
    final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withResult(result).withOsgpException(exception).withDataObject(updateFirmwareResponse).build();
    this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
}
Also used : ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage) ResponseMessageResultType(org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType) UpdateFirmwareResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.UpdateFirmwareResponse)

Aggregations

ResponseMessageResultType (org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType)102 ResponseMessage (org.opensmartgridplatform.shared.infra.jms.ResponseMessage)78 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)52 JMSException (javax.jms.JMSException)39 CorrelationIds (org.opensmartgridplatform.shared.infra.jms.CorrelationIds)24 TechnicalException (org.opensmartgridplatform.shared.exceptionhandling.TechnicalException)20 ProtocolResponseMessage (org.opensmartgridplatform.shared.infra.jms.ProtocolResponseMessage)17 MessageMetadata (org.opensmartgridplatform.shared.infra.jms.MessageMetadata)15 Serializable (java.io.Serializable)12 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)12 Test (org.junit.jupiter.api.Test)6 DeviceStatusDto (org.opensmartgridplatform.dto.valueobjects.DeviceStatusDto)6 IOException (java.io.IOException)5 Ssld (org.opensmartgridplatform.domain.core.entities.Ssld)4 UnknownEntityException (org.opensmartgridplatform.domain.core.exceptions.UnknownEntityException)4 FirmwareVersion (org.opensmartgridplatform.domain.core.valueobjects.FirmwareVersion)4 GetStatusDeviceResponse (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetStatusDeviceResponse)3 Device (org.opensmartgridplatform.domain.core.entities.Device)3 FirmwareVersionDto (org.opensmartgridplatform.dto.valueobjects.FirmwareVersionDto)3 Calendar (java.util.Calendar)2