use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues in project open-smart-grid-platform by OSGP.
the class ObisCodeValuesFactory method fromParameterMap.
public static ObisCodeValues fromParameterMap(final Map<String, String> parameters) {
final ObisCodeValues obisCode = new ObisCodeValues();
obisCode.setA(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_A)));
obisCode.setB(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_B)));
obisCode.setC(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_C)));
obisCode.setD(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_D)));
obisCode.setE(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_E)));
obisCode.setF(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_F)));
return obisCode;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues in project open-smart-grid-platform by OSGP.
the class SetPushSetupAlarmRequestBuilder method convertObisCode.
private ObisCodeValues convertObisCode(final String obisCode) {
final String[] obisCodeSplit = obisCode.split("\\.");
final ObisCodeValues obisCodeValues = new ObisCodeValues();
obisCodeValues.setA(Short.parseShort(obisCodeSplit[0]));
obisCodeValues.setB(Short.parseShort(obisCodeSplit[1]));
obisCodeValues.setC(Short.parseShort(obisCodeSplit[2]));
obisCodeValues.setD(Short.parseShort(obisCodeSplit[3]));
obisCodeValues.setE(Short.parseShort(obisCodeSplit[4]));
obisCodeValues.setF(Short.parseShort(obisCodeSplit[5]));
return obisCodeValues;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues in project open-smart-grid-platform by OSGP.
the class ObisCodeValuesFactory method fromParameterMap.
public static ObisCodeValues fromParameterMap(final Map<String, String> parameterMap) {
final ObisCodeValues result = new ObisCodeValues();
result.setA(getShort(parameterMap, PlatformSmartmeteringKeys.OBIS_CODE_A, (short) 0));
result.setB(getShort(parameterMap, PlatformSmartmeteringKeys.OBIS_CODE_B, (short) 0));
result.setC(getShort(parameterMap, PlatformSmartmeteringKeys.OBIS_CODE_C, (short) 0));
result.setD(getShort(parameterMap, PlatformSmartmeteringKeys.OBIS_CODE_D, (short) 0));
result.setE(getShort(parameterMap, PlatformSmartmeteringKeys.OBIS_CODE_E, (short) 0));
result.setF(getShort(parameterMap, PlatformSmartmeteringKeys.OBIS_CODE_F, (short) 0));
return result;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues in project open-smart-grid-platform by OSGP.
the class GetSpecificAttributeValueRequestBuilder method fromParameterMap.
public GetSpecificAttributeValueRequestBuilder fromParameterMap(final Map<String, String> parameters) {
this.classId = new BigInteger(parameters.get(PlatformSmartmeteringKeys.CLASS_ID));
this.obisCode = new ObisCodeValues();
this.obisCode.setA(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_A)));
this.obisCode.setB(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_B)));
this.obisCode.setC(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_C)));
this.obisCode.setD(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_D)));
this.obisCode.setE(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_E)));
this.obisCode.setF(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_F)));
this.attribute = new BigInteger(parameters.get(PlatformSmartmeteringKeys.ATTRIBUTE));
return this;
}
use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues in project open-smart-grid-platform by OSGP.
the class ObisCodeValuesTest method testObisCodeValues.
@Test
public void testObisCodeValues() {
final AdhocMapper mapper = new AdhocMapper();
final ObisCodeValues obisCodeValues = new ObisCodeValues();
obisCodeValues.setA((short) 1);
obisCodeValues.setB((short) 2);
obisCodeValues.setC((short) 3);
obisCodeValues.setD((short) 234);
obisCodeValues.setE((short) 5);
obisCodeValues.setF((short) 255);
final org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ObisCodeValues obisCodeValues2 = mapper.map(obisCodeValues, org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ObisCodeValues.class);
assertThat(obisCodeValues2.getA()).isEqualTo((byte) 1);
assertThat(obisCodeValues2.getB()).isEqualTo((byte) 2);
assertThat(obisCodeValues2.getC()).isEqualTo((byte) 3);
assertThat(obisCodeValues2.getD()).isEqualTo((byte) -22);
assertThat(obisCodeValues2.getE()).isEqualTo((byte) 5);
assertThat(obisCodeValues2.getF()).isEqualTo((byte) -1);
}
Aggregations