]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fixed subscription item data file searching to use groupItemId as well 95/4195/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 28 Apr 2020 08:49:44 +0000 (11:49 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 28 Apr 2020 08:49:44 +0000 (11:49 +0300)
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

bundles/org.simantics.charts/src/org/simantics/charts/editor/ChartCopyHandler.java
bundles/org.simantics.charts/src/org/simantics/charts/export/ExportChartCSV.java
bundles/org.simantics.simulation/src/org/simantics/simulation/export/CSVItemsQuery.java
bundles/org.simantics.simulation/src/org/simantics/simulation/export/ExportSubscriptionCSV.java

index 183000045aed17cd3f2f6b44ed60fe834e1f8292..1e1c6e1b30d2995788ab2e7edee5237119525444 100644 (file)
@@ -158,7 +158,7 @@ public class ChartCopyHandler extends AbstractHandler {
                    
                    for (TrendItem i : t.spec.items) {
                        if (i.hidden) continue;
-                       List<Bean> items = im.search("variableId", i.variableId);
+                       List<Bean> items = im.search("groupItemId", i.groupItemId, "variableId", i.variableId);
                        Collections.sort(items, SamplingFormat.INTERVAL_COMPARATOR);
                        if (items.isEmpty()) continue;
                        Bean config = items.get(0);
index 7e6bdc3b7cc07a0eda98b618b608e1f9ff516b00..57f1ed33fccf7456acdb69af5c90ee1ad32e3281 100644 (file)
@@ -102,7 +102,7 @@ public class ExportChartCSV extends org.simantics.simulation.export.ExperimentEx
                                                                labelBuilder.append(")");
                                                        }
                                                        
-                                       List<Bean> historyItems = im.search("variableId", item.variableReference);
+                                       List<Bean> historyItems = im.search("groupItemId", item.groupItemId, "variableId", item.variableReference);
                                        Collections.sort(historyItems, SamplingFormat.INTERVAL_COMPARATOR);
                                        if (items.isEmpty()) continue;
                                        Bean config = historyItems.get(0);
index a39f2e736087b08bc94f81bad8199eaae2f3ec76..6ce6a50cf553b4ec45f5b08cd915e8883a03f59a 100644 (file)
@@ -77,7 +77,10 @@ public class CSVItemsQuery implements Read<List<CSVItemsQuery.CSVItem>> {
                        
 //            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<List<CSVItemsQuery.CSVItem>> {
     public static class CSVItem {
        public String modelUri;
        public String label;
+       public String groupItemId;
        public String variableReference;
        public String unit;
     }
index 07954660edd202124478599d6b22df3eb6095d5a..9abae29d2271c0b17de30e92d87b0f9e590311b2 100644 (file)
@@ -97,7 +97,7 @@ public class ExportSubscriptionCSV extends ExperimentExportClass implements Expo
                                                                labelBuilder.append(")");
                                                        }
                                                        
-                                       List<Bean> historyItems = im.search("variableId", item.variableReference);
+                                       List<Bean> historyItems = im.search("groupItemId", item.groupItemId, "variableId", item.variableReference);
                                        Collections.sort(historyItems, SamplingFormat.INTERVAL_COMPARATOR);
                                        if (items.isEmpty()) continue;
                                        Bean config = historyItems.get(0);