Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddunne2010-10-06 17:04:41 +0000
committerRyan D. Brooks2010-10-06 17:04:41 +0000
commitd3023d85db18e429e881c5180daba0043dd02973 (patch)
tree94d519a6f58b7b102b1d33f7843af7d5ce2301ea
parent710024f31226a9ccdd414514d66c939f5d3a9940 (diff)
downloadorg.eclipse.osee-d3023d85db18e429e881c5180daba0043dd02973.tar.gz
org.eclipse.osee-d3023d85db18e429e881c5180daba0043dd02973.tar.xz
org.eclipse.osee-d3023d85db18e429e881c5180daba0043dd02973.zip
feature: Add simple cross branch linking through attribute
-rw-r--r--plugins/org.eclipse.osee.ats.test/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.ats/support/OseeTypes_ATS.osee1
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java1
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Suite.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/relation/CrossBranchLinkTest.java141
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/crossbranch/CrossBranchLink.java157
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/crossbranch/CrossBranchLinkManager.java76
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/crossbranch/LoadedRelationTypes.java35
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee7
9 files changed, 423 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.ats.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.test/META-INF/MANIFEST.MF
index 655723dc902..a18d3b212c5 100644
--- a/plugins/org.eclipse.osee.ats.test/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats.test/META-INF/MANIFEST.MF
@@ -13,9 +13,12 @@ Import-Package: org.eclipse.osee.framework.core.client,
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.eclipse.osee.ats.test,
org.eclipse.osee.ats.test.artifact,
+ org.eclipse.osee.ats.test.artifact.log,
+ org.eclipse.osee.ats.test.artifact.note,
org.eclipse.osee.ats.test.config,
org.eclipse.osee.ats.test.editor,
org.eclipse.osee.ats.test.health,
+ org.eclipse.osee.ats.test.link,
org.eclipse.osee.ats.test.navigate,
org.eclipse.osee.ats.test.render,
org.eclipse.osee.ats.test.util,
diff --git a/plugins/org.eclipse.osee.ats/support/OseeTypes_ATS.osee b/plugins/org.eclipse.osee.ats/support/OseeTypes_ATS.osee
index 32d1b5a8f04..963f0f7ab6a 100644
--- a/plugins/org.eclipse.osee.ats/support/OseeTypes_ATS.osee
+++ b/plugins/org.eclipse.osee.ats/support/OseeTypes_ATS.osee
@@ -130,6 +130,7 @@ artifactType "Team Workflow" extends "ats.State Machine", "Abstract Access Contr
attribute "ats.Proposed Resolution"
attribute "ats.Team Definition"
attribute "ats.User Community"
+ attribute "Cross Branch Link"
}
artifactType "Task" extends "ats.State Machine" {
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java
index a0ff7dd3101..61395cdee40 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreAttributeTypes.java
@@ -32,6 +32,7 @@ public final class CoreAttributeTypes extends NamedIdentity implements IAttribut
public static final IAttributeType ContentUrl = new CoreAttributeTypes("AAMFEcIP+U+ML_gzH7AA", "Content URL");
public static final IAttributeType Country = new CoreAttributeTypes("AAMFEbsk1xGUlmXk8zgA", "Country");
public static final IAttributeType CrewInterfaceRequirement = new CoreAttributeTypes("AAMFEQrZMEwBcq2pQTgA", "Crew Interface Requirement");
+ public static final IAttributeType CrossBranchLink = new CoreAttributeTypes("AXUR3KcbcVPqyNCdQmAA", "Cross Branch Link");
public static final IAttributeType Csci = new CoreAttributeTypes("AAMFEXPEnnkY_07EbRgA", "CSCI");
public static final IAttributeType DefaultMailServer = new CoreAttributeTypes("ABMuIC3FejpGilonfAgA", "osee.config.Default Mail Server");
public static final IAttributeType Description = new CoreAttributeTypes("AAMFEcK+kyOhG8GYvPgA", "Description");
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Suite.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Suite.java
index 151317b6a33..9fe5689b59e 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Suite.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/FrameworkCore_Demo_Suite.java
@@ -43,6 +43,7 @@ import org.eclipse.osee.framework.skynet.core.test.event.TransactionEventLoopbac
import org.eclipse.osee.framework.skynet.core.test.event.TransactionEventTest;
import org.eclipse.osee.framework.skynet.core.test.importing.ImportingSuite;
import org.eclipse.osee.framework.skynet.core.test.importing.parsers.ParsersSuite;
+import org.eclipse.osee.framework.skynet.core.test.relation.CrossBranchLinkTest;
import org.eclipse.osee.framework.skynet.core.test.relation.RelationTestSuite;
import org.eclipse.osee.framework.skynet.core.test.word.UpdateBookmarkIdTest;
import org.junit.BeforeClass;
@@ -51,6 +52,7 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
+ CrossBranchLinkTest.class,
UpdateBookmarkIdTest.class,
ArtifactEventFiltersTest.class,
BranchEventFiltersTest.class,
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/relation/CrossBranchLinkTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/relation/CrossBranchLinkTest.java
new file mode 100644
index 00000000000..0f2c70125ea
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/relation/CrossBranchLinkTest.java
@@ -0,0 +1,141 @@
+/*
+ * Created on Oct 5, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.test.relation;
+
+import static org.eclipse.osee.framework.core.enums.DeletionFlag.EXCLUDE_DELETED;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.artifact.PurgeArtifacts;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.relation.crossbranch.CrossBranchLink;
+import org.eclipse.osee.framework.skynet.core.relation.crossbranch.CrossBranchLinkManager;
+import org.eclipse.osee.support.test.util.DemoSawBuilds;
+import org.eclipse.osee.support.test.util.TestUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CrossBranchLinkTest {
+
+ public static Artifact folderArt;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ tearDown();
+ folderArt =
+ ArtifactTypeManager.addArtifact(CoreArtifactTypes.Folder, BranchManager.getCommonBranch(),
+ CrossBranchLinkTest.class.getSimpleName());
+ folderArt.persist("CrossBranchLinkTest");
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ List<Artifact> artifacts = new ArrayList<Artifact>();
+ artifacts.addAll(ArtifactQuery.getArtifactListFromName(CrossBranchLinkTest.class.getSimpleName() + "%",
+ BranchManager.getCommonBranch(), EXCLUDE_DELETED));
+ artifacts.addAll(ArtifactQuery.getArtifactListFromName(CrossBranchLinkTest.class.getSimpleName() + "%",
+ BranchManager.getBranchByGuid(DemoSawBuilds.SAW_Bld_1.getGuid()), EXCLUDE_DELETED));
+ new PurgeArtifacts(artifacts).execute();
+ TestUtil.sleep(4000);
+ }
+
+ @Test
+ public void testCrossBranchLink() throws OseeCoreException {
+ Branch sawBranch = BranchManager.getBranchByGuid(DemoSawBuilds.SAW_Bld_1.getGuid());
+ Assert.assertNotNull(sawBranch);
+
+ Artifact artifact1 =
+ ArtifactTypeManager.addArtifact(CoreArtifactTypes.GeneralDocument, sawBranch,
+ getClass().getSimpleName() + "-1");
+ artifact1.addAttribute(CoreAttributeTypes.StaticId, CrossBranchLinkTest.class.getSimpleName());
+ artifact1.persist();
+
+ // test equals
+ CrossBranchLink linkA = new CrossBranchLink(CoreRelationTypes.SupportingInfo_SupportingInfo, artifact1);
+ CrossBranchLink linkB = new CrossBranchLink(CoreRelationTypes.SupportingInfo_SupportingInfo, artifact1);
+ Assert.assertTrue(linkA.equals(linkB));
+ linkB = new CrossBranchLink(CoreRelationTypes.SupportingInfo_SupportedBy, artifact1);
+ Assert.assertFalse(linkA.equals(linkB));
+
+ // test addRelation
+ CrossBranchLinkManager.addRelation(folderArt, CoreRelationTypes.SupportingInfo_SupportingInfo, artifact1);
+
+ Collection<CrossBranchLink> links = CrossBranchLinkManager.getLinks(folderArt);
+ Assert.assertEquals(1, links.size());
+ CrossBranchLink link = links.iterator().next();
+ Assert.assertEquals(CoreRelationTypes.SupportingInfo_SupportingInfo, link.getRelationEnum());
+ Assert.assertEquals(artifact1, link.getArtifact());
+
+ Artifact artifact2 =
+ ArtifactTypeManager.addArtifact(CoreArtifactTypes.GeneralDocument, sawBranch,
+ getClass().getSimpleName() + "-2");
+ artifact2.addAttribute(CoreAttributeTypes.StaticId, CrossBranchLinkTest.class.getSimpleName());
+ artifact2.persist();
+
+ CrossBranchLinkManager.addRelation(folderArt, CoreRelationTypes.SupportingInfo_SupportingInfo, artifact2);
+
+ Artifact artifact3 =
+ ArtifactTypeManager.addArtifact(CoreArtifactTypes.GeneralDocument, sawBranch,
+ getClass().getSimpleName() + "-3");
+ artifact3.addAttribute(CoreAttributeTypes.StaticId, CrossBranchLinkTest.class.getSimpleName());
+ artifact3.persist();
+
+ CrossBranchLinkManager.addRelation(folderArt, CoreRelationTypes.Supercedes_Supercedes, artifact3);
+
+ // test getLinks
+ links = CrossBranchLinkManager.getLinks(folderArt);
+ Assert.assertEquals(3, links.size());
+
+ boolean found1 = false, found2 = false, found3 = false;
+ for (CrossBranchLink linkItem : links) {
+ if (linkItem.getArtifact().equals(artifact1)) {
+ Assert.assertEquals(CoreRelationTypes.SupportingInfo_SupportingInfo, linkItem.getRelationEnum());
+ found1 = true;
+ } else if (linkItem.getArtifact().equals(artifact2)) {
+ Assert.assertEquals(CoreRelationTypes.SupportingInfo_SupportingInfo, linkItem.getRelationEnum());
+ found2 = true;
+ } else if (linkItem.getArtifact().equals(artifact3)) {
+ Assert.assertEquals(CoreRelationTypes.Supercedes_Supercedes, linkItem.getRelationEnum());
+ found3 = true;
+ }
+ }
+ Assert.assertTrue(found1);
+ Assert.assertTrue(found2);
+ Assert.assertTrue(found3);
+
+ // test getRelatedArtifactCount
+ Assert.assertEquals(2,
+ CrossBranchLinkManager.getRelatedArtifactCount(folderArt, CoreRelationTypes.SupportingInfo_SupportingInfo));
+ Assert.assertEquals(0,
+ CrossBranchLinkManager.getRelatedArtifactCount(folderArt, CoreRelationTypes.SupportingInfo_SupportedBy));
+ Assert.assertEquals(1,
+ CrossBranchLinkManager.getRelatedArtifactCount(folderArt, CoreRelationTypes.Supercedes_Supercedes));
+
+ // test deleteRelation
+ CrossBranchLinkManager.deleteRelation(folderArt, CoreRelationTypes.SupportingInfo_SupportingInfo, artifact1);
+ Assert.assertEquals(1,
+ CrossBranchLinkManager.getRelatedArtifactCount(folderArt, CoreRelationTypes.SupportingInfo_SupportingInfo));
+
+ // test deleteRelations
+ CrossBranchLinkManager.addRelation(folderArt, CoreRelationTypes.SupportingInfo_SupportingInfo, artifact1);
+ Assert.assertEquals(2,
+ CrossBranchLinkManager.getRelatedArtifactCount(folderArt, CoreRelationTypes.SupportingInfo_SupportingInfo));
+ CrossBranchLinkManager.deleteRelations(folderArt, CoreRelationTypes.SupportingInfo_SupportingInfo);
+ Assert.assertEquals(0,
+ CrossBranchLinkManager.getRelatedArtifactCount(folderArt, CoreRelationTypes.SupportingInfo_SupportingInfo));
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/crossbranch/CrossBranchLink.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/crossbranch/CrossBranchLink.java
new file mode 100644
index 00000000000..7b0174c7127
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/crossbranch/CrossBranchLink.java
@@ -0,0 +1,157 @@
+/*
+ * Created on Oct 5, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.relation.crossbranch;
+
+import java.util.logging.Level;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.enums.IRelationEnumeration;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.event.DefaultBasicGuidArtifact;
+import org.eclipse.osee.framework.core.model.type.RelationType;
+import org.eclipse.osee.framework.jdk.core.util.AXml;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.internal.Activator;
+import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager;
+
+public class CrossBranchLink {
+
+ public Artifact artifact;
+ public DefaultBasicGuidArtifact guidArt;
+ public IRelationEnumeration relationEnum;
+ public boolean aSide;
+ public Attribute<?> matchingAttribute;
+
+ public CrossBranchLink(Attribute<?> attr) {
+ this.matchingAttribute = attr;
+ try {
+ this.artifact = attr.getArtifact();
+ unPack();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ }
+
+ public CrossBranchLink(IRelationEnumeration relationEnum, Artifact artifact) {
+ this.relationEnum = relationEnum;
+ this.artifact = artifact;
+ this.guidArt = artifact.getBasicGuidArtifact();
+ this.aSide = relationEnum.getSide().isSideA();
+ }
+
+ public Attribute<?> getMatchingAttribute() {
+ return matchingAttribute;
+ }
+
+ public void setMatchingAttribute(Attribute<?> matchingAttribute) {
+ this.matchingAttribute = matchingAttribute;
+ }
+
+ public String toXml() throws OseeCoreException {
+ RelationType relationType = RelationTypeManager.getType(relationEnum);
+ StringBuffer sb = new StringBuffer(AXml.addTagData("relTypeGuid", relationType.getGuid()));
+ sb.append(AXml.addTagData("artGuid", artifact.getGuid()));
+ sb.append(AXml.addTagData("artTypeGuid", artifact.getArtTypeGuid()));
+ sb.append(AXml.addTagData("branchGuid", artifact.getBranchGuid()));
+ sb.append(AXml.addTagData("aSide", String.valueOf(relationEnum.getSide().isSideA())));
+ return sb.toString();
+ }
+
+ public void store(Artifact onArtifact) throws OseeCoreException {
+ onArtifact.addAttribute(CoreAttributeTypes.CrossBranchLink, toXml());
+ }
+
+ public void fromXml(String xmlStr) throws OseeCoreException {
+ String artGuid = AXml.getTagData(xmlStr, "artGuid");
+ String branchGuid = AXml.getTagData(xmlStr, "branchGuid");
+ String artTypeGuid = AXml.getTagData(xmlStr, "artTypeGuid");
+ String relTypeGuid = AXml.getTagData(xmlStr, "relTypeGuid");
+ aSide = AXml.getTagBooleanData(xmlStr, "aSide");
+ final RelationType relationType = RelationTypeManager.getTypeByGuid(relTypeGuid);
+ relationEnum = new LoadedRelationTypes(relationType, aSide);
+ guidArt = new DefaultBasicGuidArtifact(branchGuid, artTypeGuid, artGuid);
+ }
+
+ private void unPack() throws OseeCoreException {
+ if (relationEnum == null) {
+ String xmlStr = (String) matchingAttribute.getValue();
+ fromXml(xmlStr);
+ }
+ }
+
+ public RelationType getRelationType() throws OseeCoreException {
+ unPack();
+ return RelationTypeManager.getType(relationEnum);
+ }
+
+ public Artifact getArtifact() throws OseeCoreException {
+ if (artifact != null) {
+ unPack();
+ artifact = ArtifactQuery.getArtifactFromToken(guidArt);
+ }
+ return artifact;
+ }
+
+ public void setArtifact(Artifact artifact) {
+ this.artifact = artifact;
+ }
+
+ public IRelationEnumeration getRelationEnum() throws OseeCoreException {
+ if (relationEnum == null) {
+ unPack();
+ }
+ return relationEnum;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (aSide ? 1231 : 1237);
+ result = prime * result + ((guidArt == null) ? 0 : guidArt.hashCode());
+ result = prime * result + ((relationEnum == null) ? 0 : relationEnum.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ CrossBranchLink other = (CrossBranchLink) obj;
+ if (aSide != other.aSide) {
+ return false;
+ }
+ if (guidArt == null) {
+ if (other.guidArt != null) {
+ return false;
+ }
+ } else if (!guidArt.equals(other.guidArt)) {
+ return false;
+ }
+ if (relationEnum == null) {
+ if (other.relationEnum != null) {
+ return false;
+ }
+ } else if (!relationEnum.equals(other.relationEnum)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("[%s - %s - %s]", relationEnum, aSide, guidArt);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/crossbranch/CrossBranchLinkManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/crossbranch/CrossBranchLinkManager.java
new file mode 100644
index 00000000000..c6d12d87bde
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/crossbranch/CrossBranchLinkManager.java
@@ -0,0 +1,76 @@
+/*
+ * Created on Oct 5, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.skynet.core.relation.crossbranch;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.enums.IRelationEnumeration;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
+
+/**
+ * This class provides the ability for an artifact to link to an artifact on another branch. It is not a full featured
+ * link and is also omni-directional, so care must be taken when using this.<br>
+ * The information for this link is stored as attributes on the sideA artifact. User needs to be aware that the relation
+ * type, branch and artifact may not exist when the link is accessed, so care must be taken when using this.<br>
+ * <br>
+ * Link uses the Cross Branch Link attribute which must be added as a valid attribute on the SIDE_A artifact type. <br>
+ * <br>
+ * TODO Remove this class and replace with framework cross branch links when available.
+ *
+ * @author Donald G. Dunne
+ */
+public class CrossBranchLinkManager {
+
+ public static void addRelation(Artifact artifact, IRelationEnumeration relationSide, Artifact otherArt) throws OseeCoreException {
+ CrossBranchLink newLink = new CrossBranchLink(relationSide, otherArt);
+ if (!getLinks(artifact).contains(newLink)) {
+ newLink.store(artifact);
+ }
+ }
+
+ public static List<Artifact> getRelatedArtifacts(Artifact artifact, IRelationEnumeration relationEnum) throws OseeCoreException {
+ List<Artifact> artifacts = new ArrayList<Artifact>();
+ for (CrossBranchLink link : getLinks(artifact)) {
+ if (link.getRelationType().equals(relationEnum) && link.aSide == relationEnum.getSide().isSideA()) {
+ artifacts.add(link.getArtifact());
+ }
+ }
+ return artifacts;
+ }
+
+ public static int getRelatedArtifactCount(Artifact artifact, IRelationEnumeration relationEnum) throws OseeCoreException {
+ return getRelatedArtifacts(artifact, relationEnum).size();
+ }
+
+ public static void deleteRelation(Artifact artifact, IRelationEnumeration relationSide, Artifact otherArt) throws OseeCoreException {
+ CrossBranchLink newLink = new CrossBranchLink(relationSide, otherArt);
+ for (CrossBranchLink link : getLinks(artifact)) {
+ if (link.equals(newLink)) {
+ link.getMatchingAttribute().delete();
+ }
+ }
+ }
+
+ public static void deleteRelations(Artifact artifact, IRelationEnumeration relationSide) throws OseeCoreException {
+ for (CrossBranchLink link : getLinks(artifact)) {
+ if (link.getRelationEnum().equals(relationSide)) {
+ link.getMatchingAttribute().delete();
+ }
+ }
+ }
+
+ public static Collection<CrossBranchLink> getLinks(Artifact artifact) throws OseeCoreException {
+ List<CrossBranchLink> links = new ArrayList<CrossBranchLink>();
+ for (Attribute<?> attr : artifact.getAttributes(CoreAttributeTypes.CrossBranchLink)) {
+ links.add(new CrossBranchLink(attr));
+ }
+ return links;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/crossbranch/LoadedRelationTypes.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/crossbranch/LoadedRelationTypes.java
new file mode 100644
index 00000000000..6bfeffb3f66
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/crossbranch/LoadedRelationTypes.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 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.framework.skynet.core.relation.crossbranch;
+
+import org.eclipse.osee.framework.core.data.NamedIdentity;
+import org.eclipse.osee.framework.core.enums.IRelationEnumeration;
+import org.eclipse.osee.framework.core.enums.RelationSide;
+import org.eclipse.osee.framework.core.model.type.RelationType;
+
+public class LoadedRelationTypes extends NamedIdentity implements IRelationEnumeration {
+
+ private final RelationSide relationSide;
+
+ public LoadedRelationTypes(RelationType relationType, boolean aSide) {
+ this(aSide ? RelationSide.SIDE_A : RelationSide.SIDE_B, relationType.getGuid(), relationType.getName());
+ }
+
+ public LoadedRelationTypes(RelationSide side, String guid, String name) {
+ super(guid, name);
+ this.relationSide = side;
+ }
+
+ @Override
+ public RelationSide getSide() {
+ return relationSide;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee b/plugins/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee
index 97171121728..e2b9231ca40 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee
+++ b/plugins/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee
@@ -16,6 +16,13 @@ artifactType "Global Preferences" extends "Artifact" {
attribute "osee.config.Default Mail Server"
}
+attributeType "Cross Branch Link" extends StringAttribute {
+ guid "AXUR3KcbcVPqyNCdQmAA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max unlimited
+}
+
attributeType "osee.config.Default Mail Server" extends StringAttribute {
guid "ABMuIC3FejpGilonfAgA"
dataProvider DefaultAttributeDataProvider

Back to the top