Search in sources :

Example 1 with CaptureObjectDefinitions

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

Example 2 with 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;
}
Also used : ReadSettingsHelper.getString(org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getString) GetPowerQualityProfileRequest(org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.GetPowerQualityProfileRequest) CaptureObjectDefinitions(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObjectDefinitions) DateTime(org.joda.time.DateTime)

Example 3 with CaptureObjectDefinitions

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

Example 4 with CaptureObjectDefinitions

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

Aggregations

CaptureObjectDefinitions (org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObjectDefinitions)4 CaptureObjectDefinition (org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.CaptureObjectDefinition)2 DateTime (org.joda.time.DateTime)1 GetPowerQualityProfileRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.bundle.GetPowerQualityProfileRequest)1 GetPowerQualityProfileRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.GetPowerQualityProfileRequest)1 ReadSettingsHelper.getString (org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getString)1