Search in sources :

Example 11 with DeviceStatusDto

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);
}
Also used : GetStatusDeviceResponse(org.opensmartgridplatform.adapter.protocol.iec61850.device.ssld.responses.GetStatusDeviceResponse) MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) ProtocolResponseMessage(org.opensmartgridplatform.shared.infra.jms.ProtocolResponseMessage) DeviceStatusDto(org.opensmartgridplatform.dto.valueobjects.DeviceStatusDto)

Aggregations

DeviceStatusDto (org.opensmartgridplatform.dto.valueobjects.DeviceStatusDto)11 JMSException (javax.jms.JMSException)8 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)6 ResponseMessageResultType (org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType)6 TechnicalException (org.opensmartgridplatform.shared.exceptionhandling.TechnicalException)5 GetStatusDeviceResponse (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.responses.GetStatusDeviceResponse)4 ProtocolResponseMessage (org.opensmartgridplatform.shared.infra.jms.ProtocolResponseMessage)4 IOException (java.io.IOException)3 LightValueDto (org.opensmartgridplatform.dto.valueobjects.LightValueDto)3 CorrelationIds (org.opensmartgridplatform.shared.infra.jms.CorrelationIds)3 MessageMetadata (org.opensmartgridplatform.shared.infra.jms.MessageMetadata)3 ResponseMessage (org.opensmartgridplatform.shared.infra.jms.ResponseMessage)3 GetStatusDeviceResponse (org.opensmartgridplatform.adapter.protocol.iec61850.device.ssld.responses.GetStatusDeviceResponse)2 ConnectionFailureException (org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ConnectionFailureException)2 NodeException (org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.NodeException)2 ProtocolAdapterException (org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)2 DeviceConnection (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection)2 Iec61850GetStatusCommand (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850GetStatusCommand)2 Ssld (org.opensmartgridplatform.core.db.api.iec61850.entities.Ssld)2 LightTypeDto (org.opensmartgridplatform.dto.valueobjects.LightTypeDto)2