Search in sources :

Example 1 with SetDataAsyncResponse

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

the class AdHocManagementEndpoint method setData.

// === SET DATA ===
@PayloadRoot(localPart = "SetDataRequest", namespace = NAMESPACE)
@ResponsePayload
public SetDataAsyncResponse setData(@OrganisationIdentification final String organisationIdentification, @RequestPayload final SetDataRequest request) throws OsgpException {
    LOGGER.info("Set Data Request received from organisation: {} for device: {}.", organisationIdentification, request.getDeviceIdentification());
    final SetDataAsyncResponse response = new SetDataAsyncResponse();
    try {
        final org.opensmartgridplatform.domain.microgrids.valueobjects.SetDataRequest setDataRequest = this.mapper.map(request, org.opensmartgridplatform.domain.microgrids.valueobjects.SetDataRequest.class);
        final String correlationUid = this.service.enqueueSetDataRequest(organisationIdentification, request.getDeviceIdentification(), setDataRequest);
        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) 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) 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 2 with SetDataAsyncResponse

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

the class SetDataSteps method aSetDataRequestIsReceived.

@When("^a set data request is received$")
public void aSetDataRequestIsReceived(final Map<String, String> requestParameters) throws Throwable {
    final String organizationIdentification = (String) ScenarioContext.current().get(PlatformKeys.KEY_ORGANIZATION_IDENTIFICATION, PlatformDefaults.DEFAULT_ORGANIZATION_IDENTIFICATION);
    ScenarioContext.current().put(PlatformKeys.KEY_ORGANIZATION_IDENTIFICATION, organizationIdentification);
    final String userName = (String) ScenarioContext.current().get(PlatformKeys.KEY_USER_NAME, PlatformDefaults.DEFAULT_USER_NAME);
    ScenarioContext.current().put(PlatformKeys.KEY_USER_NAME, userName);
    final SetDataRequest setDataRequest = SetDataRequestBuilder.fromParameterMap(requestParameters);
    final SetDataAsyncResponse response = this.client.setDataAsync(setDataRequest);
    ScenarioContext.current().put(PlatformKeys.KEY_CORRELATION_UID, response.getAsyncResponse().getCorrelationUid());
}
Also used : SetDataAsyncResponse(org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.SetDataAsyncResponse) SetDataRequest(org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.SetDataRequest) When(io.cucumber.java.en.When)

Aggregations

SetDataAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.SetDataAsyncResponse)2 When (io.cucumber.java.en.When)1 ResponseNotFoundException (org.opensmartgridplatform.adapter.ws.microgrids.application.exceptionhandling.ResponseNotFoundException)1 GetDataAsyncResponse (org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.GetDataAsyncResponse)1 SetDataRequest (org.opensmartgridplatform.adapter.ws.schema.microgrids.adhocmanagement.SetDataRequest)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