use of org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.UpdateDeviceCdmaSettingsAsyncResponse in project open-smart-grid-platform by OSGP.
the class UpdateDeviceCdmaSettingsSteps method receiveAnUpdateDeviceCdmaSettingsRequest.
@When("^an update device CDMA settings request is received$")
public void receiveAnUpdateDeviceCdmaSettingsRequest(final Map<String, String> requestParameters) throws Throwable {
final String deviceIdentification = getString(requestParameters, PlatformKeys.KEY_DEVICE_IDENTIFICATION, PlatformDefaults.DEFAULT_DEVICE_IDENTIFICATION);
final String mastSegment = getString(requestParameters, PlatformKeys.KEY_CDMA_MAST_SEGMENT);
final Short batchNumber = getShort(requestParameters, PlatformKeys.KEY_CDMA_BATCH_NUMBER);
LOGGER.info("WHEN: Receive UpdateDeviceCdmaSettingsRequest [deviceIdentification={}, mastSegment={}, batchNumber={}]", deviceIdentification, mastSegment, batchNumber);
final UpdateDeviceCdmaSettingsRequest request = new UpdateDeviceCdmaSettingsRequest();
request.setDeviceIdentification(deviceIdentification);
if (!StringUtils.isBlank(mastSegment)) {
request.setMastSegment(mastSegment);
}
if (batchNumber != null) {
request.setBatchNumber(batchNumber);
}
final UpdateDeviceCdmaSettingsAsyncResponse asyncResponse = this.client.updateDeviceCdmaSettings(request);
ScenarioContext.current().put(PlatformKeys.KEY_CORRELATION_UID, asyncResponse.getCorrelationUid());
ScenarioContext.current().put(PlatformKeys.KEY_DEVICE_IDENTIFICATION, asyncResponse.getDeviceId());
}
use of org.opensmartgridplatform.adapter.ws.schema.core.devicemanagement.UpdateDeviceCdmaSettingsAsyncResponse in project open-smart-grid-platform by OSGP.
the class DeviceManagementEndpoint method updateDeviceCdmaSettingsRequest.
@PayloadRoot(localPart = "UpdateDeviceCdmaSettingsRequest", namespace = DEVICE_MANAGEMENT_NAMESPACE)
@ResponsePayload
public UpdateDeviceCdmaSettingsAsyncResponse updateDeviceCdmaSettingsRequest(@OrganisationIdentification final String organisationIdentification, @RequestPayload final UpdateDeviceCdmaSettingsRequest request) throws OsgpException {
LOGGER.info("UpdateDeviceCdmaSettingsRequest received for device: {} and organisation: {}.", request.getDeviceIdentification(), organisationIdentification);
final UpdateDeviceCdmaSettingsAsyncResponse asyncResponse = new UpdateDeviceCdmaSettingsAsyncResponse();
try {
final CdmaSettings cdmaSettings = new CdmaSettings(request.getMastSegment(), request.getBatchNumber());
final String correlationUid = this.deviceManagementService.enqueueUpdateDeviceCdmaSettingsRequest(organisationIdentification, request.getDeviceIdentification(), cdmaSettings);
asyncResponse.setCorrelationUid(correlationUid);
asyncResponse.setDeviceId(request.getDeviceIdentification());
} catch (final Exception e) {
this.handleException(e);
}
return asyncResponse;
}
Aggregations