From: Tuukka Lehtonen Date: Tue, 28 Apr 2020 08:49:44 +0000 (+0300) Subject: Fixed subscription item data file searching to use groupItemId as well X-Git-Tag: v1.43.0~31 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F30%2F4130%2F1;p=simantics%2Fplatform.git Fixed subscription item data file searching to use groupItemId as well This fixes problems where subscription item data CSV export used the wrong data files to read the data related to the subscription item because it wasn't matching the data file based on both groupItemId (subscription item GUID name) and variable ID, which can be overlapping if a new subscription item is created for a variable that has had a previous subscription. gitlab #528 Change-Id: If1ddef78e4b152cf6721f82afc21b37ec5fbb074 (cherry picked from commit b141f43453a9078e2cf77302bc43c646e72c98fe) --- diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/editor/ChartCopyHandler.java b/bundles/org.simantics.charts/src/org/simantics/charts/editor/ChartCopyHandler.java index 183000045..1e1c6e1b3 100644 --- a/bundles/org.simantics.charts/src/org/simantics/charts/editor/ChartCopyHandler.java +++ b/bundles/org.simantics.charts/src/org/simantics/charts/editor/ChartCopyHandler.java @@ -158,7 +158,7 @@ public class ChartCopyHandler extends AbstractHandler { for (TrendItem i : t.spec.items) { if (i.hidden) continue; - List items = im.search("variableId", i.variableId); + List items = im.search("groupItemId", i.groupItemId, "variableId", i.variableId); Collections.sort(items, SamplingFormat.INTERVAL_COMPARATOR); if (items.isEmpty()) continue; Bean config = items.get(0); diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/export/ExportChartCSV.java b/bundles/org.simantics.charts/src/org/simantics/charts/export/ExportChartCSV.java index 7e6bdc3b7..57f1ed33f 100644 --- a/bundles/org.simantics.charts/src/org/simantics/charts/export/ExportChartCSV.java +++ b/bundles/org.simantics.charts/src/org/simantics/charts/export/ExportChartCSV.java @@ -102,7 +102,7 @@ public class ExportChartCSV extends org.simantics.simulation.export.ExperimentEx labelBuilder.append(")"); } - List historyItems = im.search("variableId", item.variableReference); + List historyItems = im.search("groupItemId", item.groupItemId, "variableId", item.variableReference); Collections.sort(historyItems, SamplingFormat.INTERVAL_COMPARATOR); if (items.isEmpty()) continue; Bean config = historyItems.get(0); diff --git a/bundles/org.simantics.simulation/src/org/simantics/simulation/export/CSVItemsQuery.java b/bundles/org.simantics.simulation/src/org/simantics/simulation/export/CSVItemsQuery.java index a39f2e736..6ce6a50cf 100644 --- a/bundles/org.simantics.simulation/src/org/simantics/simulation/export/CSVItemsQuery.java +++ b/bundles/org.simantics.simulation/src/org/simantics/simulation/export/CSVItemsQuery.java @@ -77,7 +77,10 @@ public class CSVItemsQuery implements Read> { // Resource experiment = graph.syncRequest(new PossibleExperiment(subscriptionItem)); // String runIdentifier = ""; // experiment.getIdentifier(); - + + item.groupItemId = graph.getPossibleRelatedValue(subscriptionItem, L0.HasName, Bindings.STRING); + if (item.groupItemId == null) continue; + item.variableReference = rvi.toPossibleString(graph, configuration); if (item.variableReference == null) continue; @@ -118,6 +121,7 @@ public class CSVItemsQuery implements Read> { public static class CSVItem { public String modelUri; public String label; + public String groupItemId; public String variableReference; public String unit; } diff --git a/bundles/org.simantics.simulation/src/org/simantics/simulation/export/ExportSubscriptionCSV.java b/bundles/org.simantics.simulation/src/org/simantics/simulation/export/ExportSubscriptionCSV.java index 07954660e..9abae29d2 100644 --- a/bundles/org.simantics.simulation/src/org/simantics/simulation/export/ExportSubscriptionCSV.java +++ b/bundles/org.simantics.simulation/src/org/simantics/simulation/export/ExportSubscriptionCSV.java @@ -97,7 +97,7 @@ public class ExportSubscriptionCSV extends ExperimentExportClass implements Expo labelBuilder.append(")"); } - List historyItems = im.search("variableId", item.variableReference); + List historyItems = im.search("groupItemId", item.groupItemId, "variableId", item.variableReference); Collections.sort(historyItems, SamplingFormat.INTERVAL_COMPARATOR); if (items.isEmpty()) continue; Bean config = historyItems.get(0);