diff options
author | Ryan D. Brooks | 2016-09-23 17:19:46 +0000 |
---|---|---|
committer | donald.g.dunne | 2016-09-23 17:19:46 +0000 |
commit | 16546d12591dabb79c131a0856b267e83188e5c2 (patch) | |
tree | 431044204478bbf083898f0103cbd9d4317ff7bf /plugins | |
parent | a29e94e45b59e684737d908d4e286320d42296fa (diff) | |
download | org.eclipse.osee-16546d12591dabb79c131a0856b267e83188e5c2.tar.gz org.eclipse.osee-16546d12591dabb79c131a0856b267e83188e5c2.tar.xz org.eclipse.osee-16546d12591dabb79c131a0856b267e83188e5c2.zip |
refactor: RelationOrderData to use IRelationType
- Use IRelationType and RelationSide directly with RelationOrderData
- rather than their String representations. A step closer to no using
- type names for long term storage in the datastore. A futher commit
- could convert the underlying storage to use ids only in the order
- data.
Change-Id: I9f45c4c48768760278bd4de2a9a947b02aaf4614
Diffstat (limited to 'plugins')
13 files changed, 140 insertions, 167 deletions
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/ArtifactPasteOperationTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/ArtifactPasteOperationTest.java index 0cff7cd45a4..91131c5975e 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/ArtifactPasteOperationTest.java +++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/ArtifactPasteOperationTest.java @@ -19,6 +19,7 @@ import java.util.List; import java.util.Map.Entry; import org.eclipse.osee.client.test.framework.OseeClientIntegrationRule; import org.eclipse.osee.client.test.framework.OseeLogMonitorRule; +import org.eclipse.osee.framework.core.data.IRelationType; import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; import org.eclipse.osee.framework.core.enums.CoreRelationTypes; import org.eclipse.osee.framework.core.enums.RelationSide; @@ -178,14 +179,14 @@ public class ArtifactPasteOperationTest { List<Artifact> childArtifacts = artifactToCheck.getChildren(); Assert.assertEquals(hasChildren, !childArtifacts.isEmpty()); - for (Entry<Pair<String, String>, Pair<RelationSorter, List<String>>> entry : data.entrySet()) { - String relationType = entry.getKey().getFirst(); - String relationSide = entry.getKey().getSecond(); + for (Entry<Pair<IRelationType, RelationSide>, Pair<RelationSorter, List<String>>> entry : data.entrySet()) { + IRelationType relationTypeId = entry.getKey().getFirst(); + RelationSide relationSide = entry.getKey().getSecond(); RelationSorter orderGuid = entry.getValue().getFirst(); List<String> guids = entry.getValue().getSecond(); - Assert.assertEquals(CoreRelationTypes.Default_Hierarchical__Child.getName(), relationType); - Assert.assertEquals(RelationSide.SIDE_B.name(), relationSide); + Assert.assertEquals(CoreRelationTypes.Default_Hierarchical__Child, relationTypeId); + Assert.assertEquals(RelationSide.SIDE_B, relationSide); Assert.assertEquals(expectedOrderType, orderGuid); if (hasChildren && expectedOrderType == USER_DEFINED) { Assert.assertEquals(childArtifacts.size(), guids.size()); diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/RelationType.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/RelationType.java index 9014735b0ef..3d25a900e8a 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/RelationType.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/type/RelationType.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.osee.framework.core.model.type; +import static org.eclipse.osee.framework.core.enums.RelationSorter.UNORDERED; import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.data.IRelationType; import org.eclipse.osee.framework.core.enums.RelationSide; @@ -110,7 +111,7 @@ public final class RelationType extends AbstractOseeIdType implements IRelationT } public boolean isOrdered() { - return !RelationSorter.UNORDERED.equals(getDefaultOrderTypeGuid()); + return !UNORDERED.equals(getDefaultOrderTypeGuid()); } public RelationSorter getDefaultOrderTypeGuid() { diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/AbstractSaxHandler.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/AbstractSaxHandler.java index cc50884b7c6..2a8bb71defa 100644 --- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/AbstractSaxHandler.java +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/io/xml/AbstractSaxHandler.java @@ -19,14 +19,14 @@ import org.xml.sax.helpers.DefaultHandler; /** * <p> * If you want to preserve CDATA sections you need to follow this pattern:<br/> - * + * * <pre> * XMLReader xmlReader = XMLReaderFactory.createXMLReader(); * xmlReader.setContentHandler(this); * xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", this); //This is the important part * </pre> * </p> - * + * * @author Ryan D. Brooks */ public abstract class AbstractSaxHandler extends DefaultHandler implements LexicalHandler { diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeSideSorterTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeSideSorterTest.java index cf842a849d0..45174a9551a 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeSideSorterTest.java +++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeSideSorterTest.java @@ -243,7 +243,7 @@ public class RelationTypeSideSorterTest { private static void checkData(RelationOrderData orderData, List<Object[]> expectedValues) { int index = 0; Assert.assertEquals(expectedValues.size(), orderData.size()); - for (Entry<Pair<String, String>, Pair<RelationSorter, List<String>>> entry : orderData.getOrderedEntrySet()) { + for (Entry<Pair<IRelationType, RelationSide>, Pair<RelationSorter, List<String>>> entry : orderData.getOrderedEntrySet()) { Object[] actual = new Object[] { entry.getKey().getFirst(), entry.getKey().getSecond(), @@ -251,19 +251,16 @@ public class RelationTypeSideSorterTest { entry.getValue().getSecond()}; Object[] expected = expectedValues.get(index++); Assert.assertEquals(expected.length, actual.length); - for (int index2 = 0; index2 < expected.length; index2++) { - Assert.assertEquals(expected[index2], actual[index2]); + for (int i = 0; i < expected.length; i++) { + Assert.assertEquals(expected[i], actual[i]); } } } private static void addData(RelationOrderData orderData, List<Object[]> expectedData, RelationType relationType, RelationSide side, RelationSorter sorterId, String... guids) { - List<String> artGuids = new ArrayList<>(); - if (guids != null && guids.length > 0) { - artGuids.addAll(Arrays.asList(guids)); - } - orderData.addOrderList(relationType.getName(), side.name(), sorterId, artGuids); - expectedData.add(new Object[] {relationType.getName(), side.name(), sorterId, artGuids}); + List<String> artGuids = Arrays.asList(guids); + orderData.addOrderList(relationType, side, sorterId, artGuids); + expectedData.add(new Object[] {relationType, side, sorterId, artGuids}); } private static final class MockArtifactWithRelations extends MockIArtifact { diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderDataTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderDataTest.java index d7c8c2a4a5b..e2c772f2fb9 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderDataTest.java +++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderDataTest.java @@ -10,6 +10,9 @@ *******************************************************************************/ package org.eclipse.osee.framework.skynet.core.relation.order; +import static org.eclipse.osee.framework.core.enums.CoreArtifactTypes.Artifact; +import static org.eclipse.osee.framework.core.enums.RelationSide.SIDE_A; +import static org.eclipse.osee.framework.core.enums.RelationSide.SIDE_B; import static org.eclipse.osee.framework.core.enums.RelationSorter.LEXICOGRAPHICAL_ASC; import static org.eclipse.osee.framework.core.enums.RelationSorter.UNORDERED; import static org.eclipse.osee.framework.core.enums.RelationSorter.USER_DEFINED; @@ -18,7 +21,7 @@ import java.util.Arrays; import java.util.List; import java.util.Map.Entry; import java.util.Random; -import org.eclipse.osee.framework.core.data.IArtifactType; +import org.eclipse.osee.framework.core.data.IRelationType; import org.eclipse.osee.framework.core.enums.BranchState; import org.eclipse.osee.framework.core.enums.BranchType; import org.eclipse.osee.framework.core.enums.RelationSide; @@ -27,9 +30,7 @@ import org.eclipse.osee.framework.core.enums.RelationTypeMultiplicity; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.model.cache.RelationTypeCache; import org.eclipse.osee.framework.core.model.event.DefaultBasicUuidRelationReorder; -import org.eclipse.osee.framework.core.model.type.ArtifactType; import org.eclipse.osee.framework.core.model.type.RelationType; -import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.Pair; import org.eclipse.osee.framework.jdk.core.util.Collections; @@ -63,9 +64,9 @@ public class RelationOrderDataTest { RelationTypeCache cache = new RelationTypeCache(); - relationType1 = createRelationType(cache, "Rel 1", USER_DEFINED); - relationType2 = createRelationType(cache, "Rel 2", UNORDERED); - relationType3 = createRelationType(cache, "Rel 3", LEXICOGRAPHICAL_ASC); + relationType1 = createRelationType(1, cache, "Rel 1", USER_DEFINED); + relationType2 = createRelationType(2, cache, "Rel 2", UNORDERED); + relationType3 = createRelationType(3, cache, "Rel 3", LEXICOGRAPHICAL_ASC); Assert.assertFalse(data.hasEntries()); Assert.assertEquals(0, data.size()); @@ -117,19 +118,6 @@ public class RelationOrderDataTest { public void testGetCurrentSorterGuid() throws OseeCoreException { List<Object[]> expected = new ArrayList<>(); addData(expected); - try { - data.getCurrentSorterGuid(relationType1, null); - Assert.assertNull("This line should not be executed"); - } catch (Exception ex) { - Assert.assertTrue(ex instanceof OseeArgumentException); - } - - try { - data.getCurrentSorterGuid(null, RelationSide.SIDE_A); - Assert.assertNull("This line should not be executed"); - } catch (Exception ex) { - Assert.assertTrue(ex instanceof OseeArgumentException); - } RelationSorter actualGuid = data.getCurrentSorterGuid(relationType1, RelationSide.SIDE_A); Assert.assertEquals(LEXICOGRAPHICAL_ASC, actualGuid); @@ -151,20 +139,6 @@ public class RelationOrderDataTest { List<Object[]> expected = new ArrayList<>(); addData(expected); - try { - data.getOrderList(relationType1, null); - Assert.assertNull("This line should not be executed"); - } catch (Exception ex) { - Assert.assertTrue(ex instanceof OseeArgumentException); - } - - try { - data.getOrderList(null, RelationSide.SIDE_A); - Assert.assertNull("This line should not be executed"); - } catch (Exception ex) { - Assert.assertTrue(ex instanceof OseeArgumentException); - } - List<String> actualGuids = data.getOrderList(relationType1, RelationSide.SIDE_A); Assert.assertTrue(Collections.isEqual(Arrays.asList("1", "2", "3"), actualGuids)); @@ -233,15 +207,15 @@ public class RelationOrderDataTest { } private void addData(List<Object[]> expected) { - addData(data, expected, relationType1, RelationSide.SIDE_A, RelationSorter.LEXICOGRAPHICAL_ASC, "1", "2", "3"); - addData(data, expected, relationType2, RelationSide.SIDE_B, RelationSorter.UNORDERED, "4", "5", "6"); + addData(data, expected, relationType1, SIDE_A, LEXICOGRAPHICAL_ASC, "1", "2", "3"); + addData(data, expected, relationType2, SIDE_B, UNORDERED, "4", "5", "6"); checkData(data, expected); } private void checkData(RelationOrderData orderData, List<Object[]> expectedValues) { int index = 0; Assert.assertEquals(expectedValues.size(), orderData.size()); - for (Entry<Pair<String, String>, Pair<RelationSorter, List<String>>> entry : orderData.getOrderedEntrySet()) { + for (Entry<Pair<IRelationType, RelationSide>, Pair<RelationSorter, List<String>>> entry : orderData.getOrderedEntrySet()) { Object[] actual = new Object[] { entry.getKey().getFirst(), entry.getKey().getSecond(), @@ -249,16 +223,16 @@ public class RelationOrderDataTest { entry.getValue().getSecond()}; Object[] expected = expectedValues.get(index++); Assert.assertEquals(expected.length, actual.length); - for (int index2 = 0; index2 < expected.length; index2++) { - Assert.assertEquals(expected[index2], actual[index2]); + for (int i = 0; i < expected.length; i++) { + Assert.assertEquals(expected[i], actual[i]); } } } - private void addData(RelationOrderData orderData, List<Object[]> expectedData, RelationType relationType, RelationSide side, RelationSorter relationOrderIdGuid, String... guids) { + private void addData(RelationOrderData orderData, List<Object[]> expectedData, RelationType relationType, RelationSide side, RelationSorter sorterId, String... guids) { List<String> artGuids = Arrays.asList(guids); - orderData.addOrderList(relationType.getName(), side.name(), relationOrderIdGuid, artGuids); - expectedData.add(new Object[] {relationType.getName(), side.name(), relationOrderIdGuid, artGuids}); + orderData.addOrderList(relationType, side, sorterId, artGuids); + expectedData.add(new Object[] {relationType, side, sorterId, artGuids}); } private static IArtifact createArtifact(String name, String guid) { @@ -268,12 +242,9 @@ public class RelationOrderDataTest { return DataFactory.createArtifact(uniqueId, name, guid, branch); } - private static RelationType createRelationType(RelationTypeCache cache, String name, RelationSorter delationRelationOrderGuid) throws OseeCoreException { - IArtifactType type1 = new ArtifactType(0x01L, "1", false); - IArtifactType type2 = new ArtifactType(0x02L, "2", false); - RelationType relationType = new RelationType(0x03L, name, name + "_A", name + "_B", type1, type2, + private static RelationType createRelationType(long id, RelationTypeCache cache, String name, RelationSorter delationRelationOrderGuid) throws OseeCoreException { + RelationType relationType = new RelationType(id, name, name + "_A", name + "_B", Artifact, Artifact, RelationTypeMultiplicity.MANY_TO_MANY, delationRelationOrderGuid); - Assert.assertNotNull(relationType); cache.cache(relationType); return relationType; } diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderParserTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderParserTest.java index 43b59ed3419..46bb72bd450 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderParserTest.java +++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderParserTest.java @@ -10,17 +10,28 @@ *******************************************************************************/ package org.eclipse.osee.framework.skynet.core.relation.order; +import static org.eclipse.osee.framework.core.enums.CoreArtifactTypes.Artifact; +import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.DEFAULT_HIERARCHY; +import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.SupportingInfo_SupportedBy; +import static org.eclipse.osee.framework.core.enums.RelationSorter.LEXICOGRAPHICAL_ASC; +import static org.eclipse.osee.framework.core.enums.RelationSorter.UNORDERED; import static org.eclipse.osee.framework.core.enums.RelationSorter.USER_DEFINED; +import static org.eclipse.osee.framework.core.enums.RelationTypeMultiplicity.MANY_TO_MANY; +import static org.eclipse.osee.framework.core.enums.RelationTypeMultiplicity.ONE_TO_MANY; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map.Entry; +import org.eclipse.osee.framework.core.data.IRelationType; import org.eclipse.osee.framework.core.enums.RelationSide; import org.eclipse.osee.framework.core.enums.RelationSorter; +import org.eclipse.osee.framework.core.model.type.RelationType; import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.Pair; +import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager; import org.junit.Assert; +import org.junit.BeforeClass; import org.junit.Test; /** @@ -34,15 +45,27 @@ public class RelationOrderParserTest { "<OrderList>\n<Order relType=\"Default Hierarchical\" side=\"SIDE_B\" orderType=\"AAT0xogoMjMBhARkBZQA\" list=\"AAABDEJ_mIQBf8VXVtGqvA\"/>\n</OrderList>"; private static String twoEntries = - "<OrderList>\n<Order relType=\"Default Hierarchical\" side=\"SIDE_B\" orderType=\"AAT0xogoMjMBhARkBZQA\" list=\"AAABDEJ_mIQBf8VXVtGqvA,AAABDEJ_oQ8Bf8VXLX7U_g\"/>\n" + "<Order relType=\"Some Type\" side=\"SIDE_A\" orderType=\"AAT0xogoMjMBhARkBZQA\" list=\"AAABDEJ_mIQXf8VXVtGqvA,AAABDEJ_oQVBf8VXLX7U_g\"/>\n</OrderList>"; + "<OrderList>\n<Order relType=\"Default Hierarchical\" side=\"SIDE_B\" orderType=\"AAT0xogoMjMBhARkBZQA\" list=\"AAABDEJ_mIQBf8VXVtGqvA,AAABDEJ_oQ8Bf8VXLX7U_g\"/>\n" + "<Order relType=\"Supporting Info\" side=\"SIDE_A\" orderType=\"AAT0xogoMjMBhARkBZQA\" list=\"AAABDEJ_mIQXf8VXVtGqvA,AAABDEJ_oQVBf8VXLX7U_g\"/>\n</OrderList>"; private static String oneEntryEmptyList = - "<OrderList>\n<Order relType=\"X\" side=\"SIDE_B\" orderType=\"AAT0xogoMjMBhARkBZQA\"/>\n</OrderList>"; + "<OrderList>\n<Order relType=\"Default Hierarchical\" side=\"SIDE_B\" orderType=\"AAT0xogoMjMBhARkBZQA\"/>\n</OrderList>"; private static String emptyType = "<OrderList>\n<Order side=\"SIDE_B\" orderType=\"AAT0xogoMjMBhARkBZQA\"/>\n</OrderList>"; private static String emptySide = - "<OrderList>\n<Order relType=\"X\" orderType=\"AAT0xogoMjMBhARkBZQA\"/>\n</OrderList>"; - private static String emptyOrderType = "<OrderList>\n<Order relType=\"X\" side=\"SIDE_B\" />\n</OrderList>"; + "<OrderList>\n<Order relType=\"Default Hierarchical\" orderType=\"AAT0xogoMjMBhARkBZQA\"/>\n</OrderList>"; + private static String emptyOrderType = + "<OrderList>\n<Order relType=\"Default Hierarchical\" side=\"SIDE_B\" />\n</OrderList>"; + + @BeforeClass + public static void setup() { + RelationType dh = new RelationType(DEFAULT_HIERARCHY.getId(), DEFAULT_HIERARCHY.getName(), "parent", "child", + Artifact, Artifact, ONE_TO_MANY, LEXICOGRAPHICAL_ASC); + RelationType supportingInfo = + new RelationType(SupportingInfo_SupportedBy.getId(), SupportingInfo_SupportedBy.getName(), "is supported by", + "supporting info", Artifact, Artifact, MANY_TO_MANY, UNORDERED); + RelationTypeManager.getCache().cache(dh); + RelationTypeManager.getCache().cache(supportingInfo); + } @Test public void testExceptions() { @@ -74,7 +97,7 @@ public class RelationOrderParserTest { Assert.assertEquals(1, data.size()); List<Object[]> expectedData = new ArrayList<>(); - addData(expectedData, "Default Hierarchical", RelationSide.SIDE_B, USER_DEFINED, "AAABDEJ_mIQBf8VXVtGqvA", + addData(expectedData, DEFAULT_HIERARCHY, RelationSide.SIDE_B, USER_DEFINED, "AAABDEJ_mIQBf8VXVtGqvA", "AAABDEJ_nMkBf8VXVXptpg", "AAABDEJ_oQ8Bf8VXLX7U_g"); checkData(data, expectedData); @@ -104,9 +127,9 @@ public class RelationOrderParserTest { Assert.assertEquals(2, data.size()); List<Object[]> expectedData = new ArrayList<>(); - addData(expectedData, "Default Hierarchical", RelationSide.SIDE_B, USER_DEFINED, "AAABDEJ_mIQBf8VXVtGqvA", + addData(expectedData, DEFAULT_HIERARCHY, RelationSide.SIDE_B, USER_DEFINED, "AAABDEJ_mIQBf8VXVtGqvA", "AAABDEJ_oQ8Bf8VXLX7U_g"); - addData(expectedData, "Some Type", RelationSide.SIDE_A, USER_DEFINED, "AAABDEJ_mIQXf8VXVtGqvA", + addData(expectedData, SupportingInfo_SupportedBy, RelationSide.SIDE_A, USER_DEFINED, "AAABDEJ_mIQXf8VXVtGqvA", "AAABDEJ_oQVBf8VXLX7U_g"); checkData(data, expectedData); @@ -125,7 +148,7 @@ public class RelationOrderParserTest { Assert.assertEquals(1, data.size()); List<Object[]> expectedData = new ArrayList<>(); - addData(expectedData, "X", RelationSide.SIDE_B, USER_DEFINED); + addData(expectedData, DEFAULT_HIERARCHY, RelationSide.SIDE_B, USER_DEFINED); checkData(data, expectedData); Assert.assertEquals(oneEntryEmptyList, parser.toXml(data)); } @@ -177,14 +200,14 @@ public class RelationOrderParserTest { Assert.assertEquals("<OrderList>\n</OrderList>", parser.toXml(data)); } - private void addData(List<Object[]> expectedData, String relationType, RelationSide side, RelationSorter relationOrderIdGuid, String... guids) { - expectedData.add(new Object[] {relationType, side.name(), relationOrderIdGuid, Arrays.asList(guids)}); + private void addData(List<Object[]> expectedData, IRelationType relationType, RelationSide side, RelationSorter relationOrderIdGuid, String... guids) { + expectedData.add(new Object[] {relationType, side, relationOrderIdGuid, Arrays.asList(guids)}); } private void checkData(RelationOrderData orderData, List<Object[]> expectedValues) { int index = 0; Assert.assertEquals(expectedValues.size(), orderData.size()); - for (Entry<Pair<String, String>, Pair<RelationSorter, List<String>>> entry : orderData.getOrderedEntrySet()) { + for (Entry<Pair<IRelationType, RelationSide>, Pair<RelationSorter, List<String>>> entry : orderData.getOrderedEntrySet()) { Object[] actual = new Object[] { entry.getKey().getFirst(), entry.getKey().getSecond(), diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeManager.java index 6ae117c0b5d..0f318387312 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationTypeManager.java @@ -13,8 +13,8 @@ package org.eclipse.osee.framework.skynet.core.relation; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.data.BranchId; +import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.data.IRelationType; import org.eclipse.osee.framework.core.enums.RelationSide; import org.eclipse.osee.framework.core.exception.OseeTypeDoesNotExist; @@ -39,10 +39,6 @@ public class RelationTypeManager { return getCacheService().getRelationTypeCache(); } - public static AbstractOseeCache<ArtifactType> getArtifactTypeCache() throws OseeCoreException { - return getCacheService().getArtifactTypeCache(); - } - public static List<RelationType> getValidTypes(IArtifactType artifactType, BranchId branch) throws OseeCoreException { Collection<RelationType> relationTypes = getAllTypes(); List<RelationType> validRelationTypes = new ArrayList<>(); @@ -60,7 +56,7 @@ public class RelationTypeManager { public static int getRelationSideMax(RelationType relationType, IArtifactType artifactType, RelationSide relationSide) throws OseeCoreException { int toReturn = 0; - ArtifactType type = getArtifactTypeCache().get(artifactType); + ArtifactType type = getCacheService().getArtifactTypeCache().get(artifactType); if (relationType.isArtifactTypeAllowed(relationSide, type)) { toReturn = relationType.getMultiplicity().getLimit(relationSide); } @@ -94,6 +90,9 @@ public class RelationTypeManager { } public static RelationType getType(IRelationType relationType) throws OseeCoreException { + if (relationType instanceof RelationType) { + return (RelationType) relationType; + } return getCache().get(relationType); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderData.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderData.java index 3f73d7c8121..5a658955c84 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderData.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderData.java @@ -38,7 +38,7 @@ import org.eclipse.osee.framework.skynet.core.utility.Artifacts; */ public class RelationOrderData { - private final CompositeKeyHashMap<String, String, Pair<RelationSorter, List<String>>> lists; + private final CompositeKeyHashMap<IRelationType, RelationSide, Pair<RelationSorter, List<String>>> lists; private final IRelationOrderAccessor accessor; private final IArtifact artifact; @@ -61,12 +61,13 @@ public class RelationOrderData { accessor.load(getIArtifact(), this); } - public Collection<Entry<Pair<String, String>, Pair<RelationSorter, List<String>>>> entrySet() { + public Collection<Entry<Pair<IRelationType, RelationSide>, Pair<RelationSorter, List<String>>>> entrySet() { return lists.entrySet(); } - public Collection<Entry<Pair<String, String>, Pair<RelationSorter, List<String>>>> getOrderedEntrySet() { - List<Entry<Pair<String, String>, Pair<RelationSorter, List<String>>>> entries = new ArrayList<>(entrySet()); + public Collection<Entry<Pair<IRelationType, RelationSide>, Pair<RelationSorter, List<String>>>> getOrderedEntrySet() { + List<Entry<Pair<IRelationType, RelationSide>, Pair<RelationSorter, List<String>>>> entries = + new ArrayList<>(entrySet()); Collections.sort(entries, new EntryComparator()); return entries; } @@ -82,23 +83,17 @@ public class RelationOrderData { } private Pair<RelationSorter, List<String>> getTypeSideEntry(IRelationType type, RelationSide side) throws OseeCoreException { - Conditions.checkNotNull(type, "relationType"); - Conditions.checkNotNull(side, "relationSide"); - return lists.get(type.getName(), side.name()); - } - - public void addOrderList(IRelationType type, RelationSide side, RelationSorter sorterId, List<String> guidList) { - addOrderList(type.getName(), side.name(), sorterId, guidList); + return lists.get(type, side); } - public void addOrderList(String relationType, String relationSide, RelationSorter sorterId, List<String> guidList) { + public void addOrderList(IRelationType relationType, RelationSide relationSide, RelationSorter sorterId, List<String> guidList) { lists.put(relationType, relationSide, new Pair<RelationSorter, List<String>>(sorterId, guidList)); } public void removeOrderList(IRelationType type, RelationSide side) throws OseeCoreException { Conditions.checkNotNull(type, "relationType"); Conditions.checkNotNull(side, "relationSide"); - lists.removeAndGet(type.getName(), side.name()); + lists.removeAndGet(type, side); } public boolean hasEntries() { @@ -154,15 +149,15 @@ public class RelationOrderData { return String.format("Relation Order Data for artifact:%s", getIArtifact()); } - public List<Pair<String, String>> getAvailableTypeSides() { + public List<Pair<IRelationType, RelationSide>> getAvailableTypeSides() { return lists.getEnumeratedKeys(); } - private final static class EntryComparator implements Serializable, Comparator<Entry<Pair<String, String>, Pair<RelationSorter, List<String>>>> { + private final static class EntryComparator implements Serializable, Comparator<Entry<Pair<IRelationType, RelationSide>, Pair<RelationSorter, List<String>>>> { private static final long serialVersionUID = 5242452476694174988L; @Override - public int compare(Entry<Pair<String, String>, Pair<RelationSorter, List<String>>> o1, Entry<Pair<String, String>, Pair<RelationSorter, List<String>>> o2) { + public int compare(Entry<Pair<IRelationType, RelationSide>, Pair<RelationSorter, List<String>>> o1, Entry<Pair<IRelationType, RelationSide>, Pair<RelationSorter, List<String>>> o2) { int result = o1.getKey().getFirst().compareTo(o2.getKey().getFirst()); if (result == 0) { result = o1.getKey().getSecond().compareTo(o2.getKey().getSecond()); @@ -188,4 +183,4 @@ public class RelationOrderData { return result; } } -} +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderMergeUtility.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderMergeUtility.java index f5607bfd2e4..b888ce8b9d0 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderMergeUtility.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderMergeUtility.java @@ -15,7 +15,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.List; -import org.eclipse.osee.framework.core.data.RelationTypeSide; +import org.eclipse.osee.framework.core.data.IRelationType; import org.eclipse.osee.framework.core.data.RelationTypeSide; import org.eclipse.osee.framework.core.enums.DeletionFlag; import org.eclipse.osee.framework.core.enums.RelationSide; @@ -36,9 +36,9 @@ public class RelationOrderMergeUtility { RelationOrderData mergedData = new RelationOrderData(new ArtifactRelationOrderAccessor(new RelationOrderParser()), right); - for (Pair<String, String> typeSide : getAllTypeSides(leftData, rightData)) { + for (Pair<IRelationType, RelationSide> typeSide : getAllTypeSides(leftData, rightData)) { RelationType type = RelationTypeManager.getType(typeSide.getFirst()); - RelationSide side = RelationSide.fromString(typeSide.getSecond()); + RelationSide side = typeSide.getSecond(); RelationTypeSide rts = new RelationTypeSide(type, side); RelationSorter leftSorter = leftData.getCurrentSorterGuid(type, side); RelationSorter rightSorter = rightData.getCurrentSorterGuid(type, side); @@ -56,8 +56,8 @@ public class RelationOrderMergeUtility { return mergedData; } - private static Collection<Pair<String, String>> getAllTypeSides(RelationOrderData leftData, RelationOrderData rightData) { - Collection<Pair<String, String>> rts = new HashSet<>(); + private static Collection<Pair<IRelationType, RelationSide>> getAllTypeSides(RelationOrderData leftData, RelationOrderData rightData) { + Collection<Pair<IRelationType, RelationSide>> rts = new HashSet<>(); rts.addAll(leftData.getAvailableTypeSides()); rts.addAll(rightData.getAvailableTypeSides()); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderParser.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderParser.java index c813f599a52..e0f02550784 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderParser.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/RelationOrderParser.java @@ -16,11 +16,14 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map.Entry; +import org.eclipse.osee.framework.core.data.IRelationType; +import org.eclipse.osee.framework.core.enums.RelationSide; import org.eclipse.osee.framework.core.enums.RelationSorter; import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.Pair; import org.eclipse.osee.framework.jdk.core.util.io.xml.AbstractSaxHandler; +import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager; import org.xml.sax.Attributes; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -72,7 +75,7 @@ public class RelationOrderParser { StringBuilder sb = new StringBuilder(); openRoot(sb); - for (Entry<Pair<String, String>, Pair<RelationSorter, List<String>>> entry : data.getOrderedEntrySet()) { + for (Entry<Pair<IRelationType, RelationSide>, Pair<RelationSorter, List<String>>> entry : data.getOrderedEntrySet()) { writeEntry(sb, entry); sb.append("\n"); } @@ -92,12 +95,12 @@ public class RelationOrderParser { sb.append(">"); } - private void writeEntry(StringBuilder sb, Entry<Pair<String, String>, Pair<RelationSorter, List<String>>> entry) { - Pair<String, String> key = entry.getKey(); + private void writeEntry(StringBuilder sb, Entry<Pair<IRelationType, RelationSide>, Pair<RelationSorter, List<String>>> entry) { + Pair<IRelationType, RelationSide> key = entry.getKey(); sb.append("<"); sb.append("Order "); sb.append("relType=\""); - sb.append(key.getFirst()); + sb.append(key.getFirst().getName()); sb.append("\" side=\""); sb.append(key.getSecond()); sb.append("\" orderType=\""); @@ -135,18 +138,20 @@ public class RelationOrderParser { @Override public void startElementFound(String uri, String localName, String qName, Attributes attributes) { if ("Order".equals(localName)) { - String relationType = attributes.getValue("relType"); + String relationTypeName = attributes.getValue("relType"); String relationSide = attributes.getValue("side"); String orderType = attributes.getValue("orderType"); String list = attributes.getValue("list"); - if (relationType != null && orderType != null && relationSide != null) { + if (relationTypeName != null && orderType != null && relationSide != null) { List<String> guidsList = Collections.emptyList(); if (list != null) { String[] guids = list.split(","); guidsList = new ArrayList<>(); Collections.addAll(guidsList, guids); } - data.addOrderList(relationType, relationSide, RelationSorter.valueOfGuid(orderType), guidsList); + + data.addOrderList(RelationTypeManager.getType(relationTypeName), RelationSide.valueOf(relationSide), + RelationSorter.valueOfGuid(orderType), guidsList); } } } diff --git a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/renderer/RelationOrderRendererTest.java b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/renderer/RelationOrderRendererTest.java index 7b465319c52..840a611c836 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/renderer/RelationOrderRendererTest.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet.test/src/org/eclipse/osee/framework/ui/skynet/renderer/RelationOrderRendererTest.java @@ -10,6 +10,9 @@ *******************************************************************************/ package org.eclipse.osee.framework.ui.skynet.renderer; +import static org.eclipse.osee.framework.core.enums.CoreArtifactTypes.Artifact; +import static org.eclipse.osee.framework.core.enums.RelationSide.SIDE_A; +import static org.eclipse.osee.framework.core.enums.RelationSide.SIDE_B; import static org.eclipse.osee.framework.core.enums.RelationSorter.LEXICOGRAPHICAL_ASC; import static org.eclipse.osee.framework.core.enums.RelationSorter.UNORDERED; import static org.eclipse.osee.framework.core.enums.RelationSorter.USER_DEFINED; @@ -19,13 +22,12 @@ import java.util.Collection; import java.util.List; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.data.IArtifactType; +import org.eclipse.osee.framework.core.data.IRelationType; import org.eclipse.osee.framework.core.enums.RelationSide; import org.eclipse.osee.framework.core.enums.RelationSorter; import org.eclipse.osee.framework.core.enums.RelationTypeMultiplicity; import org.eclipse.osee.framework.core.model.cache.AbstractOseeCache; -import org.eclipse.osee.framework.core.model.cache.ArtifactTypeCache; import org.eclipse.osee.framework.core.model.cache.RelationTypeCache; -import org.eclipse.osee.framework.core.model.type.ArtifactType; import org.eclipse.osee.framework.core.model.type.RelationType; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.skynet.core.linking.OseeLinkBuilder; @@ -43,54 +45,57 @@ import org.junit.Test; public class RelationOrderRendererTest { private static RelationOrderRenderer renderer; + private static RelationType relType1; + private static RelationType relType2; + private static RelationType relType3; @BeforeClass public static void prepareTest() throws Exception { MockArtifactGuidResolver resolver = new MockArtifactGuidResolver(null); AbstractOseeCache<RelationType> typeCache = new RelationTypeCache(); - addRelationTypeData(typeCache); + relType1 = createRelationType(1, typeCache, "Relation 1", Artifact, Artifact); + relType2 = createRelationType(2, typeCache, "Relation 2", Artifact, Artifact); + relType3 = createRelationType(3, typeCache, "Relation 3", Artifact, Artifact); renderer = new RelationOrderRenderer(typeCache, resolver); } @Test public void testRenderingAllValid() throws OseeCoreException { - RelationOrderData orderData = new MockRelationOrderData(); + RelationOrderData orderData = new RelationOrderData(null, null); List<Object[]> expectedData = new ArrayList<>(); - addData(orderData, expectedData, "Relation 1", "Relation 1_A", RelationSide.SIDE_A, LEXICOGRAPHICAL_ASC, "1", "2", - "3"); - - addData(orderData, expectedData, "Relation 2", "Relation 2_B", RelationSide.SIDE_B, // - UNORDERED, "4", "5", "6"); - - addData(orderData, expectedData, "Relation 3", "Relation 3_B", RelationSide.SIDE_B, // - USER_DEFINED, "7", "8", "9"); + addData(orderData, expectedData, relType1, "Relation 1_A", SIDE_A, LEXICOGRAPHICAL_ASC, "1", "2", "3"); + addData(orderData, expectedData, relType2, "Relation 2_B", SIDE_B, UNORDERED, "4", "5", "6"); + addData(orderData, expectedData, relType3, "Relation 3_B", SIDE_B, USER_DEFINED, "7", "8", "9"); checkRelationOrderRenderer(getExpected(expectedData), orderData); } @Test public void testRenderingEmptyGuids() throws OseeCoreException { - RelationOrderData orderData = new MockRelationOrderData(); + RelationOrderData orderData = new RelationOrderData(null, null); List<Object[]> expectedData = new ArrayList<>(); - addData(orderData, expectedData, "Relation 1", "Relation 1_A", RelationSide.SIDE_A, USER_DEFINED); + addData(orderData, expectedData, relType1, "Relation 1_A", RelationSide.SIDE_A, USER_DEFINED); checkRelationOrderRenderer(getExpected(expectedData), orderData); } @Test public void testEmptyData() { - RelationOrderData orderData = new MockRelationOrderData(); + RelationOrderData orderData = new RelationOrderData(null, null); List<Object[]> expectedData = new ArrayList<>(); checkRelationOrderRenderer(getExpected(expectedData), orderData); } - private void addData(RelationOrderData orderData, List<Object[]> expectedData, String relationType, String relationSideName, RelationSide side, RelationSorter expectedSorterId, String... guids) throws OseeCoreException { + private void addData(RelationOrderData orderData, List<Object[]> expectedData, IRelationType relationType, String relationSideName, RelationSide side, RelationSorter expectedSorterId, String... guids) throws OseeCoreException { List<String> guidList = Arrays.asList(guids); - orderData.addOrderList(relationType, side.name(), expectedSorterId, guidList); - - expectedData.add( - new Object[] {relationType, relationSideName, side.name().toLowerCase(), expectedSorterId, guidList}); + orderData.addOrderList(relationType, side, expectedSorterId, guidList); + expectedData.add(new Object[] { + relationType.getName(), + relationSideName, + side.name().toLowerCase(), + expectedSorterId, + guidList}); } private String getExpected(List<Object[]> data) { @@ -159,31 +164,11 @@ public class RelationOrderRendererTest { Assert.assertEquals(expected, builder.toString()); } - private final static void addRelationTypeData(AbstractOseeCache<RelationType> cache) throws OseeCoreException { - ArtifactTypeCache artCache = new ArtifactTypeCache(); - IArtifactType artifactType1 = createArtifactType(artCache, "Artifact 2"); - IArtifactType artifactType2 = createArtifactType(artCache, "Artifact 1"); - - createRelationType(cache, "Relation 1", artifactType1, artifactType2); - createRelationType(cache, "Relation 2", artifactType1, artifactType2); - createRelationType(cache, "Relation 3", artifactType1, artifactType2); - } - - private final static ArtifactType createArtifactType(AbstractOseeCache<ArtifactType> artCache, String name) throws OseeCoreException { - ArtifactType artifactType = new ArtifactType(0x00L, name, false); - artCache.cache(artifactType); - return artifactType; - } - - private final static void createRelationType(AbstractOseeCache<RelationType> cache, String name, IArtifactType artifactType1, IArtifactType artifactType2) throws OseeCoreException { - RelationType type = new RelationType(0x00L, name, name + "_A", name + "_B", artifactType1, artifactType2, + private final static RelationType createRelationType(long id, AbstractOseeCache<RelationType> cache, String name, IArtifactType artifactType1, IArtifactType artifactType2) throws OseeCoreException { + RelationType type = new RelationType(id, name, name + "_A", name + "_B", artifactType1, artifactType2, RelationTypeMultiplicity.MANY_TO_MANY, null); cache.cache(type); - } - private final static class MockRelationOrderData extends RelationOrderData { - public MockRelationOrderData() { - super(null, null); - } + return type; } private static final class MockArtifactGuidResolver extends ArtifactGuidToWordML { @@ -194,12 +179,7 @@ public class RelationOrderRendererTest { @Override public List<String> resolveAsOseeLinks(BranchId branch, List<String> artifactGuids) { - List<String> values = new ArrayList<>(); - for (String guid : artifactGuids) { - values.add(guid); - } - return values; + return artifactGuids; } - } -} +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/RelationOrderRepairBlam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/RelationOrderRepairBlam.java index 573c1bc8f56..91c027a0b52 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/RelationOrderRepairBlam.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/RelationOrderRepairBlam.java @@ -17,6 +17,7 @@ import java.util.Collections; import java.util.List; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osee.framework.core.data.BranchId; +import org.eclipse.osee.framework.core.data.IRelationType; import org.eclipse.osee.framework.core.enums.RelationSide; import org.eclipse.osee.framework.core.enums.RelationSorter; import org.eclipse.osee.framework.core.exception.OseeTypeDoesNotExist; @@ -88,7 +89,7 @@ public class RelationOrderRepairBlam extends AbstractBlam { private void resetRelationOrder(Artifact art) throws OseeCoreException, IOException { RelationOrderData currentData = new RelationOrderFactory().createRelationOrderData(art); - for (Pair<String, String> typeSide : currentData.getAvailableTypeSides()) { + for (Pair<IRelationType, RelationSide> typeSide : currentData.getAvailableTypeSides()) { RelationType type; try { type = RelationTypeManager.getType(typeSide.getFirst()); @@ -96,7 +97,7 @@ public class RelationOrderRepairBlam extends AbstractBlam { logf("Type [%s] on artifact [%s] does not exist\n", typeSide.getFirst(), art.getName()); return; } - RelationSide side = RelationSide.fromString(typeSide.getSecond()); + RelationSide side = typeSide.getSecond(); RelationSorter sorterGuid = currentData.getCurrentSorterGuid(type, side); if (sorterGuid.equals(USER_DEFINED)) { diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RelationOrderRenderer.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RelationOrderRenderer.java index 8e70e3eee45..2f667896481 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RelationOrderRenderer.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/render/RelationOrderRenderer.java @@ -14,6 +14,7 @@ import java.util.List; import java.util.Map.Entry; import java.util.logging.Level; import org.eclipse.osee.framework.core.data.BranchId; +import org.eclipse.osee.framework.core.data.IRelationType; import org.eclipse.osee.framework.core.enums.RelationSide; import org.eclipse.osee.framework.core.enums.RelationSorter; import org.eclipse.osee.framework.core.model.cache.AbstractOseeCache; @@ -67,17 +68,16 @@ public class RelationOrderRenderer { writer.addTableRow(NO_DATA_TAG); } else { writer.addTableRow("Relation Type", "Side Name", "Side", "Order Type", "Related Artifacts"); - for (Entry<Pair<String, String>, Pair<RelationSorter, List<String>>> entry : relationOrderData.getOrderedEntrySet()) { - String relationTypeName = entry.getKey().getFirst(); - String relationSide = entry.getKey().getSecond(); + for (Entry<Pair<IRelationType, RelationSide>, Pair<RelationSorter, List<String>>> entry : relationOrderData.getOrderedEntrySet()) { + IRelationType relationTypeId = entry.getKey().getFirst(); + RelationSide relationSide = entry.getKey().getSecond(); RelationSorter sorterGuid = entry.getValue().getFirst(); List<String> guidList = entry.getValue().getSecond(); List<String> mlLinks = guidResolver.resolveAsOseeLinks(branch, guidList); - RelationType relationType = relationCache.getUniqueByName(relationTypeName); - RelationSide side = RelationSide.fromString(relationSide); + RelationType relationType = relationCache.get(relationTypeId); try { - writeTableRow(writer, relationType, side, sorterGuid.toString(), mlLinks); + writeTableRow(writer, relationType, relationSide, sorterGuid.toString(), mlLinks); } catch (Exception ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); } |