use of org.opensmartgridplatform.domain.core.valueobjects.DeviceStatus in project open-smart-grid-platform by OSGP.
the class DeviceInstallationEndpoint method getGetStatusResponse.
@PayloadRoot(localPart = "GetStatusAsyncRequest", namespace = DEVICE_INSTALLATION_NAMESPACE)
@ResponsePayload
public GetStatusResponse getGetStatusResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final GetStatusAsyncRequest request) throws OsgpException {
LOGGER.info("Get Status Response received from organisation: {}.", organisationIdentification);
final GetStatusResponse response = new GetStatusResponse();
try {
final ResponseMessage responseMessage = this.getResponseMessage(request.getAsyncRequest());
if (responseMessage != null) {
throwExceptionIfResultNotOk(responseMessage, "getting status");
response.setResult(OsgpResultType.fromValue(responseMessage.getResult().getValue()));
final DeviceStatus deviceStatus = (DeviceStatus) responseMessage.getDataObject();
if (deviceStatus != null) {
response.setDeviceStatus(this.deviceInstallationMapper.map(deviceStatus, org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.DeviceStatus.class));
}
}
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
Aggregations