| | |
| | | List<Map<String, Object>> changes = (List<Map<String, Object>>) (List<?>) JSON.parseArray(action.getChangesSummary(), Map.class); |
| | | Set<String> editable = switch (action.getDataType()) |
| | | { |
| | | case "REALTIME" -> Set.of("voltage", "current", "capacity", "energy", "metricValue"); |
| | | case "REALTIME" -> Set.of("voltage", "current", "capacity", "energy", "metricValue", |
| | | "temperature", "positivePotential", "negativePotential"); |
| | | case "STEP" -> Set.of("stepDuration", "capacity", "energy", "startVoltage", "endVoltage", |
| | | "chargePeakVoltage", "dischargeValleyVoltage"); |
| | | case "CYCLE" -> Set.of("chargeCapacity", "dischargeCapacity", "efficiency", "chargeEnergy", |
| | |
| | | { |
| | | return switch (dataType) |
| | | { |
| | | case "REALTIME" -> Set.of("voltage", "current", "capacity", "energy", "metricValue"); |
| | | case "REALTIME" -> Set.of("voltage", "current", "capacity", "energy", "metricValue", |
| | | "temperature", "positivePotential", "negativePotential"); |
| | | case "STEP" -> Set.of("stepDuration", "capacity", "energy", "startVoltage", "endVoltage", |
| | | "chargePeakVoltage", "dischargeValleyVoltage"); |
| | | case "CYCLE" -> Set.of("chargeCapacity", "dischargeCapacity", "efficiency", "chargeEnergy", |
| | |
| | | try { return new Long[] { Long.valueOf(parts[1]), Long.valueOf(parts[3]) }; } |
| | | catch (NumberFormatException exception) { return null; } |
| | | } |
| | | if ("REALTIME".equals(dataType) && parts.length == 2 && "snapshot".equals(parts[0])) |
| | | { |
| | | try { return new Long[] { Long.valueOf(parts[1]) }; } |
| | | catch (NumberFormatException exception) { return null; } |
| | | } |
| | | int expectedLength = "STEP".equals(dataType) ? 8 : "CYCLE".equals(dataType) ? 7 : 6; |
| | | int legacyLength = "STEP".equals(dataType) ? 5 : "CYCLE".equals(dataType) ? 4 : 3; |
| | | if (parts.length != expectedLength && parts.length != legacyLength) return null; |