Search in sources :

Example 1 with GetConfigurationDeviceResponse

use of com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse in project Protocol-Adapter-OSLP by OSGP.

the class CommonGetConfigurationRequestMessageProcessor method handleGetConfigurationDeviceResponse.

private void handleGetConfigurationDeviceResponse(final DeviceResponse deviceResponse, final ResponseMessageSender responseMessageSender, final String domain, final String domainVersion, final String messageType, final int retryCount) {
    ResponseMessageResultType result = ResponseMessageResultType.OK;
    OsgpException osgpException = null;
    ConfigurationDto configuration = null;
    try {
        final GetConfigurationDeviceResponse response = (GetConfigurationDeviceResponse) deviceResponse;
        this.deviceResponseService.handleDeviceMessageStatus(response.getStatus());
        configuration = response.getConfiguration();
    } catch (final Exception e) {
        LOGGER.error("Device Response Exception", e);
        result = ResponseMessageResultType.NOT_OK;
        osgpException = new TechnicalException(ComponentType.UNKNOWN, "Exception occurred while getting device configuration", e);
    }
    final DeviceMessageMetadata deviceMessageMetadata = new DeviceMessageMetadata(deviceResponse.getDeviceIdentification(), deviceResponse.getOrganisationIdentification(), deviceResponse.getCorrelationUid(), messageType, MessagePriorityEnum.DEFAULT.getPriority());
    final ProtocolResponseMessage responseMessage = ProtocolResponseMessage.newBuilder().domain(domain).domainVersion(domainVersion).deviceMessageMetadata(deviceMessageMetadata).result(result).osgpException(osgpException).dataObject(configuration).retryCount(retryCount).build();
    responseMessageSender.send(responseMessage);
}
Also used : OsgpException(com.alliander.osgp.shared.exceptionhandling.OsgpException) TechnicalException(com.alliander.osgp.shared.exceptionhandling.TechnicalException) ProtocolResponseMessage(com.alliander.osgp.shared.infra.jms.ProtocolResponseMessage) ConfigurationDto(com.alliander.osgp.dto.valueobjects.ConfigurationDto) GetConfigurationDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse) DeviceMessageMetadata(com.alliander.osgp.shared.infra.jms.DeviceMessageMetadata) ResponseMessageResultType(com.alliander.osgp.shared.infra.jms.ResponseMessageResultType) OsgpException(com.alliander.osgp.shared.exceptionhandling.OsgpException) IOException(java.io.IOException) JMSException(javax.jms.JMSException) TechnicalException(com.alliander.osgp.shared.exceptionhandling.TechnicalException)

Example 2 with GetConfigurationDeviceResponse

use of com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse in project Protocol-Adapter-OSLP by OSGP.

the class OslpDeviceService method buildDeviceResponseGetConfiguration.

private DeviceResponse buildDeviceResponseGetConfiguration(final DeviceRequest deviceRequest, final OslpEnvelope oslpResponse) {
    ConfigurationDto configuration = null;
    DeviceMessageStatus status = null;
    if (oslpResponse.getPayloadMessage().hasGetConfigurationResponse()) {
        final Oslp.GetConfigurationResponse getConfigurationResponse = oslpResponse.getPayloadMessage().getGetConfigurationResponse();
        configuration = this.mapper.map(getConfigurationResponse, ConfigurationDto.class);
        status = this.mapper.map(getConfigurationResponse.getStatus(), DeviceMessageStatus.class);
    } else {
        status = DeviceMessageStatus.FAILURE;
    }
    return new GetConfigurationDeviceResponse(deviceRequest.getOrganisationIdentification(), deviceRequest.getDeviceIdentification(), deviceRequest.getCorrelationUid(), status, configuration);
}
Also used : DeviceMessageStatus(com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceMessageStatus) ConfigurationDto(com.alliander.osgp.dto.valueobjects.ConfigurationDto) GetConfigurationDeviceResponse(com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse) Oslp(com.alliander.osgp.oslp.Oslp)

Aggregations

GetConfigurationDeviceResponse (com.alliander.osgp.adapter.protocol.oslp.elster.device.responses.GetConfigurationDeviceResponse)2 ConfigurationDto (com.alliander.osgp.dto.valueobjects.ConfigurationDto)2 DeviceMessageStatus (com.alliander.osgp.adapter.protocol.oslp.elster.device.DeviceMessageStatus)1 Oslp (com.alliander.osgp.oslp.Oslp)1 OsgpException (com.alliander.osgp.shared.exceptionhandling.OsgpException)1 TechnicalException (com.alliander.osgp.shared.exceptionhandling.TechnicalException)1 DeviceMessageMetadata (com.alliander.osgp.shared.infra.jms.DeviceMessageMetadata)1 ProtocolResponseMessage (com.alliander.osgp.shared.infra.jms.ProtocolResponseMessage)1 ResponseMessageResultType (com.alliander.osgp.shared.infra.jms.ResponseMessageResultType)1 IOException (java.io.IOException)1 JMSException (javax.jms.JMSException)1