use of com.alliander.osgp.shared.exceptionhandling.TechnicalException in project Protocol-Adapter-IEC61850 by OSGP.
the class MicrogridsGetDataRequestMessageProcessor method handleGetDataDeviceResponse.
private void handleGetDataDeviceResponse(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;
GetDataResponseDto dataResponse = null;
try {
final GetDataDeviceResponse response = (GetDataDeviceResponse) deviceResponse;
dataResponse = response.getDataResponse();
} catch (final Exception e) {
LOGGER.error("Device Response Exception", e);
result = ResponseMessageResultType.NOT_OK;
osgpException = new TechnicalException(ComponentType.PROTOCOL_IEC61850, "Unexpected exception while retrieving response message", e);
}
final DeviceMessageMetadata deviceMessageMetaData = new DeviceMessageMetadata(deviceResponse.getDeviceIdentification(), deviceResponse.getOrganisationIdentification(), deviceResponse.getCorrelationUid(), messageType, 0);
final ProtocolResponseMessage responseMessage = new ProtocolResponseMessage.Builder().domain(domain).domainVersion(domainVersion).deviceMessageMetadata(deviceMessageMetaData).result(result).osgpException(osgpException).dataObject(dataResponse).retryCount(retryCount).build();
responseMessageSender.send(responseMessage);
}
Aggregations