use of org.opensmartgridplatform.adapter.ws.schema.distributionautomation.generic.GetDeviceModelResponse in project open-smart-grid-platform by OSGP.
the class AdHocManagementEndpoint method getDeviceModelResponse.
@PayloadRoot(localPart = "GetDeviceModelAsyncRequest", namespace = NAMESPACE)
@ResponsePayload
public GetDeviceModelResponse getDeviceModelResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final GetDeviceModelAsyncRequest request) throws OsgpException {
LOGGER.info("Get Device Model Response received from organisation: {} for correlationUid: {}.", organisationIdentification, request.getAsyncRequest().getCorrelationUid());
GetDeviceModelResponse response = new GetDeviceModelResponse();
try {
final org.opensmartgridplatform.domain.da.valueobjects.GetDeviceModelResponse dataResponse = this.service.dequeueGetDeviceModelResponse(request.getAsyncRequest().getCorrelationUid());
if (dataResponse != null) {
response = this.mapper.map(dataResponse, GetDeviceModelResponse.class);
response.setResult(OsgpResultType.OK);
} else {
response.setResult(OsgpResultType.NOT_FOUND);
}
} catch (final ResponseNotFoundException e) {
LOGGER.warn("ResponseNotFoundException for getDeviceModel", e);
response.setResult(OsgpResultType.NOT_FOUND);
} catch (final Exception e) {
this.handleException(LOGGER, e);
}
response.setDeviceIdentification(request.getAsyncRequest().getDeviceId());
return response;
}
Aggregations