X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.structural2%2Fsrc%2Forg%2Fsimantics%2Fstructural2%2Fvariables%2FFixedConnection.java;h=ecafac42f6eba7e7c4b78b18419753f93ea717ba;hp=7257ca4c5c137a5f8dc88fbc4bf7ca7d0e78c0cc;hb=e807368d0e75809e0797d9cea1063b046fabf352;hpb=9712014e959584157b02e594be8719c151b8f5b0 diff --git a/bundles/org.simantics.structural2/src/org/simantics/structural2/variables/FixedConnection.java b/bundles/org.simantics.structural2/src/org/simantics/structural2/variables/FixedConnection.java index 7257ca4c5..ecafac42f 100644 --- a/bundles/org.simantics.structural2/src/org/simantics/structural2/variables/FixedConnection.java +++ b/bundles/org.simantics.structural2/src/org/simantics/structural2/variables/FixedConnection.java @@ -93,13 +93,14 @@ public class FixedConnection implements Connection, Connection2 { for (Pair cp : cps) { Variable component = cp.first == null ? procedural : procedural.getChild(graph, cp.first); Variable cp2 = component.getPossibleProperty(graph, cp.second); - if (cp2 != null) + if (cp2 != null) { for (VariableConnectionPointDescriptor desc : ConnectionBrowser.flatten(graph, component, cp.second, relationType)) { result.add(desc.getURI(graph)); } - else - LOGGER.warn("no cp " + cp.first + " for " + component.getURI(graph)); + } else { + logWarn(graph, cp, component, procedural); + } } return result; } @@ -107,14 +108,15 @@ public class FixedConnection implements Connection, Connection2 { @Override public Collection getConnectionPointDescriptors(ReadGraph graph, Resource relationType) throws DatabaseException { - Set result = new THashSet(); + Set result = new THashSet<>(); for (Pair cp : cps) { Variable component = cp.first == null ? procedural : procedural.getChild(graph, cp.first); Variable cp2 = component.getPossibleProperty(graph, cp.second); - if (cp2 != null) + if (cp2 != null) { result.addAll(ConnectionBrowser.flatten(graph, component, cp.second, relationType)); - else - LOGGER.warn("no cp " + cp.first + " for " + component.getURI(graph)); + } else { + logWarn(graph, cp, component, procedural); + } } return result; } @@ -153,14 +155,16 @@ public class FixedConnection implements Connection, Connection2 { @Override public Collection getConnectionPointDescriptors(ReadGraph graph, Variable component, Resource relationType) throws DatabaseException { - Set result = new THashSet(); + Set result = new THashSet<>(); + Variable procedural = component.getParent(graph); for (Pair cp : cps) { - Variable base = cp.first == null ? component.getParent(graph) : component; + Variable base = cp.first == null ? procedural : procedural.getChild(graph, cp.first); Variable cp2 = base.getPossibleProperty(graph, cp.second); - if (cp2 != null) + if (cp2 != null) { result.addAll(ConnectionBrowser.flatten(graph, base, cp.second, relationType)); - else - LOGGER.warn("no cp " + cp.first + " for " + base.getURI(graph)); + } else { + logWarn(graph, cp, base, procedural); + } } return result; } @@ -168,17 +172,19 @@ public class FixedConnection implements Connection, Connection2 { @Override public Collection getConnectionPoints(ReadGraph graph, Variable component, Resource relationType) throws DatabaseException { - Set result = new THashSet(); + Set result = new THashSet<>(); + Variable procedural = component.getParent(graph); for (Pair cp : cps) { - Variable base = cp.first == null ? component.getParent(graph) : component; + Variable base = cp.first == null ? procedural : procedural.getChild(graph, cp.first); Variable cp2 = base.getPossibleProperty(graph, cp.second); - if (cp2 != null) + if (cp2 != null) { for (VariableConnectionPointDescriptor desc : ConnectionBrowser.flatten(graph, base, cp.second, relationType)) { result.add(desc.getVariable(graph)); } - else - LOGGER.warn("no cp " + cp.first + " for " + base.getURI(graph)); + } else { + logWarn(graph, cp, base, procedural); + } } return result; } @@ -186,17 +192,19 @@ public class FixedConnection implements Connection, Connection2 { @Override public Collection getConnectionPointURIs(ReadGraph graph, Variable component, Resource relationType) throws DatabaseException { - Set result = new THashSet(); + Set result = new THashSet<>(); + Variable procedural = component.getParent(graph); for (Pair cp : cps) { - Variable base = cp.first == null ? component.getParent(graph) : component; + Variable base = cp.first == null ? procedural : procedural.getChild(graph, cp.first); Variable cp2 = base.getPossibleProperty(graph, cp.second); - if (cp2 != null) + if (cp2 != null) { for (VariableConnectionPointDescriptor desc : ConnectionBrowser.flatten(graph, base, cp.second, relationType)) { result.add(desc.getURI(graph)); } - else - LOGGER.warn("no cp " + cp.first + " for " + base.getURI(graph)); + } else { + logWarn(graph, cp, base, procedural); + } } return result; } @@ -206,4 +214,11 @@ public class FixedConnection implements Connection, Connection2 { return this; } + private static void logWarn(ReadGraph graph, Pair cp, Variable base, Variable procedural) throws DatabaseException { + LOGGER.warn("no cp " + cp.first + " for " + base.getURI(graph)); + LOGGER.warn(" proc: " + procedural.getURI(graph)); + LOGGER.warn(" rel: " + graph.getURI(cp.second)); + LOGGER.warn(" base: " + base.getURI(graph)); + } + } \ No newline at end of file