Search in sources :

Example 1 with GetDataAsyncResponse

use of org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataAsyncResponse in project open-smart-grid-platform by OSGP.

the class ReportingSteps method doGetDataRequest.

private void doGetDataRequest(final Map<String, String> settings) throws Throwable {
    final GetDataRequest getDataRequest = new GetDataRequest();
    getDataRequest.setDeviceIdentification(settings.get(PlatformMicrogridsKeys.KEY_DEVICE_IDENTIFICATION));
    GetDataAsyncResponse asyncResponse;
    asyncResponse = this.adHocManagementClient.getDataAsync(getDataRequest);
    final GetDataAsyncRequest getDataAsyncRequest = new GetDataAsyncRequest();
    final AsyncRequest value = new AsyncRequest();
    value.setCorrelationUid(asyncResponse.getAsyncResponse().getCorrelationUid());
    value.setDeviceId(asyncResponse.getAsyncResponse().getDeviceId());
    getDataAsyncRequest.setAsyncRequest(value);
    this.adHocManagementClient.getData(getDataAsyncRequest);
}
Also used : GetDataAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataAsyncRequest) AsyncRequest(org.opensmartgridplatform.adapter.ws.schema.microgrids.common.AsyncRequest) GetDataAsyncRequest(org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataAsyncRequest) GetDataRequest(org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataRequest) GetDataAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataAsyncResponse)

Example 2 with GetDataAsyncResponse

use of org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataAsyncResponse in project open-smart-grid-platform by OSGP.

the class AdHocManagementEndpoint method getData.

// === GET DATA ===
@PayloadRoot(localPart = "GetDataRequest", namespace = NAMESPACE)
@ResponsePayload
public GetDataAsyncResponse getData(@OrganisationIdentification final String organisationIdentification, @RequestPayload final GetDataRequest request) throws OsgpException {
    LOGGER.info("Get Data Request received from organisation: {} for device: {}.", organisationIdentification, request.getDeviceIdentification());
    final GetDataAsyncResponse response = new GetDataAsyncResponse();
    try {
        final org.opensmartgridplatform.domain.microgrids.valueobjects.GetDataRequest dataRequest = this.mapper.map(request, org.opensmartgridplatform.domain.microgrids.valueobjects.GetDataRequest.class);
        final String correlationUid = this.service.enqueueGetDataRequest(organisationIdentification, request.getDeviceIdentification(), dataRequest);
        final AsyncResponse asyncResponse = new AsyncResponse();
        asyncResponse.setCorrelationUid(correlationUid);
        asyncResponse.setDeviceId(request.getDeviceIdentification());
        response.setAsyncResponse(asyncResponse);
    } catch (final Exception e) {
        this.handleException(e);
    }
    return response;
}
Also used : SetDataAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.SetDataAsyncResponse) AsyncResponse(org.opensmartgridplatform.adapter.ws.schema.microgrids.common.AsyncResponse) GetDataAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataAsyncResponse) GetDataAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataAsyncResponse) ResponseNotFoundException(org.opensmartgridplatform.adapter.ws.microgrids.application.exceptionhandling.ResponseNotFoundException) OsgpException(org.opensmartgridplatform.shared.exceptionhandling.OsgpException) TechnicalException(org.opensmartgridplatform.shared.exceptionhandling.TechnicalException) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Example 3 with GetDataAsyncResponse

use of org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataAsyncResponse in project open-smart-grid-platform by OSGP.

the class GetDataSteps method aGetDataRequestIsReceived.

@When("^a get data request is received$")
public void aGetDataRequestIsReceived(final Map<String, String> requestParameters) throws Throwable {
    final GetDataRequest getDataRequest = GetDataRequestBuilder.fromParameterMap(requestParameters);
    final GetDataAsyncResponse response = this.client.getDataAsync(getDataRequest);
    ScenarioContext.current().put(PlatformKeys.KEY_CORRELATION_UID, response.getAsyncResponse().getCorrelationUid());
    ScenarioContext.current().put(PlatformKeys.KEY_DEVICE_IDENTIFICATION, response.getAsyncResponse().getDeviceId());
}
Also used : GetDataRequest(org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataRequest) GetDataAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataAsyncResponse) When(io.cucumber.java.en.When)

Aggregations

GetDataAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataAsyncResponse)3 GetDataRequest (org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataRequest)2 When (io.cucumber.java.en.When)1 ResponseNotFoundException (org.opensmartgridplatform.adapter.ws.microgrids.application.exceptionhandling.ResponseNotFoundException)1 GetDataAsyncRequest (org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataAsyncRequest)1 SetDataAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.SetDataAsyncResponse)1 AsyncRequest (org.opensmartgridplatform.adapter.ws.schema.microgrids.common.AsyncRequest)1 AsyncResponse (org.opensmartgridplatform.adapter.ws.schema.microgrids.common.AsyncResponse)1 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)1 TechnicalException (org.opensmartgridplatform.shared.exceptionhandling.TechnicalException)1 PayloadRoot (org.springframework.ws.server.endpoint.annotation.PayloadRoot)1 ResponsePayload (org.springframework.ws.server.endpoint.annotation.ResponsePayload)1