Search in sources :

Example 1 with GetDeviceModelResponse

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;
}
Also used : GetDeviceModelResponse(org.opensmartgridplatform.adapter.ws.schema.distributionautomation.generic.GetDeviceModelResponse) ResponseNotFoundException(org.opensmartgridplatform.adapter.ws.da.application.exceptionhandling.ResponseNotFoundException) OsgpException(org.opensmartgridplatform.shared.exceptionhandling.OsgpException) ResponseNotFoundException(org.opensmartgridplatform.adapter.ws.da.application.exceptionhandling.ResponseNotFoundException) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Aggregations

ResponseNotFoundException (org.opensmartgridplatform.adapter.ws.da.application.exceptionhandling.ResponseNotFoundException)1 GetDeviceModelResponse (org.opensmartgridplatform.adapter.ws.schema.distributionautomation.generic.GetDeviceModelResponse)1 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)1 PayloadRoot (org.springframework.ws.server.endpoint.annotation.PayloadRoot)1 ResponsePayload (org.springframework.ws.server.endpoint.annotation.ResponsePayload)1