use of org.opensmartgridplatform.dto.valueobjects.DeviceStatusDto in project open-smart-grid-platform by OSGP.
the class SsldDeviceRequestMessageProcessor method handleGetStatusDeviceResponse.
// This function is used in 3 domains.
protected void handleGetStatusDeviceResponse(final DeviceResponse deviceResponse, final ResponseMessageSender responseMessageSender, final DomainInformation domainInformation, final String messageType, final int retryCount, final boolean isScheduled) {
LOGGER.info("Handling getStatusDeviceResponse for device: {}", deviceResponse.getDeviceIdentification());
if (StringUtils.isEmpty(deviceResponse.getCorrelationUid())) {
LOGGER.warn("CorrelationUID is null or empty, not sending GetStatusResponse message for GetStatusRequest message for device: {}", deviceResponse.getDeviceIdentification());
return;
}
final GetStatusDeviceResponse response = (GetStatusDeviceResponse) deviceResponse;
final DeviceStatusDto status = response.getDeviceStatus();
final MessageMetadata messageMetadata = MessageMetadata.newBuilder().withDeviceIdentification(deviceResponse.getDeviceIdentification()).withOrganisationIdentification(deviceResponse.getOrganisationIdentification()).withCorrelationUid(deviceResponse.getCorrelationUid()).withMessageType(messageType).withDomain(domainInformation.getDomain()).withDomainVersion(domainInformation.getDomainVersion()).withMessagePriority(response.getMessagePriority()).withScheduled(isScheduled).withRetryCount(retryCount).build();
final ProtocolResponseMessage protocolResponseMessage = ProtocolResponseMessage.newBuilder().messageMetadata(messageMetadata).result(ResponseMessageResultType.OK).osgpException(null).dataObject(status).build();
responseMessageSender.send(protocolResponseMessage);
}
Aggregations