diff options
Diffstat (limited to 'plugins/org.eclipse.osee.framework.skynet.core')
14 files changed, 81 insertions, 106 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/OseeSystemArtifacts.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/OseeSystemArtifacts.java index a9670b91c80..73deba3b7ec 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/OseeSystemArtifacts.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/OseeSystemArtifacts.java @@ -55,9 +55,9 @@ public final class OseeSystemArtifacts { return getOrCreateCachedArtifact(artifactType, artifactName, branch, null, true); } - public static Artifact getOrCreateArtifact(IArtifactToken artifactToken) throws OseeCoreException { - return getOrCreateCachedArtifact(artifactToken.getArtifactType(), artifactToken.getName(), - artifactToken.getBranch(), artifactToken.getGuid(), true); + public static Artifact getOrCreateArtifact(IArtifactToken artifactToken, IOseeBranch branch) throws OseeCoreException { + return getOrCreateCachedArtifact(artifactToken.getArtifactType(), artifactToken.getName(), branch, + artifactToken.getGuid(), true); } public static Artifact getCachedArtifact(IArtifactType artifactType, String artifactName, IOseeBranch branch) throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java index bee1cfdf13f..86a2875e394 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/Artifact.java @@ -36,13 +36,13 @@ import org.eclipse.osee.framework.core.data.IAttributeType; import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.data.IRelationSorterId; import org.eclipse.osee.framework.core.data.IRelationType; +import org.eclipse.osee.framework.core.data.IRelationTypeSide; import org.eclipse.osee.framework.core.data.NamedIdentity; import org.eclipse.osee.framework.core.data.SystemUser; import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; import org.eclipse.osee.framework.core.enums.CoreRelationTypes; import org.eclipse.osee.framework.core.enums.DeletionFlag; import org.eclipse.osee.framework.core.enums.EditState; -import org.eclipse.osee.framework.core.enums.IRelationEnumeration; import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.enums.PermissionEnum; import org.eclipse.osee.framework.core.enums.RelationOrderBaseTypes; @@ -179,31 +179,31 @@ public class Artifact extends NamedIdentity implements IArtifact, IAdaptable, IB return RelationManager.getRelatedArtifacts(this, relationTypeSide); } - public final List<Artifact> getRelatedArtifactsUnSorted(IRelationEnumeration relationEnum) throws OseeCoreException { + public final List<Artifact> getRelatedArtifactsUnSorted(IRelationTypeSide relationEnum) throws OseeCoreException { return RelationManager.getRelatedArtifactsUnSorted(this, relationEnum); } - public final List<Artifact> getRelatedArtifacts(IRelationEnumeration relationEnum) throws OseeCoreException { + public final List<Artifact> getRelatedArtifacts(IRelationTypeSide relationEnum) throws OseeCoreException { return RelationManager.getRelatedArtifacts(this, relationEnum); } - public final List<Artifact> getRelatedArtifacts(IRelationEnumeration relationEnum, DeletionFlag deletionFlag) throws OseeCoreException { + public final List<Artifact> getRelatedArtifacts(IRelationTypeSide relationEnum, DeletionFlag deletionFlag) throws OseeCoreException { return RelationManager.getRelatedArtifacts(this, relationEnum, deletionFlag); } - public final String getRelationRationale(Artifact artifact, IRelationEnumeration relationTypeSide) throws OseeCoreException { + public final String getRelationRationale(Artifact artifact, IRelationTypeSide relationTypeSide) throws OseeCoreException { Pair<Artifact, Artifact> sides = determineArtifactSides(artifact, relationTypeSide); RelationLink link = RelationManager.getRelationLink(sides.getFirst(), sides.getSecond(), relationTypeSide); return link.getRationale(); } - public final void setRelationRationale(Artifact artifact, IRelationEnumeration relationTypeSide, String rationale) throws OseeCoreException { + public final void setRelationRationale(Artifact artifact, IRelationTypeSide relationTypeSide, String rationale) throws OseeCoreException { Pair<Artifact, Artifact> sides = determineArtifactSides(artifact, relationTypeSide); RelationLink link = RelationManager.getRelationLink(sides.getFirst(), sides.getSecond(), relationTypeSide); link.setRationale(rationale); } - private Pair<Artifact, Artifact> determineArtifactSides(Artifact artifact, IRelationEnumeration relationSide) { + private Pair<Artifact, Artifact> determineArtifactSides(Artifact artifact, IRelationTypeSide relationSide) { boolean sideA = relationSide.getSide().isSideA(); Artifact artifactA = sideA ? artifact : this; Artifact artifactB = sideA ? this : artifact; @@ -213,7 +213,7 @@ public class Artifact extends NamedIdentity implements IArtifact, IAdaptable, IB /** * Check if artifacts are related to each other by relation type */ - public final boolean isRelated(IRelationEnumeration relationEnum, Artifact other) throws OseeCoreException { + public final boolean isRelated(IRelationTypeSide relationEnum, Artifact other) throws OseeCoreException { List<Artifact> relatedArtifacts = getRelatedArtifacts(relationEnum); return relatedArtifacts.contains(other); } @@ -221,24 +221,24 @@ public class Artifact extends NamedIdentity implements IArtifact, IAdaptable, IB /** * Get the exactly one artifact related to this artifact by a relation of type relationType */ - public final Artifact getRelatedArtifact(IRelationEnumeration relationEnum) throws OseeCoreException { + public final Artifact getRelatedArtifact(IRelationTypeSide relationEnum) throws OseeCoreException { return RelationManager.getRelatedArtifact(this, relationEnum); } - public final int getRelatedArtifactsCount(IRelationEnumeration relationEnum) { + public final int getRelatedArtifactsCount(IRelationTypeSide relationEnum) { return RelationManager.getRelatedArtifactsCount(this, relationEnum, relationEnum.getSide()); } - public final <A extends Artifact> List<A> getRelatedArtifactsUnSorted(IRelationEnumeration side, Class<A> clazz) throws OseeCoreException { + public final <A extends Artifact> List<A> getRelatedArtifactsUnSorted(IRelationTypeSide side, Class<A> clazz) throws OseeCoreException { return Collections.castAll(getRelatedArtifactsUnSorted(side)); } - public final <A extends Artifact> List<A> getRelatedArtifacts(IRelationEnumeration side, Class<A> clazz) throws OseeCoreException { + public final <A extends Artifact> List<A> getRelatedArtifacts(IRelationTypeSide side, Class<A> clazz) throws OseeCoreException { return Collections.castAll(getRelatedArtifacts(side)); } @SuppressWarnings("unchecked") - public final <A extends Artifact> List<A> getRelatedArtifactsOfType(IRelationEnumeration side, Class<A> clazz) throws OseeCoreException { + public final <A extends Artifact> List<A> getRelatedArtifactsOfType(IRelationTypeSide side, Class<A> clazz) throws OseeCoreException { List<A> objs = new ArrayList<A>(); for (Artifact art : getRelatedArtifacts(side)) { if (clazz.isInstance(art)) { @@ -1140,20 +1140,20 @@ public class Artifact extends NamedIdentity implements IArtifact, IAdaptable, IB linksLoaded = loaded; } - public final void addRelation(IRelationSorterId sorterId, IRelationEnumeration relationTypeSide, Artifact artifact, String rationale) throws OseeCoreException { + public final void addRelation(IRelationSorterId sorterId, IRelationTypeSide relationTypeSide, Artifact artifact, String rationale) throws OseeCoreException { Pair<Artifact, Artifact> sides = determineArtifactSides(artifact, relationTypeSide); RelationManager.addRelation(sorterId, relationTypeSide, sides.getFirst(), sides.getSecond(), rationale); } - public final void addRelation(IRelationEnumeration relationSide, Artifact artifact) throws OseeCoreException { + public final void addRelation(IRelationTypeSide relationSide, Artifact artifact) throws OseeCoreException { addRelation(null, relationSide, artifact, null); } - public final void addRelation(IRelationSorterId sorterId, IRelationEnumeration relationSide, Artifact artifact) throws OseeCoreException { + public final void addRelation(IRelationSorterId sorterId, IRelationTypeSide relationSide, Artifact artifact) throws OseeCoreException { addRelation(sorterId, relationSide, artifact, null); } - public final void addRelation(IRelationSorterId sorterId, IRelationEnumeration relationEnumeration, Artifact targetArtifact, boolean insertAfterTarget, Artifact itemToAdd, String rationale) throws OseeCoreException { + public final void addRelation(IRelationSorterId sorterId, IRelationTypeSide relationEnumeration, Artifact targetArtifact, boolean insertAfterTarget, Artifact itemToAdd, String rationale) throws OseeCoreException { boolean sideA = relationEnumeration.getSide().isSideA(); Artifact artifactA = sideA ? itemToAdd : this; Artifact artifactB = sideA ? this : itemToAdd; @@ -1162,12 +1162,12 @@ public class Artifact extends NamedIdentity implements IArtifact, IAdaptable, IB setRelationOrder(relationEnumeration, targetArtifact, insertAfterTarget, itemToAdd); } - public final void setRelationOrder(IRelationEnumeration relationSide, List<Artifact> artifactsInNewOrder) throws OseeCoreException { + public final void setRelationOrder(IRelationTypeSide relationSide, List<Artifact> artifactsInNewOrder) throws OseeCoreException { RelationManager.setRelationOrder(this, relationSide, relationSide.getSide(), RelationOrderBaseTypes.USER_DEFINED, artifactsInNewOrder); } - public final void setRelationOrder(IRelationEnumeration relationEnumeration, IRelationSorterId orderId) throws OseeCoreException { + public final void setRelationOrder(IRelationTypeSide relationEnumeration, IRelationSorterId orderId) throws OseeCoreException { if (RelationOrderBaseTypes.USER_DEFINED == orderId) { setRelationOrder(relationEnumeration, getRelatedArtifacts(relationEnumeration)); } else { @@ -1176,7 +1176,7 @@ public class Artifact extends NamedIdentity implements IArtifact, IAdaptable, IB } } - public final void setRelationOrder(IRelationEnumeration relationEnumeration, Artifact targetArtifact, boolean insertAfterTarget, Artifact itemToAdd) throws OseeCoreException { + public final void setRelationOrder(IRelationTypeSide relationEnumeration, Artifact targetArtifact, boolean insertAfterTarget, Artifact itemToAdd) throws OseeCoreException { List<Artifact> currentOrder = getRelatedArtifacts(relationEnumeration, Artifact.class); // target artifact doesn't exist if (!currentOrder.contains(targetArtifact)) { @@ -1194,12 +1194,12 @@ public class Artifact extends NamedIdentity implements IArtifact, IAdaptable, IB RelationOrderBaseTypes.USER_DEFINED, currentOrder); } - public final void deleteRelation(IRelationEnumeration relationTypeSide, Artifact artifact) throws OseeCoreException { + public final void deleteRelation(IRelationTypeSide relationTypeSide, Artifact artifact) throws OseeCoreException { Pair<Artifact, Artifact> sides = determineArtifactSides(artifact, relationTypeSide); RelationManager.deleteRelation(relationTypeSide, sides.getFirst(), sides.getSecond()); } - public final void deleteRelations(IRelationEnumeration relationSide) throws OseeCoreException { + public final void deleteRelations(IRelationTypeSide relationSide) throws OseeCoreException { for (Artifact art : getRelatedArtifacts(relationSide)) { deleteRelation(relationSide, art); } @@ -1208,7 +1208,7 @@ public class Artifact extends NamedIdentity implements IArtifact, IAdaptable, IB /** * Creates new relations that don't already exist and removes relations to artifacts that are not in collection */ - public final void setRelations(IRelationSorterId sorterId, IRelationEnumeration relationSide, Collection<? extends Artifact> artifacts) throws OseeCoreException { + public final void setRelations(IRelationSorterId sorterId, IRelationTypeSide relationSide, Collection<? extends Artifact> artifacts) throws OseeCoreException { Collection<Artifact> currentlyRelated = getRelatedArtifacts(relationSide, Artifact.class); // Remove relations that have been removed for (Artifact artifact : currentlyRelated) { @@ -1227,14 +1227,14 @@ public class Artifact extends NamedIdentity implements IArtifact, IAdaptable, IB /** * Creates new relations that don't already exist and removes relations to artifacts that are not in collection */ - public final void setRelations(IRelationEnumeration relationSide, Collection<? extends Artifact> artifacts) throws OseeCoreException { + public final void setRelations(IRelationTypeSide relationSide, Collection<? extends Artifact> artifacts) throws OseeCoreException { setRelations(null, relationSide, artifacts); } /** * Creates new relations that don't already exist and removes relations to artifacts that are not in collection */ - public final void setRelationsOfTypeUseCurrentOrder(IRelationEnumeration relationSide, Collection<? extends Artifact> artifacts, Class<?> clazz) throws OseeCoreException { + public final void setRelationsOfTypeUseCurrentOrder(IRelationTypeSide relationSide, Collection<? extends Artifact> artifacts, Class<?> clazz) throws OseeCoreException { RelationTypeSideSorter sorter = RelationManager.createTypeSideSorter(this, relationSide, relationSide.getSide()); Collection<Artifact> currentlyRelated = getRelatedArtifacts(relationSide, Artifact.class); // Add new relations if don't exist @@ -1285,7 +1285,7 @@ public class Artifact extends NamedIdentity implements IArtifact, IAdaptable, IB * Return true if this artifact any of it's links specified or any of the artifacts on the other side of the links * are dirty */ - public final String isRelationsAndArtifactsDirty(Set<IRelationEnumeration> links) { + public final String isRelationsAndArtifactsDirty(Set<IRelationTypeSide> links) { try { if (hasDirtyAttributes()) { @@ -1297,7 +1297,7 @@ public class Artifact extends NamedIdentity implements IArtifact, IAdaptable, IB return "Artifact isDirty == true??"; } // Loop through all relations - for (IRelationEnumeration side : links) { + for (IRelationTypeSide side : links) { for (Artifact art : getRelatedArtifacts(side)) { // Check artifact dirty if (art.hasDirtyAttributes()) { @@ -1640,7 +1640,7 @@ public class Artifact extends NamedIdentity implements IArtifact, IAdaptable, IB return relations; } - public final List<RelationLink> getRelations(IRelationEnumeration relationEnum) throws OseeCoreException { + public final List<RelationLink> getRelations(IRelationTypeSide relationEnum) throws OseeCoreException { return RelationManager.getRelations(this, relationEnum, relationEnum.getSide()); } @@ -1648,7 +1648,7 @@ public class Artifact extends NamedIdentity implements IArtifact, IAdaptable, IB * Return relations that exist between artifacts of type side */ @Deprecated - public final ArrayList<RelationLink> getRelations(IRelationEnumeration side, Artifact artifact) throws OseeCoreException { + public final ArrayList<RelationLink> getRelations(IRelationTypeSide side, Artifact artifact) throws OseeCoreException { ArrayList<RelationLink> relations = new ArrayList<RelationLink>(); for (RelationLink relation : getRelations(side)) { try { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java index d366a84f868..2ee8be947b6 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java @@ -175,9 +175,9 @@ public class ArtifactTypeManager { return makeNewArtifact(artifactType, branch, guid, humandReadableId); } - public static Artifact addArtifact(IArtifactToken artifactToken) throws OseeCoreException { - return getFactory(artifactToken.getArtifactType()).makeNewArtifact(artifactToken.getBranch(), - artifactToken.getArtifactType(), artifactToken.getName(), artifactToken.getGuid(), null); + public static Artifact addArtifact(IArtifactToken artifactToken, IOseeBranch branch) throws OseeCoreException { + return getFactory(artifactToken.getArtifactType()).makeNewArtifact(branch, artifactToken.getArtifactType(), + artifactToken.getName(), artifactToken.getGuid(), null); } private static final String DELETE_VALID_ATTRIBUTE = diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java index 87f28ced35b..5c4b7582f91 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java @@ -24,6 +24,7 @@ import org.eclipse.core.runtime.jobs.IJobChangeListener; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.data.SystemUser; +import org.eclipse.osee.framework.core.data.TokenFactory; import org.eclipse.osee.framework.core.enums.BranchArchivedState; import org.eclipse.osee.framework.core.enums.BranchState; import org.eclipse.osee.framework.core.enums.BranchType; @@ -428,7 +429,8 @@ public class BranchManager { } public static Branch createTopLevelBranch(final String branchName) throws OseeCoreException { - return createTopLevelBranch(new CoreBranches(GUID.create(), branchName)); + IOseeBranch branchToken = TokenFactory.createBranch(GUID.create(), branchName); + return createTopLevelBranch(branchToken); } public static List<Branch> getBaselineBranches() throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java index 889b083daa1..0dfaa13d5c9 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java @@ -52,8 +52,8 @@ import org.eclipse.osee.framework.skynet.core.event.model.EventBasicGuidArtifact */ public class ArtifactQuery { - public static Artifact getArtifactFromToken(IArtifactToken artifactToken) throws OseeCoreException { - return getArtifactFromId(artifactToken.getGuid(), BranchManager.getBranch(artifactToken.getBranch())); + public static Artifact getArtifactFromToken(IArtifactToken artifactToken, IOseeBranch branch) throws OseeCoreException { + return getArtifactFromId(artifactToken.getGuid(), BranchManager.getBranch(branch)); } public static Artifact getArtifactFromToken(EventBasicGuidArtifact guidArt) throws OseeCoreException { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/InRelationSearch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/InRelationSearch.java index dda15bcf384..2fef8450652 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/InRelationSearch.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/InRelationSearch.java @@ -11,7 +11,7 @@ package org.eclipse.osee.framework.skynet.core.artifact.search; import java.util.List; -import org.eclipse.osee.framework.core.enums.IRelationEnumeration; +import org.eclipse.osee.framework.core.data.IRelationTypeSide; import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.skynet.core.artifact.ArtifactPersistenceManager; @@ -42,7 +42,7 @@ public class InRelationSearch implements ISearchPrimitive { * * @throws IllegalArgumentException if the sides are a mixture of sideA and sideB relation sides. */ - public InRelationSearch(IRelationEnumeration firstSide, IRelationEnumeration... sides) { + public InRelationSearch(IRelationTypeSide firstSide, IRelationTypeSide... sides) { this(null, firstSide, sides); } @@ -53,14 +53,14 @@ public class InRelationSearch implements ISearchPrimitive { * * @throws IllegalArgumentException if the sides are a mixture of sideA and sideB relation sides. */ - public InRelationSearch(FromArtifactsSearch otherArtifacts, IRelationEnumeration firstSide, IRelationEnumeration... sides) { + public InRelationSearch(FromArtifactsSearch otherArtifacts, IRelationTypeSide firstSide, IRelationTypeSide... sides) { this.typeNames = new String[sides.length + 1]; this.sideA = firstSide.getSide().isSideA(); this.otherArtifactsCriteria = otherArtifacts; int count = 0; typeNames[count++] = firstSide.getName(); - for (IRelationEnumeration side : sides) { + for (IRelationTypeSide side : sides) { if (side != firstSide) { throw new IllegalArgumentException("All links must be for the same side."); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/RelationCriteria.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/RelationCriteria.java index 5e96f6d6393..2444ca7359d 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/RelationCriteria.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/RelationCriteria.java @@ -11,7 +11,7 @@ package org.eclipse.osee.framework.skynet.core.artifact.search; import org.eclipse.osee.framework.core.data.IRelationType; -import org.eclipse.osee.framework.core.enums.IRelationEnumeration; +import org.eclipse.osee.framework.core.data.IRelationTypeSide; import org.eclipse.osee.framework.core.enums.RelationSide; import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager; @@ -31,7 +31,7 @@ public class RelationCriteria extends AbstractArtifactSearchCriteria { * * @param relationEnum the side to start following the link from */ - public RelationCriteria(IRelationEnumeration relationEnum) { + public RelationCriteria(IRelationTypeSide relationEnum) { this(relationEnum, relationEnum.getSide()); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/Change.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/Change.java index 148f4fa383b..0ba50a98915 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/Change.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/change/Change.java @@ -12,6 +12,7 @@ package org.eclipse.osee.framework.skynet.core.change; import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.osee.framework.core.data.HasBranch; import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.exception.OseeCoreException; @@ -22,7 +23,7 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact; /** * @author Jeff C. Phillips */ -public abstract class Change implements IAdaptable, Comparable<Change> { +public abstract class Change implements IAdaptable, Comparable<Change>, HasBranch { private final long sourceGamma; private final int artId; private final TransactionDelta txDelta; @@ -117,6 +118,7 @@ public abstract class Change implements IAdaptable, Comparable<Change> { return getChangeArtifact().getArtifactType(); } + @Override public IOseeBranch getBranch() { return branch; } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java index a9c19e5cf29..995fd2d1266 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/event/OseeEventManager.java @@ -16,7 +16,8 @@ import java.util.Collection; import java.util.List; import java.util.logging.Level; import org.eclipse.osee.framework.core.client.ClientSessionManager; -import org.eclipse.osee.framework.core.data.OseeBranch; +import org.eclipse.osee.framework.core.data.IOseeBranch; +import org.eclipse.osee.framework.core.data.TokenFactory; import org.eclipse.osee.framework.core.enums.CoreBranches; import org.eclipse.osee.framework.core.exception.OseeAuthenticationRequiredException; import org.eclipse.osee.framework.core.exception.OseeCoreException; @@ -246,7 +247,8 @@ public class OseeEventManager { public static List<IEventFilter> getEventFiltersForBranch(final String branchName, final String branchGuid) { try { List<IEventFilter> eventFilters = new ArrayList<IEventFilter>(2); - eventFilters.add(new BranchGuidEventFilter(new OseeBranch(branchName, branchGuid))); + IOseeBranch branchToken = TokenFactory.createBranch(branchGuid, branchName); + eventFilters.add(new BranchGuidEventFilter(branchToken)); return eventFilters; } catch (Exception ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); 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 4249f7fa016..cb686b8b409 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 @@ -24,8 +24,8 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.logging.Level; import org.eclipse.osee.framework.core.data.IRelationSorterId; import org.eclipse.osee.framework.core.data.IRelationType; +import org.eclipse.osee.framework.core.data.IRelationTypeSide; import org.eclipse.osee.framework.core.enums.DeletionFlag; -import org.eclipse.osee.framework.core.enums.IRelationEnumeration; import org.eclipse.osee.framework.core.enums.ModificationType; import org.eclipse.osee.framework.core.enums.RelationSide; import org.eclipse.osee.framework.core.enums.RelationTypeMultiplicity; @@ -161,11 +161,11 @@ public class RelationManager { return ret; } - public static Set<Artifact> getRelatedArtifacts(Collection<? extends Artifact> artifacts, int depth, IRelationEnumeration... relationEnums) throws OseeCoreException { + public static Set<Artifact> getRelatedArtifacts(Collection<? extends Artifact> artifacts, int depth, IRelationTypeSide... relationEnums) throws OseeCoreException { return getRelatedArtifacts(artifacts, depth, EXCLUDE_DELETED, relationEnums); } - public static Set<Artifact> getRelatedArtifacts(Collection<? extends Artifact> artifacts, int depth, DeletionFlag allowDeleted, IRelationEnumeration... relationEnums) throws OseeCoreException { + public static Set<Artifact> getRelatedArtifacts(Collection<? extends Artifact> artifacts, int depth, DeletionFlag allowDeleted, IRelationTypeSide... relationEnums) throws OseeCoreException { Set<Artifact> relatedArtifacts = new HashSet<Artifact>(artifacts.size() * 8); Collection<Artifact> newArtifactsToSearch = new ArrayList<Artifact>(artifacts); Collection<Artifact> newArtifacts = new ArrayList<Artifact>(); @@ -192,7 +192,7 @@ public class RelationManager { } relatedArtIds.addAll(getRelatedArtifactIds(selectedRelations, RelationSide.SIDE_B, allowDeleted)); } else { - for (IRelationEnumeration relationEnum : relationEnums) { + for (IRelationTypeSide relationEnum : relationEnums) { Collection<RelationLink> links = relationCache.getAllByType(artifact, relationEnum); if (links != null) { for (RelationLink rel : links) { @@ -221,7 +221,7 @@ public class RelationManager { return relatedArtifacts; } - public static List<Artifact> getRelatedArtifacts(Artifact artifact, IRelationEnumeration relationEnum, DeletionFlag deletionFlag) throws OseeCoreException { + public static List<Artifact> getRelatedArtifacts(Artifact artifact, IRelationTypeSide relationEnum, DeletionFlag deletionFlag) throws OseeCoreException { List<Artifact> artifacts = getRelatedArtifacts(artifact, relationEnum, relationEnum.getSide()); Collection<Integer> artIds = new ArrayList<Integer>(); @@ -253,11 +253,11 @@ public class RelationManager { return artifacts; } - public static List<Artifact> getRelatedArtifactsUnSorted(Artifact artifact, IRelationEnumeration relationEnum) throws OseeCoreException { + public static List<Artifact> getRelatedArtifactsUnSorted(Artifact artifact, IRelationTypeSide relationEnum) throws OseeCoreException { return getRelatedArtifactsUnSorted(artifact, relationEnum, relationEnum.getSide()); } - public static List<Artifact> getRelatedArtifacts(Artifact artifact, IRelationEnumeration relationEnum) throws OseeCoreException { + public static List<Artifact> getRelatedArtifacts(Artifact artifact, IRelationTypeSide relationEnum) throws OseeCoreException { return getRelatedArtifacts(artifact, relationEnum, relationEnum.getSide()); } @@ -277,11 +277,11 @@ public class RelationManager { return artifacts.get(0); } - public static Artifact getRelatedArtifact(Artifact artifact, IRelationEnumeration relationEnum) throws OseeCoreException { + public static Artifact getRelatedArtifact(Artifact artifact, IRelationTypeSide relationEnum) throws OseeCoreException { return getRelatedArtifact(artifact, relationEnum, relationEnum.getSide()); } - public static int getRelatedArtifactsCount(Artifact artifact, IRelationEnumeration relationTypeEnum) { + public static int getRelatedArtifactsCount(Artifact artifact, IRelationTypeSide relationTypeEnum) { return getRelatedArtifactsCount(artifact, relationTypeEnum, relationTypeEnum.getSide()); } 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 index d9d2df4fada..90e8f2f2b02 100644 --- 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 @@ -11,8 +11,10 @@ package org.eclipse.osee.framework.skynet.core.relation.crossbranch; import java.util.logging.Level; +import org.eclipse.osee.framework.core.data.IRelationTypeSide; +import org.eclipse.osee.framework.core.data.TokenFactory; import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; -import org.eclipse.osee.framework.core.enums.IRelationEnumeration; +import org.eclipse.osee.framework.core.enums.RelationSide; 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; @@ -28,7 +30,7 @@ public class CrossBranchLink { public Artifact artifact; public DefaultBasicGuidArtifact guidArt; - public IRelationEnumeration relationEnum; + public IRelationTypeSide relationEnum; public boolean aSide; public Attribute<?> matchingAttribute; @@ -42,7 +44,7 @@ public class CrossBranchLink { } } - public CrossBranchLink(IRelationEnumeration relationEnum, Artifact artifact) { + public CrossBranchLink(IRelationTypeSide relationEnum, Artifact artifact) { this.relationEnum = relationEnum; this.artifact = artifact; this.guidArt = artifact.getBasicGuidArtifact(); @@ -78,7 +80,9 @@ public class CrossBranchLink { String relTypeGuid = AXml.getTagData(xmlStr, "relTypeGuid"); aSide = AXml.getTagBooleanData(xmlStr, "aSide"); final RelationType relationType = RelationTypeManager.getTypeByGuid(relTypeGuid); - relationEnum = new LoadedRelationTypes(relationType, aSide); + + RelationSide side = aSide ? RelationSide.SIDE_A : RelationSide.SIDE_B; + relationEnum = TokenFactory.createRelationTypeSide(side, relationType.getGuid(), relationType.getName()); guidArt = new DefaultBasicGuidArtifact(branchGuid, artTypeGuid, artGuid); } @@ -106,7 +110,7 @@ public class CrossBranchLink { this.artifact = artifact; } - public IRelationEnumeration getRelationEnum() throws OseeCoreException { + public IRelationTypeSide getRelationEnum() throws OseeCoreException { if (relationEnum == null) { unPack(); } 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 index e843ea02b28..ecd1b87a739 100644 --- 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 @@ -13,8 +13,8 @@ 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.data.IRelationTypeSide; 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; @@ -33,14 +33,14 @@ import org.eclipse.osee.framework.skynet.core.artifact.Attribute; */ public class CrossBranchLinkManager { - public static void addRelation(Artifact artifact, IRelationEnumeration relationSide, Artifact otherArt) throws OseeCoreException { + public static void addRelation(Artifact artifact, IRelationTypeSide 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 { + public static List<Artifact> getRelatedArtifacts(Artifact artifact, IRelationTypeSide relationEnum) throws OseeCoreException { List<Artifact> artifacts = new ArrayList<Artifact>(); for (CrossBranchLink link : getLinks(artifact)) { if (link.getRelationType().equals(relationEnum) && link.aSide == relationEnum.getSide().isSideA()) { @@ -50,11 +50,11 @@ public class CrossBranchLinkManager { return artifacts; } - public static int getRelatedArtifactCount(Artifact artifact, IRelationEnumeration relationEnum) throws OseeCoreException { + public static int getRelatedArtifactCount(Artifact artifact, IRelationTypeSide relationEnum) throws OseeCoreException { return getRelatedArtifacts(artifact, relationEnum).size(); } - public static void deleteRelation(Artifact artifact, IRelationEnumeration relationSide, Artifact otherArt) throws OseeCoreException { + public static void deleteRelation(Artifact artifact, IRelationTypeSide relationSide, Artifact otherArt) throws OseeCoreException { CrossBranchLink newLink = new CrossBranchLink(relationSide, otherArt); for (CrossBranchLink link : getLinks(artifact)) { if (link.equals(newLink)) { @@ -63,7 +63,7 @@ public class CrossBranchLinkManager { } } - public static void deleteRelations(Artifact artifact, IRelationEnumeration relationSide) throws OseeCoreException { + public static void deleteRelations(Artifact artifact, IRelationTypeSide relationSide) throws OseeCoreException { for (CrossBranchLink link : getLinks(artifact)) { if (link.getRelationEnum().equals(relationSide)) { link.getMatchingAttribute().delete(); 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 deleted file mode 100644 index 6bfeffb3f66..00000000000 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/crossbranch/LoadedRelationTypes.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * 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/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 d3004cb9c78..a4800b11232 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 @@ -16,8 +16,8 @@ import java.util.Collection; import java.util.HashSet; import java.util.List; import org.eclipse.osee.framework.core.data.IRelationSorterId; +import org.eclipse.osee.framework.core.data.IRelationTypeSide; import org.eclipse.osee.framework.core.enums.DeletionFlag; -import org.eclipse.osee.framework.core.enums.IRelationEnumeration; import org.eclipse.osee.framework.core.enums.RelationOrderBaseTypes; import org.eclipse.osee.framework.core.enums.RelationSide; import org.eclipse.osee.framework.core.exception.OseeCoreException; @@ -65,7 +65,7 @@ public class RelationOrderMergeUtility { return rts; } - private static List<String> mergeTypeSideOrder(Artifact left, Artifact right, IRelationEnumeration rts) throws OseeCoreException { + private static List<String> mergeTypeSideOrder(Artifact left, Artifact right, IRelationTypeSide rts) throws OseeCoreException { RelationOrderMerger<String> merger = new RelationOrderMerger<String>(); List<String> leftRelatives = getGuidList(left.getRelatedArtifacts(rts, DeletionFlag.EXCLUDE_DELETED)); List<String> rightRelatives = getGuidList(right.getRelatedArtifacts(rts, DeletionFlag.EXCLUDE_DELETED)); @@ -74,7 +74,7 @@ public class RelationOrderMergeUtility { return merger.computeMergedOrder(leftRelatives, rightRelatives, mergedSet); } - private static Collection<String> getMergedSet(Artifact left, Artifact right, IRelationEnumeration relationTypeSide) throws OseeCoreException { + private static Collection<String> getMergedSet(Artifact left, Artifact right, IRelationTypeSide relationTypeSide) throws OseeCoreException { Collection<String> mergedSet = new HashSet<String>(); Collection<String> deleted = new HashSet<String>(); List<String> leftRelatives = @@ -99,7 +99,7 @@ public class RelationOrderMergeUtility { return toReturn; } - private static Collection<String> getDeleted(Artifact art, IRelationEnumeration relationType) throws OseeCoreException { + private static Collection<String> getDeleted(Artifact art, IRelationTypeSide relationType) throws OseeCoreException { Collection<String> toReturn = new HashSet<String>(); for (RelationLink link : art.getRelationsAll(DeletionFlag.INCLUDE_DELETED)) { |