Search in sources :

Example 1 with JsonResultForPDURealtimeValue

use of com.vmware.flowgate.nlyteworker.model.JsonResultForPDURealtimeValue in project flowgate by vmware.

the class NlyteDataService method generateRealTimeData.

public RealTimeData generateRealTimeData(Asset asset, NlyteAPIClient nlyteAPIclient, HashMap<AdvanceSettingType, String> advanceSettingMap) {
    RealTimeData realTimeData = null;
    JsonResultForPDURealtimeValue result = nlyteAPIclient.getPowerStripsRealtimeValue(asset.getAssetNumber()).getBody();
    List<ValueUnit> valueUnits = generateValueUnits(result.getValue(), advanceSettingMap);
    if (!valueUnits.isEmpty()) {
        realTimeData = new RealTimeData();
        realTimeData.setAssetID(asset.getId());
        realTimeData.setValues(valueUnits);
        realTimeData.setTime(valueUnits.get(0).getTime());
        realTimeData.setId(realTimeData.getAssetID() + "_" + realTimeData.getTime());
    }
    return realTimeData;
}
Also used : RealTimeData(com.vmware.flowgate.common.model.RealTimeData) ValueUnit(com.vmware.flowgate.common.model.ValueUnit) JsonResultForPDURealtimeValue(com.vmware.flowgate.nlyteworker.model.JsonResultForPDURealtimeValue)

Example 2 with JsonResultForPDURealtimeValue

use of com.vmware.flowgate.nlyteworker.model.JsonResultForPDURealtimeValue in project flowgate by vmware.

the class SycnRealTimeDataJobTest method getPowerStripsRealtimeValue1.

public ResponseEntity<JsonResultForPDURealtimeValue> getPowerStripsRealtimeValue1() {
    JsonResultForPDURealtimeValue pduvalue = new JsonResultForPDURealtimeValue();
    List<PowerStripsRealtimeValue> value = new ArrayList<PowerStripsRealtimeValue>();
    PowerStripsRealtimeValue power = new PowerStripsRealtimeValue();
    power.setName("RealtimePower");
    power.setValue(20);
    power.setRecordedDateTime("2018-09-20T14:35:25Z");
    value.add(power);
    PowerStripsRealtimeValue current = new PowerStripsRealtimeValue();
    current.setName("RealtimeLoad");
    current.setValue(20);
    current.setUnit("");
    current.setRecordedDateTime("2018-09-20T14:35:25Z");
    value.add(current);
    PowerStripsRealtimeValue voltage = new PowerStripsRealtimeValue();
    voltage.setName("RealtimeVoltage");
    voltage.setUnit("Volts");
    voltage.setValue(120);
    voltage.setRecordedDateTime("2018-09-20T14:35:25Z");
    value.add(voltage);
    pduvalue.setValue(value);
    return new ResponseEntity<JsonResultForPDURealtimeValue>(pduvalue, HttpStatus.OK);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) ArrayList(java.util.ArrayList) PowerStripsRealtimeValue(com.vmware.flowgate.nlyteworker.model.PowerStripsRealtimeValue) JsonResultForPDURealtimeValue(com.vmware.flowgate.nlyteworker.model.JsonResultForPDURealtimeValue)

Example 3 with JsonResultForPDURealtimeValue

use of com.vmware.flowgate.nlyteworker.model.JsonResultForPDURealtimeValue in project flowgate by vmware.

the class SycnRealTimeDataJobTest method getPowerStripsRealtimeValue.

public ResponseEntity<JsonResultForPDURealtimeValue> getPowerStripsRealtimeValue() {
    JsonResultForPDURealtimeValue pduvalue = new JsonResultForPDURealtimeValue();
    List<PowerStripsRealtimeValue> value = new ArrayList<PowerStripsRealtimeValue>();
    PowerStripsRealtimeValue power = new PowerStripsRealtimeValue();
    power.setName("RealtimePower");
    power.setUnit("kw");
    power.setValue(20);
    power.setRecordedDateTime("2018-09-20T14:35:25Z");
    value.add(power);
    PowerStripsRealtimeValue current = new PowerStripsRealtimeValue();
    current.setName("RealtimeLoad");
    current.setUnit("Amps");
    current.setValue(20);
    current.setRecordedDateTime("2018-09-20T14:35:25Z");
    value.add(current);
    PowerStripsRealtimeValue voltage = new PowerStripsRealtimeValue();
    voltage.setName("RealtimeVoltage");
    voltage.setUnit("Volts");
    voltage.setValue(120);
    voltage.setRecordedDateTime("2018-09-20T14:35:25Z");
    value.add(voltage);
    pduvalue.setValue(value);
    return new ResponseEntity<JsonResultForPDURealtimeValue>(pduvalue, HttpStatus.OK);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) ArrayList(java.util.ArrayList) PowerStripsRealtimeValue(com.vmware.flowgate.nlyteworker.model.PowerStripsRealtimeValue) JsonResultForPDURealtimeValue(com.vmware.flowgate.nlyteworker.model.JsonResultForPDURealtimeValue)

Aggregations

JsonResultForPDURealtimeValue (com.vmware.flowgate.nlyteworker.model.JsonResultForPDURealtimeValue)3 PowerStripsRealtimeValue (com.vmware.flowgate.nlyteworker.model.PowerStripsRealtimeValue)2 ArrayList (java.util.ArrayList)2 ResponseEntity (org.springframework.http.ResponseEntity)2 RealTimeData (com.vmware.flowgate.common.model.RealTimeData)1 ValueUnit (com.vmware.flowgate.common.model.ValueUnit)1