use of org.opensmartgridplatform.adapter.ws.schema.distributionautomation.generic.AddRtuDeviceAsyncResponse in project open-smart-grid-platform by OSGP.
the class DeviceManagementEndpoint method addRtuDevice.
@PayloadRoot(localPart = "AddRtuDeviceRequest", namespace = NAMESPACE)
@ResponsePayload
public AddRtuDeviceAsyncResponse addRtuDevice(@OrganisationIdentification final String organisationIdentification, @RequestPayload final AddRtuDeviceRequest request) throws OsgpException {
LOGGER.info("Incoming AddRtuDeviceRequest for device: {}.", request.getRtuDevice().getDeviceIdentification());
AddRtuDeviceAsyncResponse response = null;
try {
response = new AddRtuDeviceAsyncResponse();
final RtuDevice rtuDevice = this.mapper.map(request.getRtuDevice(), RtuDevice.class);
final DeviceModel deviceModel = new DeviceModel(request.getDeviceModel().getManufacturer(), request.getDeviceModel().getModelCode(), "");
final String correlationUid = this.service.enqueueAddRtuDeviceRequest(organisationIdentification, rtuDevice.getDeviceIdentification(), new org.opensmartgridplatform.domain.core.valueobjects.AddRtuDeviceRequest(rtuDevice, deviceModel));
response.setCorrelationUid(correlationUid);
response.setDeviceId(request.getRtuDevice().getDeviceIdentification());
} catch (final Exception e) {
this.handleException(LOGGER, e);
}
return response;
}
Aggregations