Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2016-10-21 18:11:44 +0000
committerRyan D. Brooks2020-12-15 22:28:02 +0000
commit90aadfd51d5c69299a6a75951282c3c58c719212 (patch)
tree30abb080f230c083ce1d0a157b8e879a010f0346
parentf4a1a07861e0af3bb4c6535d330a259b0ef277ff (diff)
downloadorg.eclipse.osee-90aadfd51d5c69299a6a75951282c3c58c719212.tar.gz
org.eclipse.osee-90aadfd51d5c69299a6a75951282c3c58c719212.tar.xz
org.eclipse.osee-90aadfd51d5c69299a6a75951282c3c58c719212.zip
refactor: Use ArtifactId in RelationCache 2
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/LoadDeletedRelationTest.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationCache.java20
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationFilterUtil.java4
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java12
4 files changed, 14 insertions, 24 deletions
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/LoadDeletedRelationTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/LoadDeletedRelationTest.java
index 8a21ac44b1e..91c907cb7f2 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/LoadDeletedRelationTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/LoadDeletedRelationTest.java
@@ -65,7 +65,7 @@ public class LoadDeletedRelationTest {
public void loadDeletedRelationTest() {
RelationManager.addRelation(type, left, right, "");
left.persist(getClass().getSimpleName());
- RelationLink loaded = RelationManager.getLoadedRelation(type, left, right, SAW_Bld_2);
+ RelationLink loaded = RelationManager.getLoadedRelation(type, left, right);
GammaId oldGammaId = loaded.getGammaId();
RelationManager.deleteRelation(type, left, right);
left.persist(getClass().getSimpleName());
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationCache.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationCache.java
index 70f7c673278..27f0e10bd0c 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationCache.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationCache.java
@@ -22,7 +22,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.ArtifactToken;
-import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.RelationTypeToken;
import org.eclipse.osee.framework.core.enums.DeletionFlag;
import org.eclipse.osee.framework.core.enums.RelationSide;
@@ -105,21 +104,17 @@ public class RelationCache {
/**
* Find RelationById Related On ArtA or ArtB
*/
- public RelationLink getByRelIdOnArtifact(int relLinkId, int aArtifactId, int bArtifactId, BranchId branch) {
+ public RelationLink getByRelIdOnArtifact(int relLinkId, ArtifactToken artifactA, ArtifactToken artifactB) {
RelationMatcher relIdMatcher = RelationFilterUtil.createFindFirstRelationLinkIdMatcher(relLinkId);
List<RelationLink> links = new ArrayList<>();
- findRelations(links, ArtifactToken.valueOf(aArtifactId, branch), relIdMatcher);
+ findRelations(links, artifactA, relIdMatcher);
if (links.isEmpty()) {
- findRelations(links, ArtifactToken.valueOf(bArtifactId, branch), relIdMatcher);
+ findRelations(links, artifactB, relIdMatcher);
}
return links.isEmpty() ? null : links.iterator().next();
}
public RelationLink getLoadedRelation(ArtifactToken artifact, ArtifactId aArtifactId, ArtifactId bArtifactId, RelationTypeToken relationType, DeletionFlag deletionFlag) {
- return getLoadedRelation(artifact, aArtifactId.getId(), bArtifactId.getId(), relationType, deletionFlag);
- }
-
- public RelationLink getLoadedRelation(ArtifactToken artifact, long aArtifactId, long bArtifactId, RelationTypeToken relationType, DeletionFlag deletionFlag) {
Set<RelationLink> itemsFound = new HashSet<>();
RelationMatcher artIdMatcher = new RelationMatcher() {
@@ -153,18 +148,15 @@ public class RelationCache {
return size != 0 ? relations.iterator().next() : null;
}
- public RelationLink getLoadedRelation(RelationTypeToken relationType, int aArtifactId, int bArtifactId, BranchId branch) {
- ArtifactId artifactA = ArtifactId.valueOf(aArtifactId);
- ArtifactId artifactB = ArtifactId.valueOf(bArtifactId);
-
+ public RelationLink getLoadedRelation(RelationTypeToken relationType, ArtifactToken artifactA, ArtifactToken artifactB) {
RelationMatcher bArtIdMatcher =
RelationFilterUtil.createFindFirstRelatedArtIdMatcher(artifactB, RelationSide.SIDE_B);
List<RelationLink> links = new ArrayList<>();
- findRelations(links, ArtifactToken.valueOf(aArtifactId, branch), relationType, bArtIdMatcher);
+ findRelations(links, artifactA, relationType, bArtIdMatcher);
if (links.isEmpty()) {
RelationMatcher aArtIdMatcher =
RelationFilterUtil.createFindFirstRelatedArtIdMatcher(artifactA, RelationSide.SIDE_A);
- findRelations(links, ArtifactToken.valueOf(bArtifactId, branch), relationType, aArtIdMatcher);
+ findRelations(links, artifactB, relationType, aArtIdMatcher);
}
return links.isEmpty() ? null : links.iterator().next();
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationFilterUtil.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationFilterUtil.java
index 3512b6d039b..b9db3f82a06 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationFilterUtil.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationFilterUtil.java
@@ -34,8 +34,8 @@ public class RelationFilterUtil {
public static final RelationMatcher EXCLUDE_DELETED = new ExcludeDeletedRelationFilter();
public static final RelationMatcher INCLUDE_ALL = new DefaultRelationFilter();
- public static RelationMatcher createFindFirstRelatedArtIdMatcher(ArtifactId aArtifactId, RelationSide side) {
- return new FirstSideRelatedArtIdMatcher(aArtifactId, side.isSideA());
+ public static RelationMatcher createFindFirstRelatedArtIdMatcher(ArtifactId artifactId, RelationSide side) {
+ return new FirstSideRelatedArtIdMatcher(artifactId, side.isSideA());
}
public static RelationMatcher createFindFirstRelationLinkIdMatcher(int relLinkId) {
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java
index dcd515425f6..da2cc901018 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/RelationManager.java
@@ -611,7 +611,7 @@ public class RelationManager {
if (relationId != 0) {
relation = getLoadedRelationById(relationId, aArtifactId, bArtifactId, branch);
} else {
- relation = getLoadedRelation(relationType, aArtifactId, bArtifactId, branch);
+ relation = getLoadedRelation(relationType, aArtifactId, bArtifactId);
}
if (relation == null) {
relation = new RelationLink(aArtifactId, bArtifactId, branch, relationType, relationId, gammaId, rationale,
@@ -623,14 +623,12 @@ public class RelationManager {
return relation;
}
- public static RelationLink getLoadedRelation(RelationTypeToken relationType, ArtifactToken aArtifactId, ArtifactToken bArtifactId, BranchId branch) {
- return relationCache.getLoadedRelation(relationType, aArtifactId.getId().intValue(),
- bArtifactId.getId().intValue(), branch);
+ public static RelationLink getLoadedRelation(RelationTypeToken relationType, ArtifactToken aArtifactId, ArtifactToken bArtifactId) {
+ return relationCache.getLoadedRelation(relationType, aArtifactId, bArtifactId);
}
- public static RelationLink getLoadedRelationById(int relLinkId, ArtifactId aArtifactId, ArtifactId bArtifactId, BranchId branch) {
- return relationCache.getByRelIdOnArtifact(relLinkId, aArtifactId.getId().intValue(),
- bArtifactId.getId().intValue(), branch);
+ public static RelationLink getLoadedRelationById(int relLinkId, ArtifactToken aArtifactId, ArtifactToken bArtifactId, BranchId branch) {
+ return relationCache.getByRelIdOnArtifact(relLinkId, aArtifactId, bArtifactId);
}
public static List<RelationLink> getRelationsAll(Artifact artifact, DeletionFlag deletionFlag) {

Back to the top