use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObjectDefinition 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.CaptureObjectDefinition in project open-smart-grid-platform by OSGP.
the class GetPowerQualityProfileRequestDataConverter method convert.
@Override
public GetPowerQualityProfileRequestData convert(final GetPowerQualityProfileRequest source, final Type<? extends GetPowerQualityProfileRequestData> destinationType, final MappingContext context) {
final GetPowerQualityProfileRequestData data = new GetPowerQualityProfileRequestData(source.getProfileType(), source.getBeginDate().toGregorianCalendar().getTime(), source.getEndDate().toGregorianCalendar().getTime());
if (source.getSelectedValues() != null) {
final List<CaptureObjectDefinition> captureObjectDefinitions = source.getSelectedValues().getCaptureObject();
captureObjectDefinitions.forEach(cod -> data.getSelectedValues().add(this.convert(cod)));
}
return data;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObjectDefinition 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