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;
}
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());
}
Aggregations