use of org.opensmartgridplatform.dto.valueobjects.microgrids.SetDataRequestDto in project open-smart-grid-platform by OSGP.
the class AdHocManagementService method handleSetDataRequest.
// === SET DATA ===
public void handleSetDataRequest(final String organisationIdentification, final String deviceIdentification, final String correlationUid, final String messageType, final SetDataRequest setDataRequest) throws FunctionalException {
LOGGER.info("Set data for device [{}] with correlation id [{}]", deviceIdentification, correlationUid);
this.findOrganisation(organisationIdentification);
final Device device = this.findActiveDevice(deviceIdentification);
final SetDataRequestDto dto = this.mapper.map(setDataRequest, SetDataRequestDto.class);
this.osgpCoreRequestMessageSender.send(new RequestMessage(correlationUid, organisationIdentification, deviceIdentification, dto), messageType, device.getIpAddress());
}
use of org.opensmartgridplatform.dto.valueobjects.microgrids.SetDataRequestDto in project open-smart-grid-platform by OSGP.
the class Iec61850RtuDeviceService method handleSetData.
private void handleSetData(final DeviceConnection connection, final SetDataDeviceRequest deviceRequest) throws ProtocolAdapterException {
final SetDataRequestDto setDataRequest = deviceRequest.getSetDataRequest();
final Function<Void> function = new Function<Void>() {
@Override
public Void apply(final DeviceMessageLog deviceMessageLog) throws ProtocolAdapterException {
for (final SetDataSystemIdentifierDto identifier : setDataRequest.getSetDataSystemIdentifiers()) {
final SystemService systemService = Iec61850RtuDeviceService.this.systemServiceFactory.getSystemService(identifier.getSystemType());
systemService.setData(identifier, Iec61850RtuDeviceService.this.iec61850Client, connection);
}
return null;
}
};
this.iec61850Client.sendCommandWithRetry(function, deviceRequest.getDeviceIdentification());
}
use of org.opensmartgridplatform.dto.valueobjects.microgrids.SetDataRequestDto in project open-smart-grid-platform by OSGP.
the class MicrogridsSetDataRequestMessageProcessor method processMessage.
@Override
public void processMessage(final ObjectMessage message) throws JMSException {
LOGGER.info("Processing microgrids set data request message");
MessageMetadata messageMetadata;
SetDataRequestDto setDataRequest;
try {
messageMetadata = MessageMetadata.fromMessage(message);
setDataRequest = (SetDataRequestDto) message.getObject();
} catch (final JMSException e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
return;
}
final RequestMessageData requestMessageData = RequestMessageData.newBuilder().messageMetadata(messageMetadata).build();
this.printDomainInfo(requestMessageData);
final Iec61850DeviceResponseHandler iec61850DeviceResponseHandler = this.createIec61850DeviceResponseHandler(requestMessageData, message);
final DeviceRequest.Builder deviceRequestBuilder = DeviceRequest.newBuilder().messageMetaData(messageMetadata);
this.deviceService.setData(new SetDataDeviceRequest(deviceRequestBuilder, setDataRequest), iec61850DeviceResponseHandler);
}
Aggregations