Search in sources :

Example 1 with CaptureObjectDefinition

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;
}
Also used : CaptureObjectDefinition(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObjectDefinition) CaptureObjectDefinitions(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObjectDefinitions)

Example 2 with CaptureObjectDefinition

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;
}
Also used : CaptureObjectDefinition(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObjectDefinition) GetPowerQualityProfileRequestData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetPowerQualityProfileRequestData)

Example 3 with CaptureObjectDefinition

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;
}
Also used : CaptureObjectDefinition(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObjectDefinition) CaptureObjectDefinitions(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObjectDefinitions)

Aggregations

CaptureObjectDefinition (org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObjectDefinition)3 CaptureObjectDefinitions (org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObjectDefinitions)2 GetPowerQualityProfileRequestData (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetPowerQualityProfileRequestData)1