Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2017-06-28 18:33:48 -0400
committerRyan Brooks2017-07-26 14:34:16 -0400
commit009539d24eda00e4a82328e370e0a1c18c878730 (patch)
treea494454f4bda7d0dfe0a0a6f488bcf1ba0a0e0d0
parent8af038cdaed76f60484b44770b6a226411341c1e (diff)
downloadorg.eclipse.osee-009539d24eda00e4a82328e370e0a1c18c878730.tar.gz
org.eclipse.osee-009539d24eda00e4a82328e370e0a1c18c878730.tar.xz
org.eclipse.osee-009539d24eda00e4a82328e370e0a1c18c878730.zip
refactor: Use ArtifactId in ArtifactQuery.getHistoricalArtifactFromId
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/AtsTaskToChangedArtifactReferenceAttributeAdapter.java9
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java4
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/ViewWordChangeAndDiffTest.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java25
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionManager.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceArtifactWithBaselineOperation.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/menu/CompareArtifactAction.java3
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java8
8 files changed, 19 insertions, 36 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/AtsTaskToChangedArtifactReferenceAttributeAdapter.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/AtsTaskToChangedArtifactReferenceAttributeAdapter.java
index 0473a99177..1523f9120d 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/AtsTaskToChangedArtifactReferenceAttributeAdapter.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/AtsTaskToChangedArtifactReferenceAttributeAdapter.java
@@ -18,6 +18,7 @@ import org.eclipse.osee.ats.api.data.AtsRelationTypes;
import org.eclipse.osee.ats.core.client.task.TaskArtifact;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.internal.AtsClientService;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.TransactionToken;
@@ -48,9 +49,9 @@ public class AtsTaskToChangedArtifactReferenceAttributeAdapter implements Attrib
public Artifact adapt(Attribute<?> attribute, Id identity) throws OseeCoreException {
Artifact retArt = null;
- int uuid = identity.getId() <= 0 ? 0 : identity.getId().intValue();
- if (uuid > 0) {
+ if (identity.isValid()) {
Artifact artifact = attribute.getArtifact();
+ ArtifactId refArtifact = ArtifactId.valueOf(identity.getId());
if (artifact instanceof TaskArtifact) {
TaskArtifact taskArt = (TaskArtifact) artifact;
TeamWorkFlowArtifact parentTeamWf = taskArt.getParentTeamWorkflow();
@@ -60,14 +61,14 @@ public class AtsTaskToChangedArtifactReferenceAttributeAdapter implements Attrib
// First, attempt to get from Working Branch if still exists
BranchId workingBranch = AtsClientService.get().getBranchService().getWorkingBranch(derivedTeamWf);
if (workingBranch != null && branchIsInWork(workingBranch)) {
- retArt = ArtifactQuery.getArtifactFromId(uuid, workingBranch, DeletionFlag.INCLUDE_DELETED);
+ retArt = ArtifactQuery.getArtifactFromId(refArtifact, workingBranch, DeletionFlag.INCLUDE_DELETED);
} else {
// Else get from first commit transaction
// NOTE: Each workflow has it's own commit in parallel dev
TransactionToken earliestTransactionId =
AtsClientService.get().getBranchService().getEarliestTransactionId(derivedTeamWf);
if (earliestTransactionId != null) {
- retArt = ArtifactQuery.getHistoricalArtifactFromIdOrNull(uuid, earliestTransactionId,
+ retArt = ArtifactQuery.getHistoricalArtifactOrNull(refArtifact, earliestTransactionId,
DeletionFlag.INCLUDE_DELETED);
}
}
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java
index 7e46367e12..223c839b42 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java
@@ -241,7 +241,7 @@ public class ArtifactQueryTest {
ArtifactCache.deCache(toCheck);
Assert.assertNotNull(
- ArtifactQuery.checkHistoricalArtifactFromId(firstCreated, beforeDelete, DeletionFlag.EXCLUDE_DELETED));
+ ArtifactQuery.getHistoricalArtifactOrNull(firstCreated, beforeDelete, DeletionFlag.EXCLUDE_DELETED));
}
@Test
@@ -311,7 +311,7 @@ public class ArtifactQueryTest {
// load historical artifact; this should return as changed cause of new attribute
Artifact historicalArtifactFromId =
- ArtifactQuery.getHistoricalArtifactFromId(folder.getArtId(), transaction, DeletionFlag.EXCLUDE_DELETED);
+ ArtifactQuery.getHistoricalArtifactFromId(folder, transaction, DeletionFlag.EXCLUDE_DELETED);
Assert.assertTrue(ArtifactQuery.isArtifactChangedViaEntries(historicalArtifactFromId));
transaction = folder.getTransaction();
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/ViewWordChangeAndDiffTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/ViewWordChangeAndDiffTest.java
index c890404161..82315dd68a 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/ViewWordChangeAndDiffTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/ViewWordChangeAndDiffTest.java
@@ -151,7 +151,7 @@ public final class ViewWordChangeAndDiffTest {
}
private static Artifact loadHistorical(Artifact artifact) throws OseeCoreException {
- return ArtifactQuery.getHistoricalArtifactFromId(artifact.getArtId(), artifact.getTransaction(), INCLUDE_DELETED);
+ return ArtifactQuery.getHistoricalArtifactFromId(artifact, artifact.getTransaction(), INCLUDE_DELETED);
}
private static void checkPermissions(List<Artifact> artifacts) 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 3aeae0f1bf..a812ab2525 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
@@ -310,22 +310,12 @@ public class ArtifactQuery {
return new ArtifactQueryBuilder(artifactIds, transactionId, allowDeleted, ALL).getArtifacts(30, null);
}
- public static Artifact getHistoricalArtifactFromId(int artifactId, TransactionToken transactionId, DeletionFlag allowDeleted) throws OseeCoreException {
- return getHistoricalArtifactFromId(ArtifactId.valueOf(artifactId), transactionId, allowDeleted);
- }
-
public static Artifact getHistoricalArtifactFromId(ArtifactId artifactId, TransactionToken transactionId, DeletionFlag allowDeleted) throws OseeCoreException {
return new ArtifactQueryBuilder(artifactId, transactionId, allowDeleted, ALL).getOrCheckArtifact(QueryType.GET);
}
- public static Artifact getHistoricalArtifactFromIdOrNull(int artifactId, TransactionToken transactionId, DeletionFlag allowDeleted) throws OseeCoreException {
- try {
- return new ArtifactQueryBuilder(ArtifactId.valueOf(artifactId), transactionId, allowDeleted,
- ALL).getOrCheckArtifact(QueryType.GET);
- } catch (ArtifactDoesNotExist ex) {
- // do nothing
- }
- return null;
+ public static Artifact getHistoricalArtifactOrNull(ArtifactId artifactId, TransactionToken transactionId, DeletionFlag allowDeleted) {
+ return new ArtifactQueryBuilder(artifactId, transactionId, allowDeleted, ALL).getOrCheckArtifact(QueryType.CHECK);
}
public static Artifact getHistoricalArtifactFromId(String guid, TransactionToken transactionId, DeletionFlag allowDeleted) throws OseeCoreException {
@@ -333,15 +323,6 @@ public class ArtifactQuery {
QueryType.GET);
}
- public static Artifact checkHistoricalArtifactFromId(Artifact artifactId, TransactionToken transactionId, DeletionFlag allowDeleted) throws OseeCoreException {
- return new ArtifactQueryBuilder(artifactId, transactionId, allowDeleted, ALL).getOrCheckArtifact(QueryType.CHECK);
- }
-
- public static Artifact checkHistoricalArtifactFromId(String guid, TransactionToken transactionId, DeletionFlag allowDeleted) throws OseeCoreException {
- return new ArtifactQueryBuilder(Arrays.asList(guid), transactionId, allowDeleted, ALL).getOrCheckArtifact(
- QueryType.CHECK);
- }
-
public static List<Artifact> getArtifactListFromName(String artifactName, BranchId branch, DeletionFlag allowDeleted, QueryOption... options) throws OseeCoreException {
return new ArtifactQueryBuilder(branch, ALL, allowDeleted,
new AttributeCriteria(CoreAttributeTypes.Name, artifactName, options)).getArtifacts(30, null);
@@ -815,7 +796,7 @@ public class ArtifactQuery {
private static List<ArtifactToken> extractTokensFromQuery(JdbcStatement chStmt) {
List<ArtifactToken> tokens = new LinkedList<>();
while (chStmt.next()) {
- Integer artId = chStmt.getInt("art_id");
+ Long artId = chStmt.getLong("art_id");
Long artTypeId = chStmt.getLong("art_type_id");
String name = chStmt.getString("value");
String guid = chStmt.getString("guid");
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionManager.java
index 14b07f92cf..5c8bcd02af 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/TransactionManager.java
@@ -290,7 +290,7 @@ public final class TransactionManager {
}
TransactionId prevTransId = getPreviousTransactionId(art, revertTransaction);
- Artifact prevArt = ArtifactQuery.getHistoricalArtifactFromId(art.getId().intValue(),
+ Artifact prevArt = ArtifactQuery.getHistoricalArtifactFromId(art,
TransactionToken.valueOf(prevTransId, art.getBranch()), DeletionFlag.EXCLUDE_DELETED);
boolean changed = false;
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceArtifactWithBaselineOperation.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceArtifactWithBaselineOperation.java
index 6e12e046d5..fab80f3a8f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceArtifactWithBaselineOperation.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/ReplaceArtifactWithBaselineOperation.java
@@ -61,7 +61,7 @@ public class ReplaceArtifactWithBaselineOperation extends AbstractOperation {
monitor.subTask("Reverting: " + artifact.getName());
monitor.worked(1);
Artifact sourceArtifact =
- ArtifactQuery.checkHistoricalArtifactFromId(artifact, txRecord, DeletionFlag.INCLUDE_DELETED);
+ ArtifactQuery.getHistoricalArtifactOrNull(artifact, txRecord, DeletionFlag.INCLUDE_DELETED);
try {
if (sourceArtifact != null) {
String userId = ClientSessionManager.getCurrentUserToken().getUserId();
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/menu/CompareArtifactAction.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/menu/CompareArtifactAction.java
index 298a508a3d..fabb8d5bbd 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/menu/CompareArtifactAction.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/menu/CompareArtifactAction.java
@@ -17,6 +17,7 @@ import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.TransactionToken;
import org.eclipse.osee.framework.core.enums.DeletionFlag;
import org.eclipse.osee.framework.core.enums.PresentationType;
@@ -106,7 +107,7 @@ public final class CompareArtifactAction extends Action {
Conditions.checkExpressionFailOnTrue(!changeA.getArtId().equals(changeB.getArtId()),
"Change art ids don't match [%s:%s]", changeA.getArtId(), changeB.getArtId());
- int artId = changeA.getArtId().getId().intValue();
+ ArtifactId artId = changeA.getArtId();
TransactionDelta txDelta = asTxDelta(changeA, changeB);
Artifact startArtifact =
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java
index 5cb058621b..ef73c183de 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/xmerge/MergeUtility.java
@@ -151,8 +151,8 @@ public class MergeUtility {
try {
if (Conditions.notNull(conflict.getSourceBranch())) {
TransactionToken baseTransaction = BranchManager.getBaseTransaction(conflict.getSourceBranch());
- toReturn = ArtifactQuery.getHistoricalArtifactFromId(conflict.getArtifact().getGuid(), baseTransaction,
- INCLUDE_DELETED);
+ toReturn =
+ ArtifactQuery.getHistoricalArtifactFromId(conflict.getArtifact(), baseTransaction, INCLUDE_DELETED);
}
} catch (OseeCoreException ex) {
OseeLog.log(Activator.class, Level.SEVERE, ex);
@@ -166,8 +166,8 @@ public class MergeUtility {
if (Conditions.notNull(conflict.getSourceBranch())) {
TransactionToken commonTransaction =
ConflictManagerInternal.findCommonTransaction(conflict.getSourceBranch(), conflict.getDestBranch());
- toReturn = ArtifactQuery.getHistoricalArtifactFromId(conflict.getArtifact().getGuid(), commonTransaction,
- INCLUDE_DELETED);
+ toReturn =
+ ArtifactQuery.getHistoricalArtifactFromId(conflict.getArtifact(), commonTransaction, INCLUDE_DELETED);
}
} catch (OseeCoreException ex) {
OseeLog.log(Activator.class, Level.SEVERE, ex);

Back to the top