Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2016-09-29 11:11:19 -0400
committerAngel Avila2016-10-04 21:35:49 -0400
commit678846333c2449eacc60d2574b3460b46b077ad5 (patch)
tree291d3e5a0eeba4fd4a34bc711135947af8c3b59a
parent66cbcd787a91d90cffcfb2a6864a110661b89c72 (diff)
downloadorg.eclipse.osee-678846333c2449eacc60d2574b3460b46b077ad5.tar.gz
org.eclipse.osee-678846333c2449eacc60d2574b3460b46b077ad5.tar.xz
org.eclipse.osee-678846333c2449eacc60d2574b3460b46b077ad5.zip
refactor: Remove unnecessary class RelationUtil
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreRelationTypes.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImplTest.java6
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/RelationManagerTest.java9
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationManagerImplTest.java29
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImplTest.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManagerTest.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java24
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationUtil.java67
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationManagerImpl.java13
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java3
10 files changed, 53 insertions, 112 deletions
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreRelationTypes.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreRelationTypes.java
index 1ebf6a2689c..880362d43b5 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreRelationTypes.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreRelationTypes.java
@@ -11,8 +11,8 @@
package org.eclipse.osee.framework.core.enums;
import static org.eclipse.osee.framework.core.enums.RelationSide.SIDE_A;
+import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.RelationTypeSide;
-import org.eclipse.osee.framework.core.data.TokenFactory;
public final class CoreRelationTypes {
@@ -25,6 +25,9 @@ public final class CoreRelationTypes {
public static final RelationTypeSide Default_Hierarchical__Parent = RelationTypeSide.create(SIDE_A, 0x2000000000000154L, "Default Hierarchical");
public static final RelationTypeSide Default_Hierarchical__Child = Default_Hierarchical__Parent.getOpposite();
+ public static final IRelationType DEFAULT_HIERARCHY = Default_Hierarchical__Parent;
+ public static final RelationSide IS_PARENT = RelationSide.SIDE_A;
+ public static final RelationSide IS_CHILD = RelationSide.SIDE_B;
public static final RelationTypeSide Dependency__Artifact = RelationTypeSide.create(SIDE_A, 0x2000000000000155L, "Dependency");
public static final RelationTypeSide Dependency__Dependency = Dependency__Artifact.getOpposite();
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImplTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImplTest.java
index 69028465a08..3be9697a7cd 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImplTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImplTest.java
@@ -18,9 +18,9 @@ import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.Allocation
import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.Default_Hierarchical__Child;
import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.Default_Hierarchical__Parent;
import static org.eclipse.osee.framework.core.enums.DeletionFlag.EXCLUDE_DELETED;
-import static org.eclipse.osee.orcs.core.internal.relation.RelationUtil.DEFAULT_HIERARCHY;
-import static org.eclipse.osee.orcs.core.internal.relation.RelationUtil.IS_CHILD;
-import static org.eclipse.osee.orcs.core.internal.relation.RelationUtil.IS_PARENT;
+import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.DEFAULT_HIERARCHY;
+import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.IS_CHILD;
+import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.IS_PARENT;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/RelationManagerTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/RelationManagerTest.java
index e9dc0a7622d..15a109adf6e 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/RelationManagerTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/RelationManagerTest.java
@@ -11,11 +11,11 @@
package org.eclipse.osee.orcs.core.internal.relation;
import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON;
+import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.DEFAULT_HIERARCHY;
+import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.IS_CHILD;
+import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.IS_PARENT;
import static org.eclipse.osee.framework.core.enums.DeletionFlag.INCLUDE_DELETED;
import static org.eclipse.osee.framework.core.enums.RelationSorter.LEXICOGRAPHICAL_DESC;
-import static org.eclipse.osee.orcs.core.internal.relation.RelationUtil.DEFAULT_HIERARCHY;
-import static org.eclipse.osee.orcs.core.internal.relation.RelationUtil.IS_CHILD;
-import static org.eclipse.osee.orcs.core.internal.relation.RelationUtil.IS_PARENT;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -57,6 +57,7 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
+import org.mockito.Matchers;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.invocation.InvocationOnMock;
@@ -205,7 +206,7 @@ public class RelationManagerTest {
setupAdjacencies(node5, relation4);
setupAdjacencies(node6);
- when(types.getDefaultOrderTypeGuid(DEFAULT_HIERARCHY)).thenReturn(LEXICOGRAPHICAL_DESC);
+ when(types.getDefaultOrderTypeGuid(Matchers.any())).thenReturn(LEXICOGRAPHICAL_DESC);
when(types.getAll()).thenReturn(new ArrayList(
Arrays.asList(CoreRelationTypes.Default_Hierarchical__Child, CoreRelationTypes.Default_Hierarchical__Parent)));
}
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationManagerImplTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationManagerImplTest.java
index 73119e55705..d90860d00cf 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationManagerImplTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationManagerImplTest.java
@@ -12,18 +12,18 @@ package org.eclipse.osee.orcs.core.internal.relation.impl;
import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON;
import static org.eclipse.osee.framework.core.enums.CoreBranches.SYSTEM_ROOT;
+import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.DEFAULT_HIERARCHY;
import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.Default_Hierarchical__Child;
+import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.IS_CHILD;
+import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.IS_PARENT;
import static org.eclipse.osee.framework.core.enums.DeletionFlag.EXCLUDE_DELETED;
import static org.eclipse.osee.framework.core.enums.DeletionFlag.INCLUDE_DELETED;
+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.PREEXISTING;
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.RelationSide.SIDE_A;
-import static org.eclipse.osee.framework.core.enums.RelationSide.SIDE_B;
-import static org.eclipse.osee.orcs.core.internal.relation.RelationUtil.DEFAULT_HIERARCHY;
-import static org.eclipse.osee.orcs.core.internal.relation.RelationUtil.IS_CHILD;
-import static org.eclipse.osee.orcs.core.internal.relation.RelationUtil.IS_PARENT;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -62,7 +62,6 @@ import org.eclipse.osee.orcs.core.internal.relation.RelationManager;
import org.eclipse.osee.orcs.core.internal.relation.RelationNode;
import org.eclipse.osee.orcs.core.internal.relation.RelationResolver;
import org.eclipse.osee.orcs.core.internal.relation.RelationTypeValidity;
-import org.eclipse.osee.orcs.core.internal.relation.RelationUtil;
import org.eclipse.osee.orcs.core.internal.relation.RelationVisitor;
import org.eclipse.osee.orcs.core.internal.relation.order.OrderManager;
import org.eclipse.osee.orcs.core.internal.relation.order.OrderManagerFactory;
@@ -531,7 +530,7 @@ public class RelationManagerImplTest {
manager.relate(session, node1, TYPE_1, node2, LEXICOGRAPHICAL_ASC);
- RelationTypeSide typeSide = RelationUtil.asTypeSide(TYPE_1, SIDE_B);
+ RelationTypeSide typeSide = RelationTypeSide.create(TYPE_1, SIDE_B);
verify(container1).getRelation(node1, TYPE_1, node2, INCLUDE_DELETED);
verify(container2).getRelation(node1, TYPE_1, node2, INCLUDE_DELETED);
@@ -550,7 +549,7 @@ public class RelationManagerImplTest {
when(orderFactory.createOrderManager(node1)).thenReturn(orderManager1);
- RelationTypeSide typeSide = RelationUtil.asTypeSide(TYPE_1, SIDE_B);
+ RelationTypeSide typeSide = RelationTypeSide.create(TYPE_1, SIDE_B);
when(orderManager1.getSorterId(typeSide)).thenReturn(UNORDERED);
when(node1.getArtifactType()).thenReturn(artifactType1);
@@ -597,7 +596,7 @@ public class RelationManagerImplTest {
verify(resolver).resolve(session, graph, toOrder, SIDE_B);
- RelationTypeSide typeSide = RelationUtil.asTypeSide(TYPE_1, SIDE_B);
+ RelationTypeSide typeSide = RelationTypeSide.create(TYPE_1, SIDE_B);
verify(orderManager1).sort(typeSide, nodesToOrder);
verify(orderManager1).setOrder(eq(typeSide), eq(USER_DEFINED), sortedListCaptor.capture());
@@ -622,8 +621,8 @@ public class RelationManagerImplTest {
when(node1.getArtifactType()).thenReturn(artifactType1);
when(node2.getArtifactType()).thenReturn(artifactType2);
- when(validity.getMaximumRelationsAllowed(Default_Hierarchical__Child, artifactType1, SIDE_A)).thenReturn(10);
- when(validity.getMaximumRelationsAllowed(Default_Hierarchical__Child, artifactType2, SIDE_B)).thenReturn(10);
+ when(validity.getMaximumRelationsAllowed(DEFAULT_HIERARCHY, artifactType1, SIDE_A)).thenReturn(10);
+ when(validity.getMaximumRelationsAllowed(DEFAULT_HIERARCHY, artifactType2, SIDE_B)).thenReturn(10);
manager.addChild(session, node1, node2);
@@ -646,8 +645,8 @@ public class RelationManagerImplTest {
when(node1.getArtifactType()).thenReturn(artifactType1);
when(node2.getArtifactType()).thenReturn(artifactType2);
- when(validity.getMaximumRelationsAllowed(Default_Hierarchical__Child, artifactType1, SIDE_A)).thenReturn(10);
- when(validity.getMaximumRelationsAllowed(Default_Hierarchical__Child, artifactType2, SIDE_B)).thenReturn(10);
+ when(validity.getMaximumRelationsAllowed(DEFAULT_HIERARCHY, artifactType1, SIDE_A)).thenReturn(10);
+ when(validity.getMaximumRelationsAllowed(DEFAULT_HIERARCHY, artifactType2, SIDE_B)).thenReturn(10);
List<? extends RelationNode> children = Arrays.asList(node2);
manager.addChildren(session, node1, children);
@@ -673,8 +672,8 @@ public class RelationManagerImplTest {
when(node1.getArtifactType()).thenReturn(artifactType1);
when(node2.getArtifactType()).thenReturn(artifactType2);
- when(validity.getMaximumRelationsAllowed(Default_Hierarchical__Child, artifactType1, SIDE_A)).thenReturn(10);
- when(validity.getMaximumRelationsAllowed(Default_Hierarchical__Child, artifactType2, SIDE_B)).thenReturn(10);
+ when(validity.getMaximumRelationsAllowed(DEFAULT_HIERARCHY, artifactType1, SIDE_A)).thenReturn(10);
+ when(validity.getMaximumRelationsAllowed(DEFAULT_HIERARCHY, artifactType2, SIDE_B)).thenReturn(10);
manager.addChild(session, node1, node2);
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImplTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImplTest.java
index 5d610f030a0..10866ffb539 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImplTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImplTest.java
@@ -24,8 +24,8 @@ import static org.eclipse.osee.framework.core.enums.CoreAttributeTypes.WordTempl
import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON;
import static org.eclipse.osee.framework.core.enums.RelationSorter.LEXICOGRAPHICAL_ASC;
import static org.eclipse.osee.framework.core.enums.RelationSorter.LEXICOGRAPHICAL_DESC;
+import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.DEFAULT_HIERARCHY;
import static org.eclipse.osee.framework.core.enums.RelationSide.SIDE_B;
-import static org.eclipse.osee.orcs.core.internal.relation.RelationUtil.DEFAULT_HIERARCHY;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.mockito.Matchers.any;
@@ -56,7 +56,6 @@ import org.eclipse.osee.orcs.KeyValueOps;
import org.eclipse.osee.orcs.OrcsSession;
import org.eclipse.osee.orcs.core.internal.artifact.Artifact;
import org.eclipse.osee.orcs.core.internal.attribute.Attribute;
-import org.eclipse.osee.orcs.core.internal.relation.RelationUtil;
import org.eclipse.osee.orcs.core.internal.search.QueryModule;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.AttributeReadable;
@@ -422,7 +421,7 @@ public class TransactionBuilderImplTest {
@Test
public void testUnrelateFromAllWithSide() throws OseeCoreException {
- RelationTypeSide asTypeSide = RelationUtil.asTypeSide(TYPE_1, SIDE_B);
+ RelationTypeSide asTypeSide = RelationTypeSide.create(TYPE_1, SIDE_B);
factory.unrelateFromAll(asTypeSide, expectedAuthor);
verify(txDataManager).unrelateFromAll(txData, TYPE_1, expectedAuthor, SIDE_B);
}
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManagerTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManagerTest.java
index e0010214f63..a04df7614e2 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManagerTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManagerTest.java
@@ -15,9 +15,9 @@ import static org.eclipse.osee.framework.core.enums.CoreAttributeTypes.Category;
import static org.eclipse.osee.framework.core.enums.CoreAttributeTypes.Name;
import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON;
import static org.eclipse.osee.framework.core.enums.RelationSorter.LEXICOGRAPHICAL_DESC;
+import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.DEFAULT_HIERARCHY;
+import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.IS_CHILD;
import static org.eclipse.osee.framework.core.enums.RelationSide.SIDE_A;
-import static org.eclipse.osee.orcs.core.internal.relation.RelationUtil.DEFAULT_HIERARCHY;
-import static org.eclipse.osee.orcs.core.internal.relation.RelationUtil.IS_CHILD;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Matchers.anyCollectionOf;
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java
index 1da15bec360..ac4b67aa36d 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/proxy/impl/ArtifactReadOnlyImpl.java
@@ -11,7 +11,6 @@
package org.eclipse.osee.orcs.core.internal.proxy.impl;
import static org.eclipse.osee.framework.core.enums.DeletionFlag.EXCLUDE_DELETED;
-import static org.eclipse.osee.orcs.core.internal.relation.RelationUtil.asRelationType;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
@@ -35,7 +34,6 @@ import org.eclipse.osee.orcs.core.internal.attribute.Attribute;
import org.eclipse.osee.orcs.core.internal.proxy.ExternalArtifactManager;
import org.eclipse.osee.orcs.core.internal.relation.RelationManager;
import org.eclipse.osee.orcs.core.internal.relation.RelationNode;
-import org.eclipse.osee.orcs.core.internal.relation.RelationUtil;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.AttributeReadable;
@@ -192,7 +190,7 @@ public class ArtifactReadOnlyImpl extends AbstractProxied<Artifact> implements A
@Override
public int getMaximumRelationAllowed(RelationTypeSide typeAndSide) throws OseeCoreException {
- IRelationType type = asRelationType(typeAndSide);
+ IRelationType type = typeAndSide.getRelationType();
RelationSide side = whichSideAmIOn(typeAndSide);
return getRelationManager().getMaximumRelationAllowed(getSession(), type, getProxiedObject(), side);
}
@@ -250,7 +248,7 @@ public class ArtifactReadOnlyImpl extends AbstractProxied<Artifact> implements A
@Override
public ResultSet<ArtifactReadable> getRelated(RelationTypeSide typeAndSide, DeletionFlag deletionFlag) throws OseeCoreException {
- IRelationType type = asRelationType(typeAndSide);
+ IRelationType type = typeAndSide.getRelationType();
RelationSide side = whichSideAmIOn(typeAndSide);
ResultSet<Artifact> related =
getRelationManager().getRelated(getSession(), type, getProxiedObject(), side, deletionFlag);
@@ -259,21 +257,21 @@ public class ArtifactReadOnlyImpl extends AbstractProxied<Artifact> implements A
@Override
public int getRelatedCount(RelationTypeSide typeAndSide) throws OseeCoreException {
- IRelationType type = asRelationType(typeAndSide);
+ IRelationType type = typeAndSide.getRelationType();
RelationSide side = whichSideAmIOn(typeAndSide);
return getRelationManager().getRelatedCount(getSession(), type, getProxiedObject(), side);
}
@Override
public boolean areRelated(RelationTypeSide typeAndSide, ArtifactReadable readable) throws OseeCoreException {
- IRelationType type = asRelationType(typeAndSide);
+ IRelationType type = typeAndSide.getRelationType();
Pair<RelationNode, RelationNode> nodes = asABNodes(typeAndSide.getSide(), readable);
return getRelationManager().areRelated(getSession(), nodes.getFirst(), type, nodes.getSecond());
}
@Override
public String getRationale(RelationTypeSide typeAndSide, ArtifactReadable readable) throws OseeCoreException {
- IRelationType type = asRelationType(typeAndSide);
+ IRelationType type = typeAndSide.getRelationType();
Pair<RelationNode, RelationNode> nodes = asABNodes(typeAndSide.getSide(), readable);
return getRelationManager().getRationale(getSession(), nodes.getFirst(), type, nodes.getSecond());
}
@@ -281,7 +279,17 @@ public class ArtifactReadOnlyImpl extends AbstractProxied<Artifact> implements A
private Pair<RelationNode, RelationNode> asABNodes(RelationSide side, ArtifactReadable readable) throws OseeCoreException {
Artifact thisArtifact = getProxiedObject();
Artifact otherArtifact = getProxyManager().asInternalArtifact(readable);
- return RelationUtil.asABNodes(thisArtifact, otherArtifact, side);
+
+ RelationNode aNode;
+ RelationNode bNode;
+ if (RelationSide.SIDE_A == side) {
+ aNode = otherArtifact;
+ bNode = thisArtifact;
+ } else {
+ aNode = thisArtifact;
+ bNode = otherArtifact;
+ }
+ return new Pair<RelationNode, RelationNode>(aNode, bNode);
}
private RelationSide whichSideAmIOn(RelationTypeSide typeAndSide) {
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationUtil.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationUtil.java
deleted file mode 100644
index 802c85abc29..00000000000
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationUtil.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.orcs.core.internal.relation;
-
-import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.Default_Hierarchical__Parent;
-import org.eclipse.osee.framework.core.data.IRelationType;
-import org.eclipse.osee.framework.core.data.RelationTypeSide;
-import org.eclipse.osee.framework.core.data.TokenFactory;
-import org.eclipse.osee.framework.core.enums.RelationSide;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.type.Pair;
-import org.eclipse.osee.orcs.core.internal.artifact.Artifact;
-
-/**
- * @author Roberto E. Escobar
- */
-public final class RelationUtil {
-
- public static final IRelationType DEFAULT_HIERARCHY =
- TokenFactory.createRelationType(Default_Hierarchical__Parent.getGuid(), Default_Hierarchical__Parent.getName());
- public static final RelationSide IS_PARENT = RelationSide.SIDE_A;
- public static final RelationSide IS_CHILD = RelationSide.SIDE_B;
-
- private RelationUtil() {
- // Utility
- }
-
- public static IRelationType asRelationType(RelationTypeSide typeAndSide) {
- return TokenFactory.createRelationType(typeAndSide.getGuid(), typeAndSide.getName());
- }
-
- public static RelationTypeSide asTypeSide(IRelationType type, RelationSide side) {
- return RelationTypeSide.create(side, type.getId(), type.getName());
- }
-
- /**
- * Orders artifacts into a and b relation nodes using relation side parameter as a specification of where art2 is in
- * the set.
- *
- * @param art1 The First artifact
- * @param art2 The Second artifact
- * @param side What side is artifact 2 on
- * @return pair of nodes in a,b order
- * @throws OseeCoreException
- */
- public static Pair<RelationNode, RelationNode> asABNodes(Artifact art1, Artifact art2, RelationSide side) {
- RelationNode aNode;
- RelationNode bNode;
- if (RelationSide.SIDE_A == side) {
- aNode = art2;
- bNode = art1;
- } else {
- aNode = art1;
- bNode = art2;
- }
- return new Pair<RelationNode, RelationNode>(aNode, bNode);
- }
-
-}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationManagerImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationManagerImpl.java
index 96e4b988b38..09721ccfb0d 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationManagerImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/impl/RelationManagerImpl.java
@@ -14,14 +14,13 @@ import static org.eclipse.osee.framework.core.enums.DeletionFlag.EXCLUDE_DELETED
import static org.eclipse.osee.framework.core.enums.DeletionFlag.INCLUDE_DELETED;
import static org.eclipse.osee.framework.core.enums.RelationSorter.PREEXISTING;
import static org.eclipse.osee.framework.core.enums.RelationSorter.USER_DEFINED;
+import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.DEFAULT_HIERARCHY;
+import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.IS_CHILD;
+import static org.eclipse.osee.framework.core.enums.CoreRelationTypes.IS_PARENT;
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.jdk.core.util.Conditions.checkNotNull;
import static org.eclipse.osee.framework.jdk.core.util.Strings.emptyString;
-import static org.eclipse.osee.orcs.core.internal.relation.RelationUtil.DEFAULT_HIERARCHY;
-import static org.eclipse.osee.orcs.core.internal.relation.RelationUtil.IS_CHILD;
-import static org.eclipse.osee.orcs.core.internal.relation.RelationUtil.IS_PARENT;
-import static org.eclipse.osee.orcs.core.internal.relation.RelationUtil.asTypeSide;
import static org.eclipse.osee.orcs.core.internal.util.OrcsConditions.checkBranch;
import static org.eclipse.osee.orcs.core.internal.util.OrcsConditions.checkOnGraph;
import static org.eclipse.osee.orcs.core.internal.util.OrcsConditions.checkRelateSelf;
@@ -180,7 +179,7 @@ public class RelationManagerImpl implements RelationManager {
result = resolver.resolve(session, graph, links, otherSide);
if (result.size() > 1) {
OrderManager orderManager = orderFactory.createOrderManager(node);
- RelationTypeSide key = asTypeSide(type, otherSide);
+ RelationTypeSide key = RelationTypeSide.create(type, otherSide);
orderManager.sort(key, result);
}
}
@@ -359,7 +358,7 @@ public class RelationManagerImpl implements RelationManager {
List<Relation> sideLinks = getRelations(session, type, node, side, EXCLUDE_DELETED);
List<RelationNode> nodes = resolver.resolve(session, graph, sideLinks, side);
- RelationTypeSide asTypeSide = asTypeSide(type, side);
+ RelationTypeSide asTypeSide = RelationTypeSide.create(type, side);
orderManager.setOrder(asTypeSide, nodes);
}
}
@@ -435,7 +434,7 @@ public class RelationManagerImpl implements RelationManager {
OrderManager orderManager = orderFactory.createOrderManager(node1);
RelationSide orderSide = side.oppositeSide();
- RelationTypeSide key = asTypeSide(type, orderSide);
+ RelationTypeSide key = RelationTypeSide.create(type, orderSide);
RelationSorter sorterIdToUse = sorterId;
if (sorterIdToUse == PREEXISTING) {
sorterIdToUse = orderManager.getSorterId(key);
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java
index eb7a57260b3..ffed975ec3c 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java
@@ -36,7 +36,6 @@ import org.eclipse.osee.orcs.KeyValueOps;
import org.eclipse.osee.orcs.OrcsSession;
import org.eclipse.osee.orcs.core.internal.artifact.Artifact;
import org.eclipse.osee.orcs.core.internal.attribute.Attribute;
-import org.eclipse.osee.orcs.core.internal.relation.RelationUtil;
import org.eclipse.osee.orcs.core.internal.search.QueryModule;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.TransactionReadable;
@@ -304,7 +303,7 @@ public class TransactionBuilderImpl implements TransactionBuilder {
@Override
public void unrelateFromAll(RelationTypeSide typeAndSide, ArtifactId art) throws OseeCoreException {
- IRelationType type = RelationUtil.asRelationType(typeAndSide);
+ IRelationType type = typeAndSide.getRelationType();
txManager.unrelateFromAll(txData, type, art, typeAndSide.getSide());
}

Back to the top