diff options
author | Ryan D. Brooks | 2016-09-21 22:22:43 +0000 |
---|---|---|
committer | donald.g.dunne | 2016-09-21 22:22:43 +0000 |
commit | d21694db35a98f1f01679556477425304567a871 (patch) | |
tree | 74cebcf92961b93373274f844d6bd53343fdcfc6 /plugins | |
parent | fbef1334d71b86630cdae4f83ca5c18b0c50d88f (diff) | |
download | org.eclipse.osee-d21694db35a98f1f01679556477425304567a871.tar.gz org.eclipse.osee-d21694db35a98f1f01679556477425304567a871.tar.xz org.eclipse.osee-d21694db35a98f1f01679556477425304567a871.zip |
refactor: Remove usage of IArtifact in IRelationSorter
Change-Id: Ib1083dee0937d46ed163b228d1394e7c011d6cf9
Diffstat (limited to 'plugins')
11 files changed, 28 insertions, 39 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ExportChangeReportOperation.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ExportChangeReportOperation.java index a490b40e64a..f45630fd96f 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ExportChangeReportOperation.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/ExportChangeReportOperation.java @@ -49,7 +49,6 @@ import org.eclipse.osee.framework.skynet.core.change.ArtifactDelta; import org.eclipse.osee.framework.skynet.core.change.Change; import org.eclipse.osee.framework.skynet.core.revision.ChangeManager; import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; -import org.eclipse.osee.framework.skynet.core.types.IArtifact; import org.eclipse.osee.framework.ui.skynet.render.RendererManager; import org.eclipse.osee.framework.ui.skynet.render.compare.CompareData; import org.eclipse.osee.framework.ui.skynet.render.compare.CompareDataCollector; @@ -203,7 +202,7 @@ public final class ExportChangeReportOperation extends AbstractOperation { return changes; } - private TransactionToken pickTransaction(IArtifact workflow) throws OseeCoreException { + private TransactionToken pickTransaction(ArtifactId workflow) throws OseeCoreException { TransactionToken minTransactionId = TransactionToken.SENTINEL; for (TransactionToken transaction : TransactionManager.getCommittedArtifactTransactionIds(workflow)) { if (minTransactionId.isOlderThan(transaction) && !BranchManager.isArchived(transaction.getBranch())) { diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/ArtifactPasteOperationTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/ArtifactPasteOperationTest.java index 6fd18b240cc..124d7d97a5c 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/ArtifactPasteOperationTest.java +++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/ArtifactPasteOperationTest.java @@ -163,7 +163,7 @@ public class ArtifactPasteOperationTest { List<Artifact> sourceChildren = parent1.getChildren(); List<String> guids = Artifacts.toGuids(sourceChildren); for (int index = 0; index < names.length; index++) { - IArtifact childArtifact = childArtifacts.get(index); + Artifact childArtifact = childArtifacts.get(index); Assert.assertEquals(names[index], childArtifact.getName()); Assert.assertTrue(!guids.contains(childArtifact.getGuid())); } @@ -192,7 +192,7 @@ public class ArtifactPasteOperationTest { if (hasChildren && expectedOrderType == USER_DEFINED) { Assert.assertEquals(childArtifacts.size(), guids.size()); for (int index = 0; index < guids.size(); index++) { - IArtifact orderedChild = childArtifacts.get(index); + Artifact orderedChild = childArtifacts.get(index); String guid = guids.get(index); Assert.assertEquals(orderedChild.getGuid(), guid); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactKey.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactKey.java index f6d964e3f15..9e22a733b37 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactKey.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactKey.java @@ -10,30 +10,29 @@ *******************************************************************************/ package org.eclipse.osee.framework.skynet.core.artifact; +import org.eclipse.osee.framework.core.data.ArtifactToken; import org.eclipse.osee.framework.core.data.BranchId; -import org.eclipse.osee.framework.skynet.core.types.IArtifact; public final class ArtifactKey { - private int artId; + private Long artId; private BranchId branch; - public ArtifactKey(IArtifact artifact) { - this.artId = artifact.getArtId(); + public ArtifactKey(ArtifactToken artifact) { + this.artId = artifact.getId(); this.branch = artifact.getBranch(); } public ArtifactKey() { - } - public ArtifactKey setKey(IArtifact artifact) { - this.artId = artifact.getArtId(); + public ArtifactKey setKey(ArtifactToken artifact) { + this.artId = artifact.getId(); this.branch = artifact.getBranch(); return this; } - public ArtifactKey setKey(int artId, BranchId branch) { + public ArtifactKey setKey(Long artId, BranchId branch) { this.artId = artId; this.branch = branch; return this; @@ -41,11 +40,7 @@ public final class ArtifactKey { @Override public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + artId; - result = prime * result + String.valueOf(branch.getUuid()).hashCode(); - return result; + return 31 * artId.hashCode() + branch.hashCode(); } @Override @@ -60,16 +55,12 @@ public final class ArtifactKey { return false; } ArtifactKey other = (ArtifactKey) obj; - if (artId != other.artId) { + if (!artId.equals(other.artId)) { return false; } - if (!branch.equals(other.branch)) { + if (branch.notEqual(other.branch)) { return false; } return true; } - - public BranchId getBranch() { - return branch; - } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactNameComparator.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactNameComparator.java index afadceea47a..47ffa896c95 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactNameComparator.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactNameComparator.java @@ -13,9 +13,9 @@ package org.eclipse.osee.framework.skynet.core.artifact; import java.util.Comparator; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.eclipse.osee.framework.skynet.core.types.IArtifact; +import org.eclipse.osee.framework.core.data.ArtifactToken; -public class ArtifactNameComparator implements Comparator<IArtifact> { +public class ArtifactNameComparator implements Comparator<ArtifactToken> { private static final Pattern numberPattern = Pattern.compile("[+-]?\\d+"); private final Matcher numberMatcher = numberPattern.matcher(""); private boolean descending = false; @@ -26,7 +26,7 @@ public class ArtifactNameComparator implements Comparator<IArtifact> { } @Override - public int compare(IArtifact artifact1, IArtifact artifact2) { + public int compare(ArtifactToken artifact1, ArtifactToken artifact2) { String name1 = artifact1.getName(); String name2 = artifact2.getName(); 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 e71880b7c0f..88f0282523d 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 @@ -51,7 +51,7 @@ public class RelationCache { return key.setKey(artifact); } - private ArtifactKey getKey(int artId, BranchId branchUuid) { + private ArtifactKey getKey(long artId, BranchId branchUuid) { ArtifactKey key = THREAD_SHARED_KEY.get(); return key.setKey(artId, branchUuid); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/IRelationSorter.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/IRelationSorter.java index f30af5718d1..fa5fdc6ddea 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/IRelationSorter.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/order/IRelationSorter.java @@ -11,8 +11,8 @@ package org.eclipse.osee.framework.skynet.core.relation.order; import java.util.List; +import org.eclipse.osee.framework.core.data.ArtifactToken; import org.eclipse.osee.framework.core.enums.RelationSorter; -import org.eclipse.osee.framework.skynet.core.types.IArtifact; /** * @author Andrew M. Finkbeiner @@ -21,5 +21,5 @@ public interface IRelationSorter { RelationSorter getSorterId(); - void sort(List<? extends IArtifact> relatives, List<String> relativeSequence); + void sort(List<? extends ArtifactToken> relatives, List<String> relativeSequence); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/sorters/LexicographicalRelationSorter.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/sorters/LexicographicalRelationSorter.java index 3a99573ebb6..6ec342b0ab9 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/sorters/LexicographicalRelationSorter.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/sorters/LexicographicalRelationSorter.java @@ -14,10 +14,10 @@ import static org.eclipse.osee.framework.core.enums.RelationSorter.LEXICOGRAPHIC import static org.eclipse.osee.framework.core.enums.RelationSorter.LEXICOGRAPHICAL_DESC; import java.util.Collections; import java.util.List; +import org.eclipse.osee.framework.core.data.ArtifactToken; import org.eclipse.osee.framework.core.enums.RelationSorter; import org.eclipse.osee.framework.skynet.core.artifact.ArtifactNameComparator; import org.eclipse.osee.framework.skynet.core.relation.order.IRelationSorter; -import org.eclipse.osee.framework.skynet.core.types.IArtifact; /** * @author Andrew M. Finkbeiner @@ -44,7 +44,7 @@ public class LexicographicalRelationSorter implements IRelationSorter { } @Override - public void sort(List<? extends IArtifact> relatives, List<String> relativeSequence) { + public void sort(List<? extends ArtifactToken> relatives, List<String> relativeSequence) { Collections.sort(relatives, comparator); } } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/sorters/UnorderedRelationSorter.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/sorters/UnorderedRelationSorter.java index 8d4950abf3f..a4b90332b14 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/sorters/UnorderedRelationSorter.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/sorters/UnorderedRelationSorter.java @@ -12,9 +12,9 @@ package org.eclipse.osee.framework.skynet.core.relation.sorters; import static org.eclipse.osee.framework.core.enums.RelationSorter.UNORDERED; import java.util.List; +import org.eclipse.osee.framework.core.data.ArtifactToken; import org.eclipse.osee.framework.core.enums.RelationSorter; import org.eclipse.osee.framework.skynet.core.relation.order.IRelationSorter; -import org.eclipse.osee.framework.skynet.core.types.IArtifact; /** * @author Andrew M. Finkbeiner @@ -27,7 +27,7 @@ public class UnorderedRelationSorter implements IRelationSorter { } @Override - public void sort(List<? extends IArtifact> relatives, List<String> relativeSequence) { + public void sort(List<? extends ArtifactToken> relatives, List<String> relativeSequence) { // do nothing } } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/sorters/UserDefinedOrderComparator.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/sorters/UserDefinedOrderComparator.java index eafd5557595..83146d98d0d 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/sorters/UserDefinedOrderComparator.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/sorters/UserDefinedOrderComparator.java @@ -14,12 +14,12 @@ import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.eclipse.osee.framework.skynet.core.types.IArtifact; +import org.eclipse.osee.framework.core.data.ArtifactToken; /** * @author Andrew M. Finkbeiner */ -class UserDefinedOrderComparator implements Comparator<IArtifact> { +class UserDefinedOrderComparator implements Comparator<ArtifactToken> { private final Map<String, Integer> value; @@ -31,7 +31,7 @@ class UserDefinedOrderComparator implements Comparator<IArtifact> { } @Override - public int compare(IArtifact artifact1, IArtifact artifact2) { + public int compare(ArtifactToken artifact1, ArtifactToken artifact2) { Integer val1 = value.get(artifact1.getGuid()); Integer val2 = value.get(artifact2.getGuid()); if (val1 == null) { diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/sorters/UserDefinedRelationSorter.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/sorters/UserDefinedRelationSorter.java index 998e4c0bbb0..572fdaa0989 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/sorters/UserDefinedRelationSorter.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/relation/sorters/UserDefinedRelationSorter.java @@ -13,9 +13,9 @@ package org.eclipse.osee.framework.skynet.core.relation.sorters; import static org.eclipse.osee.framework.core.enums.RelationSorter.USER_DEFINED; import java.util.Collections; import java.util.List; +import org.eclipse.osee.framework.core.data.ArtifactToken; import org.eclipse.osee.framework.core.enums.RelationSorter; import org.eclipse.osee.framework.skynet.core.relation.order.IRelationSorter; -import org.eclipse.osee.framework.skynet.core.types.IArtifact; /** * @author Andrew M. Finkbeiner @@ -28,7 +28,7 @@ public class UserDefinedRelationSorter implements IRelationSorter { } @Override - public void sort(List<? extends IArtifact> relatives, List<String> relativeSequence) { + public void sort(List<? extends ArtifactToken> relatives, List<String> relativeSequence) { if (relatives.size() > 1) { Collections.sort(relatives, new UserDefinedOrderComparator(relativeSequence)); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/types/IArtifact.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/types/IArtifact.java index 8242363e330..9bbac5d23ce 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/types/IArtifact.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/types/IArtifact.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.osee.framework.skynet.core.types; -import org.eclipse.osee.framework.core.data.RelationTypeSide; import org.eclipse.osee.framework.core.model.IBasicArtifact; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; |