package org.simantics.interop.mapping;\r
\r
import org.simantics.db.ReadGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
import org.simantics.interop.mapping.data.GraphNode;\r
import org.simantics.interop.mapping.data.Identifiable;\r
\r
public interface IdentificationRule {\r
\r
- boolean matches(ReadGraph g, GraphNode<Identifiable> node);\r
+ boolean matches(ReadGraph g, GraphNode<Identifiable> node) throws DatabaseException;\r
}\r
import org.simantics.db.common.request.WriteResultRequest;\r
import org.simantics.db.common.utils.NameUtils;\r
import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.exception.ServiceException;\r
import org.simantics.db.layer0.util.SessionGarbageCollection;\r
import org.simantics.db.request.Read;\r
import org.simantics.interop.mapping.data.GraphNode;\r
for (GraphNode<Identifiable> n : nodes) {\r
\r
MapList<Integer,GenerationRule> priRules = n.getHint(MappingHints.KEY_GENERATION_RULES);\r
- List<GenerationRule> rules = priRules.getValues(stage);\r
- for (GenerationRule r : rules) {\r
- r.generate(graph, n);\r
+ if (priRules != null) {\r
+ List<GenerationRule> rules = priRules.getValues(stage);\r
+ for (GenerationRule r : rules) {\r
+ r.generate(graph, n);\r
+ }\r
}\r
\r
monitor.subTask("Generating objects, stage " + stage + " : ("+ (++count) + "/" + size + ")");\r
\r
\r
/**\r
- * Disposes this node. Removes all the links that connect to thi snode.\r
+ * Disposes this node. Removes all the links that connect to this node.\r
*/\r
public void destroy() {\r
if (disposed)\r
} else {\r
for (int i = 0; i < nodes.size() -1 ; i++) {\r
Link<T> link1 = nodes.get(i);\r
- link1.to().removeLink(link1.getInverseName(), link1.getName(), this);\r
- for (int j = i; j < nodes.size(); j++) {\r
+ link1.to()._removeLink(link1.getInverseName(), link1.getName(), this);\r
+ for (int j = i+1; j < nodes.size(); j++) {\r
Link<T> link2 = nodes.get(j);\r
- link2.to().removeLink(link2.getInverseName(), link2.getName(), this);\r
+ link2.to()._removeLink(link2.getInverseName(), link2.getName(), this);\r
if (link1.to().equals(link2.to()))\r
continue;\r
link1.to().addLink(link1.getInverseName(),link2.getInverseName(),link2.to());\r
}\r
\r
/**\r
- * Disposed the node and all nodes that are in the same graph.\r
+ * Dispose the node and all nodes that are in the same graph.\r
*/\r
public void dispose() {\r
if (disposed)\r
return count;\r
}\r
}\r
+ \r
+ public String toString() {\r
+ return "Node : " + data;\r
+ }\r
}\r
super.setHint(key, value);\r
}\r
\r
+ \r
+ public String toString() {\r
+ return name + "/" + getInverseName() + " -> " + to.toString();\r
+ }\r
}\r