From: Tuukka Lehtonen Date: Mon, 26 Mar 2018 08:29:34 +0000 (+0300) Subject: Only claim new identifier if instance L0.TypeWithIdentifier X-Git-Tag: v1.43.0~136^2~521 X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=commitdiff_plain;h=0cfc6a9b8b186ba432bc6758c089726b1471fd1f;ds=sidebyside Only claim new identifier if instance L0.TypeWithIdentifier Fixed long-standing bug from CopyComponentAdvisor which added identifiers for non-STR.Component instances which has started causing problems in team server products in version comparisons. refs #7842 Change-Id: Iac3e604993ec579cd8feb443843af944a8fa01f3 (cherry picked from commit c912edf13bf5a91b2f6dc855f54d8728aa0a64f5) --- diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/mapping/ComponentCopyAdvisor.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/mapping/ComponentCopyAdvisor.java index 6b4e59d17..b7ed06795 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/mapping/ComponentCopyAdvisor.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/mapping/ComponentCopyAdvisor.java @@ -11,9 +11,8 @@ *******************************************************************************/ package org.simantics.modeling.mapping; -import gnu.trove.map.hash.THashMap; - import java.util.Map; +import java.util.Set; import org.simantics.Simantics; import org.simantics.databoard.Bindings; @@ -35,6 +34,8 @@ import org.simantics.modeling.services.NamingException; import org.simantics.project.IProject; import org.simantics.structural.stubs.StructuralResource2; +import gnu.trove.map.hash.THashMap; + /** * @author Tuukka Lehtonen */ @@ -59,7 +60,8 @@ public class ComponentCopyAdvisor extends GraphCopyAdvisor { Resource targetContainer, Map map) throws DatabaseException { StructuralResource2 STR = StructuralResource2.getInstance(graph); Resource copy = null; - if (graph.isInstanceOf(source, STR.Connection)) { + Set types = graph.getTypes(source); + if (types.contains(STR.Connection)) { // Configuration connections are not named, can't use TG copy for // them at the moment. copy = CopyAdvisorUtil.copy2(graph, source, null, map); @@ -73,7 +75,8 @@ public class ComponentCopyAdvisor extends GraphCopyAdvisor { if (graph.hasStatement(sourceContainer, L0.ConsistsOf, source)) graph.claim(targetContainer, L0.ConsistsOf, copy); - Layer0Utils.claimNewIdentifier(graph, copy, false); + if (types.contains(L0.TypeWithIdentifier)) + Layer0Utils.claimNewIdentifier(graph, copy, false); if (context.get(SynchronizationHints.NO_RENAME) == null) renameComponent(context, graph, source, copy, sourceContainer, targetContainer); return copy;