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