]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Changed ChildVariable to extend AbstractChildVariable instead of StandardGraphChildVa...
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 20 Apr 2011 10:12:40 +0000 (10:12 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 20 Apr 2011 10:12:40 +0000 (10:12 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@20544 ac1ea38d-2e2b-0410-8846-a27921b304fc

12 files changed:
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/actions/ShowInstantiatedModuleAction.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/participant/SysdynComponentCopyAdvisor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/InputFactory.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ShowModuleHandler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/ReplaceableEnumerations.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/viewUtils/SysdynDatasetSelectionListener.java
org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ChildVariable.java
org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ChildVariableAdapter.java
org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ConfigurationVariable.java
org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/HistoryVariable.java
org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ModuleVariable.java
org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/RunVariable.java

index e66d38d741d1920a4924a4c9e3759b37e2c8a409..83c993de775ffa1373c6e3291c831b1dcfef80af 100644 (file)
@@ -24,7 +24,6 @@ import org.simantics.layer0.Layer0;
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.structural.stubs.StructuralResource2;\r
 import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.adapter.ChildVariable;\r
 import org.simantics.sysdyn.ui.browser.BrowserSelection;\r
 import org.simantics.sysdyn.ui.browser.nodes.ModuleNode;\r
 import org.simantics.ui.DoubleClickEvent;\r
@@ -56,8 +55,8 @@ public class ShowInstantiatedModuleAction implements IDoubleClickAction {
                                        StructuralResource2 sr2 = StructuralResource2.getInstance(g);\r
                                        if(g.isInheritedFrom(instanceOf, sr.Module)) {\r
                                                configuration = g.getSingleObject(instanceOf, sr2.IsDefinedBy);\r
-                                               ChildVariable variable = (ChildVariable) bs.getAdapter(Variable.class);\r
-                                               String rvi = variable.getRvi(g);\r
+                                               Variable variable = (Variable) bs.getAdapter(Variable.class);\r
+                                               String rvi = Variables.getRVI(g, variable).substring(1);\r
                                                Resource model = Variables.getModel(g, variable);\r
                                                addShowModuleAction(e, getResourceEditorInput(g, model, configuration, rvi));\r
                                        } \r
@@ -71,8 +70,8 @@ public class ShowInstantiatedModuleAction implements IDoubleClickAction {
                                        String rvi;\r
                                        if(moduleNode.getVariable() != null) {\r
                                                model = Variables.getModel(g, moduleNode.getVariable());\r
-                                               ChildVariable var = (ChildVariable)moduleNode.getVariable();\r
-                                               rvi = var.getRvi(g);\r
+                                               Variable var = moduleNode.getVariable();\r
+                                               rvi = Variables.getRVI(g, var).substring(1);\r
                                        } else {\r
                                                rvi = (String)g.getRelatedValue(moduleNode.data, Layer0.getInstance(g).HasName);\r
                                                model = g.getSingleObject(moduleNode.data, l0.PartOf);\r
index 22e08f6214164f9c0df46eda85e0cb7947caf4af..170d02de59e165a84dbf5d3f86abf584f357507f 100644 (file)
@@ -27,7 +27,7 @@ public class SysdynComponentCopyAdvisor extends ComponentCopyAdvisor{
 \r
     @Override\r
     public Object copy(ISynchronizationContext context, WriteGraph graph, Resource source, Resource sourceContainer, Resource targetContainer) throws DatabaseException {\r
-       \r
+       \r
        BinaryFunction<Boolean, ReadGraph, Statement> tester = new BinaryFunction<Boolean, ReadGraph, Statement>() {\r
 \r
                        @Override\r
index 2812961b7e701dc0287ceb8fe24103e884ccfae8..9cee6cb4345b5ba09a7f51edbfcac844cc2e1d29 100644 (file)
@@ -22,7 +22,9 @@ import java.util.Collection;
 \r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
+import org.simantics.db.common.utils.NameUtils;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.exception.MissingVariableException;\r
 import org.simantics.db.layer0.variable.Variable;\r
 import org.simantics.db.layer0.variable.Variables;\r
 import org.simantics.diagram.elements.TextNode;\r
@@ -56,7 +58,6 @@ import org.simantics.scenegraph.g2d.G2DParentNode;
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.adapter.ChildVariable;\r
 import org.simantics.sysdyn.adapter.ConfigurationVariable;\r
-import org.simantics.sysdyn.adapter.HistoryVariable;\r
 import org.simantics.sysdyn.adapter.RunVariable;\r
 import org.simantics.utils.datastructures.hints.IHintContext.Key;\r
 \r
@@ -124,30 +125,39 @@ public class InputFactory extends SysdynElementFactory {
             }\r
         } else {\r
             Resource runtime = diagram.getHint((DiagramModelHints.KEY_DIAGRAM_RUNTIME_RESOURCE));\r
+            for(Resource r : graph.getPredicates(runtime)) {\r
+               System.out.println(NameUtils.getSafeName(graph, r) + " " + graph.getPossibleRelatedValue(runtime, r));\r
+            }\r
             DiagramResource dr = DiagramResource.getInstance(graph);\r
             String variable = (String)graph.getPossibleRelatedValue(runtime, dr.HasVariable);\r
             if(variable == null)\r
                return;\r
-            Variable v = Variables.getVariable(graph, variable);\r
-            module = graph.getResource(v.getURI(graph));\r
-            if(module != null)\r
-                for(Resource dep : graph.getObjects(module, sr.IsHeadOf)) {\r
-                    Resource reference = graph.getPossibleObject(dep, sr.RefersTo);\r
-                    if(reference!= null && reference.equals(component)) {\r
-                        refersTo = graph.getSingleObject(dep, sr.HasTail);\r
-                        referenceName = (String) graph.getPossibleRelatedValue(refersTo, l0.HasName);\r
-                        Variable parent = null;\r
-                        if(v instanceof HistoryVariable)\r
-                               parent = ((HistoryVariable)v).getParent(graph);\r
-                        else if(v instanceof ChildVariable)\r
-                               parent = ((ChildVariable)v).getParent(graph);\r
-                        if(parent != null && !(parent instanceof RunVariable) && !(parent instanceof ConfigurationVariable)) {\r
-                               String parentURI = parent.getURI(graph);\r
-                               moduleName = (String) graph.getPossibleRelatedValue(graph.getResource(parentURI), l0.HasName);\r
-                        }\r
-                        break;\r
-                    }\r
-                }\r
+            \r
+            \r
+            try {\r
+               Variable v = Variables.getVariable(graph, variable);\r
+               if(v instanceof ChildVariable) {\r
+                       module = ((ChildVariable)v).getRepresents(graph);\r
+               }\r
+               if(module != null)\r
+                       for(Resource dep : graph.getObjects(module, sr.IsHeadOf)) {\r
+                               Resource reference = graph.getPossibleObject(dep, sr.RefersTo);\r
+                               if(reference!= null && reference.equals(component)) {\r
+                                       refersTo = graph.getSingleObject(dep, sr.HasTail);\r
+                                       referenceName = (String) graph.getPossibleRelatedValue(refersTo, l0.HasName);\r
+                                       Variable parent = null;\r
+                                       if(v instanceof ChildVariable)\r
+                                               parent = ((ChildVariable)v).getParent(graph);\r
+                                       if(parent != null && !(parent instanceof RunVariable) && !(parent instanceof ConfigurationVariable)) {\r
+                                               String parentURI = parent.getURI(graph);\r
+                                               moduleName = (String) graph.getPossibleRelatedValue(graph.getResource(parentURI), l0.HasName);\r
+                                       }\r
+                                       break;\r
+                               }\r
+                       }\r
+            } catch (MissingVariableException mve) {\r
+               // DO nothing.\r
+            }\r
         }\r
 \r
         String inputReference = null;\r
index 89e485e049b3e7da607ab04825465101c4a19b4a..67732e3ac74ae7a857ace47e601c6b38834958af 100644 (file)
@@ -30,8 +30,6 @@ import org.simantics.modeling.ComponentUtils;
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.structural.stubs.StructuralResource2;\r
 import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.adapter.ChildVariable;\r
-import org.simantics.sysdyn.adapter.HistoryVariable;\r
 import org.simantics.sysdyn.ui.editor.DiagramViewer;\r
 import org.simantics.ui.SimanticsUI;\r
 import org.simantics.ui.utils.ResourceAdaptionUtils;\r
@@ -74,13 +72,7 @@ public class ShowModuleHandler extends AbstractHandler {
                                        final Resource diagram = ComponentUtils.getPossibleCompositeDiagram(graph, configuration);\r
 \r
                                        Variable variable = parent.browsePossible(graph, component);\r
-                                       String rvi = "";\r
-                                       if(variable instanceof HistoryVariable)\r
-                                               rvi = "/" + ((HistoryVariable)variable).getRvi(graph);\r
-                                       else if (variable instanceof ChildVariable)\r
-                                               rvi = "/" + ((ChildVariable)variable).getRvi(graph);\r
-                                       \r
-                                       final String finalRvi = rvi;\r
+                                       final String finalRvi = Variables.getRVI(graph, variable);\r
                                        \r
                                        PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {\r
 \r
index 91afda93ad97500824f7ce2848d7089a9a6b87dc..2f715045628c2f87873c67d4fb987068d145fc4c 100644 (file)
@@ -28,6 +28,10 @@ public class ReplaceableEnumerations  extends ViewpointContributorImpl<Resource>
        @Override\r
        public Collection<?> getContribution(ReadGraph graph, Resource input)\r
                        throws DatabaseException {\r
+        ArrayList<RedeclarationNode> result = new ArrayList<RedeclarationNode>();\r
+        if(input == null)\r
+               return result;\r
+        \r
         SysdynResource sr = SysdynResource.getInstance(graph);\r
         Layer0 l0 = Layer0.getInstance(graph);\r
         StructuralResource2 sr2 = StructuralResource2.getInstance(graph);\r
@@ -35,8 +39,6 @@ public class ReplaceableEnumerations  extends ViewpointContributorImpl<Resource>
         Resource moduleType = graph.getSingleObject(input, l0.InstanceOf);\r
         Resource configuration = graph.getSingleObject(moduleType, sr2.IsDefinedBy);\r
         \r
-        ArrayList<RedeclarationNode> result = new ArrayList<RedeclarationNode>();\r
-        \r
                for(Resource r : graph.syncRequest(new ObjectsWithType(configuration, l0.ConsistsOf, sr.Enumeration))) {\r
                        if(Boolean.TRUE.equals(graph.getRelatedValue(r, sr.IsReplaceable)))\r
                                result.add(new RedeclarationNode(graph, input, r));\r
index 57043d2e0aab37c54d409a5cb2a1b1fd48da43ce..a26c312188ad78614dd706b84fb79a57da5b60cd 100644 (file)
@@ -39,8 +39,6 @@ import org.simantics.layer0.Layer0;
 import org.simantics.modeling.ModelingUtils;\r
 import org.simantics.simulation.ontology.SimulationResource;\r
 import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.sysdyn.adapter.ChildVariable;\r
-import org.simantics.sysdyn.adapter.HistoryVariable;\r
 import org.simantics.sysdyn.manager.SysdynDataSet;\r
 import org.simantics.sysdyn.manager.SysdynModel;\r
 import org.simantics.sysdyn.manager.SysdynModelManager;\r
@@ -104,6 +102,7 @@ public abstract class SysdynDatasetSelectionListener implements ISelectionListen
                HashSet<SysdynModel> models = new HashSet<SysdynModel>(); \r
                for(Variable variable : variables) {\r
                        Resource model = Variables.getModel(graph, variable);\r
+                       System.out.println("MODEL: " + model);\r
                        if(model != null) {\r
                                models.add(getSysdynModel(graph, model));\r
                        }\r
@@ -149,18 +148,7 @@ public abstract class SysdynDatasetSelectionListener implements ISelectionListen
                ArrayList<SysdynDataSet> dataSets = new ArrayList<SysdynDataSet>();\r
                HashMap<String, String> rvis = new HashMap<String, String>();\r
 \r
-               String rvi;\r
-               if(variable instanceof ChildVariable) {\r
-                       ChildVariable var = (ChildVariable)variable;\r
-                       rvi = var.getRvi(g);\r
-               } else if(variable instanceof HistoryVariable) {\r
-                       HistoryVariable var = (HistoryVariable)variable;\r
-                       rvi = var.getRvi(g);\r
-               } else {\r
-                       return dataSets;\r
-               }\r
-               \r
-               rvi = rvi.replace("/", ".");\r
+               String rvi = Variables.getRVI(g, variable).substring(1).replace("/", ".");              \r
 \r
                Resource r = variable.getPropertyValue(g, Variables.REPRESENTS);\r
                \r
@@ -266,8 +254,8 @@ public abstract class SysdynDatasetSelectionListener implements ISelectionListen
                Resource resource = ModelingUtils.getPossibleElementCorrespondendence(g, element);\r
                if(resource == null || !g.isInstanceOf(resource, sr.Variable)) return null;\r
                String variableURI = g.getPossibleRelatedValue(runtime, dr.HasVariable);\r
-               Variable compositeVariable = Variables.getVariable(g, variableURI);\r
                try {\r
+                       Variable compositeVariable = Variables.getVariable(g, variableURI);\r
                        return compositeVariable.browsePossible(g, resource);\r
                } catch (MissingVariableException e) {\r
                        return null;\r
index 033dfce26233d893ce71df83c421c711a41a8bb9..ffd4a0a5af2adcf04ec7f5aa9daa67a9aadb9dd4 100644 (file)
@@ -1,3 +1,14 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
 package org.simantics.sysdyn.adapter;\r
 \r
 import java.util.List;\r
@@ -6,27 +17,25 @@ import org.simantics.databoard.Bindings;
 import org.simantics.databoard.Datatypes;\r
 import org.simantics.databoard.binding.Binding;\r
 import org.simantics.databoard.type.Datatype;\r
+import org.simantics.databoard.util.ObjectUtils;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.common.utils.OrderedSetUtils;\r
 import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.variable.StandardGraphChildVariable;\r
+import org.simantics.db.layer0.variable.AbstractChildVariable;\r
 import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 \r
-public class ChildVariable extends StandardGraphChildVariable {\r
+public class ChildVariable extends AbstractChildVariable {\r
 \r
-       final private Variable parent;\r
+       protected Variable parent;\r
+       protected Resource resource;\r
        \r
        public ChildVariable(Variable parent, Resource resource) {\r
-               super(resource);\r
                this.parent = parent;\r
-       }\r
-\r
-       @Override\r
-       public Variable getParent(ReadGraph graph) throws DatabaseException {\r
-               return parent;\r
+               this.resource = resource;\r
        }\r
         \r
        // FIXME: Support properties! This is just for the system to work like it used to. \r
@@ -71,23 +80,69 @@ public class ChildVariable extends StandardGraphChildVariable {
                return super.getInterface(graph, clazz);\r
        }\r
        \r
-       public String getVariableURI(ReadGraph graph) throws DatabaseException {\r
-               Variable parent = getParent(graph);\r
-               if(parent instanceof ChildVariable) {\r
-                       ChildVariable p = (ChildVariable)parent;\r
-                       return p.getVariableURI(graph) +  "/" + this.getName(graph);\r
-               } else\r
-                       return parent.getURI(graph) +  "/" + this.getName(graph);\r
-       }\r
+       /*\r
+        * \r
+        * \r
+        */\r
        \r
-       public String getRvi(ReadGraph graph) throws DatabaseException {\r
-               Variable parent = getParent(graph);\r
-               if(parent instanceof ChildVariable) {\r
-                       ChildVariable p = (ChildVariable)parent;\r
-                       return p.getRvi(graph) +  "/" + this.getName(graph);\r
-               } else {\r
-                       return this.getName(graph);\r
-               }\r
+       \r
+    @Override\r
+    public Variable getParent(ReadGraph graph) throws DatabaseException {\r
+        if(parent == null)\r
+            return null; // TODO is this correct thing to do?\r
+        else\r
+            return parent; \r
+    }\r
+    \r
+    @Override\r
+    public Resource getRepresents(ReadGraph graph) throws DatabaseException {\r
+       Layer0 L0 = Layer0.getInstance(graph);\r
+       Resource represents = graph.getPossibleObject(resource, L0.Represents);\r
+       if(represents != null) return represents;\r
+       else return resource;\r
+    }\r
+       \r
+       @Override\r
+       public String getName(ReadGraph graph) throws DatabaseException {\r
+               return graph.getRelatedValue(resource, graph.getService(Layer0.class).HasName, Bindings.STRING);\r
        }\r
        \r
+       \r
+    @Override\r
+    public String getSerialized(ReadGraph graph) throws DatabaseException {\r
+        return getURI(graph);\r
+    }\r
+    \r
+    @Override\r
+    public String getURI(ReadGraph graph) throws DatabaseException {\r
+        if(parent == null)\r
+            return getName(graph);\r
+        else\r
+            return parent.getURI(graph) + "/" + encodeString(getName(graph));\r
+    }\r
+       \r
+       \r
+    @Override\r
+    public int hashCode() {\r
+        final int prime = 31;\r
+        int result = 1;\r
+        result = prime * result + resource.hashCode();\r
+        result = prime * result + ObjectUtils.hashCode(parent);\r
+        return result;\r
+    }\r
+\r
+    @Override\r
+    public boolean equals(Object obj) {\r
+        if (this == obj)\r
+            return true;\r
+        if (obj == null)\r
+            return false;\r
+        if (getClass() != obj.getClass())\r
+            return false;\r
+        ChildVariable other = (ChildVariable) obj;\r
+        if (!resource.equals(other.resource))\r
+            return false;\r
+        return ObjectUtils.objectEquals(parent, other.parent);\r
+    }\r
+       \r
 }\r
index d5341d23a9df9c598132095738e8584ab3e7755b..593c3b84c1fd8544b5af20ec1e75ddc78ffc679b 100644 (file)
@@ -1,3 +1,14 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
 package org.simantics.sysdyn.adapter;\r
 \r
 import org.simantics.db.ReadGraph;\r
index 244afb73a32d558cfed8d21fccb121d753467a32..2b08d71e419349edb087167e9932080022d0046d 100644 (file)
@@ -1,3 +1,14 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
 package org.simantics.sysdyn.adapter;\r
 \r
 import java.util.ArrayList;\r
index 58cdfab69c1d691c3a22d98f68ece0f5b6097d95..fdde1806207445e479d0676632609e22e0825545 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
  * Industry THTH ry.\r
  * All rights reserved. This program and the accompanying materials\r
  * are made available under the terms of the Eclipse Public License v1.0\r
@@ -28,7 +28,6 @@ import org.simantics.db.common.uri.UnescapedChildMapOfResource;
 import org.simantics.db.common.utils.NameUtils;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.layer0.exception.MissingVariableException;\r
-import org.simantics.db.layer0.variable.ResourceVariable;\r
 import org.simantics.db.layer0.variable.Variable;\r
 import org.simantics.db.layer0.variable.Variables;\r
 import org.simantics.layer0.Layer0;\r
@@ -40,41 +39,12 @@ import org.simantics.sysdyn.manager.SysdynModel;
 import org.simantics.sysdyn.manager.SysdynModelManager;\r
 import org.simantics.sysdyn.manager.SysdynResult;\r
 \r
-public class HistoryVariable extends ResourceVariable {\r
+public class HistoryVariable extends ChildVariable {\r
 \r
-       final private Variable parent;\r
-       \r
        public HistoryVariable(Variable parent, Resource resource) {\r
-               super(resource);\r
-               this.parent = parent;\r
+               super(parent, resource);\r
        }\r
        \r
-//     @Override\r
-//     public <T> T getInterface(ReadGraph graph, Class<T> clazz) throws DatabaseException {\r
-//             if(Accessor.class.equals(clazz)) {\r
-//\r
-//                     SimulationResource SIMU = SimulationResource.getInstance(graph);\r
-//                     Resource model = Variables.getModel(graph, this);\r
-//                     Resource configuration = graph.getPossibleObject(model, SIMU.HasConfiguration);\r
-//                     SysdynModel sm = SysdynModelManager.getInstance(graph.getSession()).getModel(graph, configuration);\r
-//                     SysdynResult sr = sm.getSysdynResult();\r
-//                     String rvi = Variables.getRVI(graph, this);\r
-//                     System.out.println("HistoryVariable rvi='" + rvi + "'");\r
-//                     rvi = rvi.substring(1).replace("/", ".");\r
-//                     SysdynDataSet ds = sr.getDataSet(rvi);\r
-//                     \r
-//                     try {\r
-//                             return (T)Accessors.getAccessor(Bindings.getBindingUnchecked(SysdynDataSet.class), ds);\r
-//                     } catch (RuntimeBindingConstructionException e) {\r
-//                             e.printStackTrace();\r
-//                     } catch (AccessorConstructionException e) {\r
-//                             e.printStackTrace();\r
-//                     }\r
-//                     return null;\r
-//                     \r
-//             }\r
-//             return super.getInterface(graph, clazz);\r
-//     }\r
        \r
        @SuppressWarnings("unchecked")\r
        @Override\r
@@ -165,26 +135,5 @@ public class HistoryVariable extends ResourceVariable {
                } else {\r
                        return super.browseChildren(graph);\r
                }\r
-       }\r
-       \r
-       \r
-       @Override\r
-       public Variable getParent(ReadGraph graph) throws DatabaseException {\r
-               return parent;\r
-       }\r
-       \r
-       public String getRvi(ReadGraph graph) throws DatabaseException {\r
-               Variable parent = getParent(graph);\r
-               if(parent instanceof HistoryVariable) {\r
-                       HistoryVariable p = (HistoryVariable)parent;\r
-                       return p.getRvi(graph) +  "/" + this.getName(graph);\r
-               } else {\r
-                       return this.getName(graph);\r
-               }\r
-       }\r
-       \r
-       final public String getName(ReadGraph graph) throws DatabaseException {\r
-               return graph.getRelatedValue(resource, graph.getService(Layer0.class).HasName, Bindings.STRING);\r
-       }\r
-       \r
+       }       \r
 }\r
index edcb78dc64e31c7d7962f981b2e80772b621af9f..c5e21968cbd2fc49ec6f59f3bddf43383a005037 100644 (file)
@@ -1,3 +1,14 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
 package org.simantics.sysdyn.adapter;\r
 \r
 import java.util.ArrayList;\r
@@ -32,10 +43,7 @@ public class ModuleVariable extends ChildVariable {
                        throw new MissingVariableException("No configuration for " + NameUtils.getSafeName(graph, instanceOf));\r
                Map<String, Resource> children = graph.syncRequest(new UnescapedChildMapOfResource(configuration));\r
                Resource child = children.get(name);\r
-               if(child == null) {\r
-                       return getPossibleSpecialChild(graph, name);\r
-               }\r
-               else return graph.adaptContextual(child, this, Variable.class, Variable.class);\r
+               return graph.adaptContextual(child, this, Variable.class, Variable.class);\r
        }\r
 \r
 \r
@@ -54,7 +62,7 @@ public class ModuleVariable extends ChildVariable {
                \r
                for(Resource child : graph.syncRequest(new UnescapedChildMapOfResource(configuration)).values())\r
                        result.add(graph.adaptContextual(child, this, Variable.class, Variable.class));\r
-               collectSpecialChildren(graph, result);\r
+               \r
                return result;\r
        }\r
        \r
index aab21ce38e6025f3b32f57386c9242c9df6690c2..c847527bd17614b165e3e24a58c0656be36e497a 100644 (file)
@@ -1,3 +1,14 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
 package org.simantics.sysdyn.adapter;\r
 \r
 import java.util.ArrayList;\r
@@ -6,10 +17,8 @@ import java.util.Map;
 \r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
-import org.simantics.db.common.request.PropertyMapOfResource;\r
 import org.simantics.db.common.uri.UnescapedChildMapOfResource;\r
 import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.variable.GraphPropertyFactory;\r
 import org.simantics.db.layer0.variable.StandardGraphChildVariable;\r
 import org.simantics.db.layer0.variable.Variable;\r
 import org.simantics.layer0.Layer0;\r