From c912edf13bf5a91b2f6dc855f54d8728aa0a64f5 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Mon, 26 Mar 2018 11:29:34 +0300 Subject: [PATCH] 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 --- .../modeling/mapping/ComponentCopyAdvisor.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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; -- 2.43.2