use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObjectDefinitions in project open-smart-grid-platform by OSGP.
the class CaptureObjectDefinitionsFactory method fromParameterMap.
public static CaptureObjectDefinitions fromParameterMap(final Map<String, String> requestParameters) {
final CaptureObjectDefinitions captureObjectDefinitions = new CaptureObjectDefinitions();
final List<CaptureObjectDefinition> selectedValues = captureObjectDefinitions.getCaptureObject();
final int numberOfSelectedValues = getInteger(requestParameters, NUMBER_OF_SELECTED_VALUES, 0);
for (int i = 1; i <= numberOfSelectedValues; i++) {
final CaptureObjectDefinition captureObjectDefinition = new CaptureObjectDefinition();
captureObjectDefinition.setClassId(SettingsHelper.getIntegerValue(requestParameters, CLASS_ID, i));
captureObjectDefinition.setLogicalName(logicalNameFromParemeterMap(requestParameters, i));
captureObjectDefinition.setAttributeIndex(SettingsHelper.getByteValue(requestParameters, ATTRIBUTE_INDEX, i));
captureObjectDefinition.setDataIndex(SettingsHelper.getIntegerValue(requestParameters, DATA_INDEX, i));
selectedValues.add(captureObjectDefinition);
}
return captureObjectDefinitions;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObjectDefinitions in project open-smart-grid-platform by OSGP.
the class GetPowerQualityProfileRequestFactory method fromParameterMap.
public static GetPowerQualityProfileRequest fromParameterMap(final Map<String, String> requestParameters) {
final GetPowerQualityProfileRequest getPowerQualityProfileRequestData = new GetPowerQualityProfileRequest();
final DateTime beginDate = dateFromParameterMap(requestParameters, PlatformKeys.KEY_BEGIN_DATE);
final DateTime endDate = dateFromParameterMap(requestParameters, PlatformKeys.KEY_END_DATE);
final String profileType = getString(requestParameters, PlatformKeys.KEY_POWER_QUALITY_PROFILE_TYPE);
final CaptureObjectDefinitions captureObjecDefinitions = CaptureObjectDefinitionsFactory.fromParameterMap(requestParameters);
getPowerQualityProfileRequestData.setDeviceIdentification(requestParameters.get(PlatformKeys.KEY_DEVICE_IDENTIFICATION));
getPowerQualityProfileRequestData.setBeginDate(DateConverter.createXMLGregorianCalendar(beginDate.toDate()));
getPowerQualityProfileRequestData.setEndDate(DateConverter.createXMLGregorianCalendar(endDate.toDate()));
getPowerQualityProfileRequestData.setProfileType(profileType);
getPowerQualityProfileRequestData.setSelectedValues(captureObjecDefinitions);
return getPowerQualityProfileRequestData;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObjectDefinitions in project open-smart-grid-platform by OSGP.
the class GetGetPowerQualityProfileRequestMappingTest method makeRequest.
private GetPowerQualityProfileRequest makeRequest() {
final GetPowerQualityProfileRequest result = new GetPowerQualityProfileRequest();
result.setProfileType("PRIVATE");
result.setBeginDate(this.toGregorianCalendar(BEGIN_DATE));
result.setEndDate(this.toGregorianCalendar(END_DATE));
result.setSelectedValues(new CaptureObjectDefinitions());
return result;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObjectDefinitions in project open-smart-grid-platform by OSGP.
the class CaptureObjectsFactory method fromParameterMap.
public static CaptureObjectDefinitions fromParameterMap(final Map<String, String> requestParameters) {
if (!requestParameters.containsKey(PlatformSmartmeteringKeys.NUMBER_OF_CAPTURE_OBJECTS)) {
return null;
}
final CaptureObjectDefinitions captureObjectDefinitions = new CaptureObjectDefinitions();
final List<CaptureObjectDefinition> captureObjects = captureObjectDefinitions.getCaptureObject();
final int numberOfCaptureObjects = getInteger(requestParameters, PlatformSmartmeteringKeys.NUMBER_OF_CAPTURE_OBJECTS, 0);
for (int i = 1; i <= numberOfCaptureObjects; i++) {
final CaptureObjectDefinition captureObjectDefinition = new CaptureObjectDefinition();
captureObjectDefinition.setClassId(SettingsHelper.getIntegerValue(requestParameters, PlatformSmartmeteringKeys.CAPTURE_OBJECT_CLASS_ID, i));
captureObjectDefinition.setLogicalName(logicalNameFromParemeterMap(requestParameters, i));
captureObjectDefinition.setAttributeIndex(SettingsHelper.getByteValue(requestParameters, PlatformSmartmeteringKeys.CAPTURE_OBJECT_ATTRIBUTE_INDEX, i));
captureObjectDefinition.setDataIndex(SettingsHelper.getIntegerValue(requestParameters, PlatformSmartmeteringKeys.CAPTURE_OBJECT_DATA_INDEX, i));
captureObjects.add(captureObjectDefinition);
}
return captureObjectDefinitions;
}
Aggregations