Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2019-06-06 15:34:54 +0000
committerRyan D. Brooks2020-12-15 22:28:14 +0000
commit8cedb0599dcc5bde136fbf9eb0d6a8360b3cbdfb (patch)
tree82c9f3054103907c1149bba720df7137ac9fa8d8
parent011a942c202c62dddb3d0e9a20cf133f327a0fc9 (diff)
downloadorg.eclipse.osee-8cedb0599dcc5bde136fbf9eb0d6a8360b3cbdfb.tar.gz
org.eclipse.osee-8cedb0599dcc5bde136fbf9eb0d6a8360b3cbdfb.tar.xz
org.eclipse.osee-8cedb0599dcc5bde136fbf9eb0d6a8360b3cbdfb.zip
refactor: Use Long with transaction art ids
-rw-r--r--plugins/org.eclipse.osee.ats.ide.integration.tests/src/org/eclipse/osee/ats/ide/integration/tests/ats/branch/AtsBranchServiceImplTest.java2
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsBranchServiceImpl.java2
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/ArtifactRendererTest.java4
-rw-r--r--plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockDataFactory.java13
-rw-r--r--plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/type/TransactionRecordTest.java28
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecord.java12
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseBranchAccessor.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java2
-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.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphLoader.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/StubBranchModel.java2
-rw-r--r--plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/TxData.java6
12 files changed, 29 insertions, 48 deletions
diff --git a/plugins/org.eclipse.osee.ats.ide.integration.tests/src/org/eclipse/osee/ats/ide/integration/tests/ats/branch/AtsBranchServiceImplTest.java b/plugins/org.eclipse.osee.ats.ide.integration.tests/src/org/eclipse/osee/ats/ide/integration/tests/ats/branch/AtsBranchServiceImplTest.java
index b3cc4ccc724..1a1512ee53b 100644
--- a/plugins/org.eclipse.osee.ats.ide.integration.tests/src/org/eclipse/osee/ats/ide/integration/tests/ats/branch/AtsBranchServiceImplTest.java
+++ b/plugins/org.eclipse.osee.ats.ide.integration.tests/src/org/eclipse/osee/ats/ide/integration/tests/ats/branch/AtsBranchServiceImplTest.java
@@ -128,7 +128,7 @@ public class AtsBranchServiceImplTest {
//Test TxRecords
TransactionRecord txRecord = new TransactionRecord(1234L, SAW_Bld_1, "comment", new Date(0),
- UserManager.getUser(), UserManager.getUser().getArtId(), TransactionDetailsType.Baselined, 0L);
+ UserManager.getUser(), UserManager.getUser().getId(), TransactionDetailsType.Baselined, 0L);
Collection<TransactionRecord> commitTxs = new ArrayList<>();
Collection<CommitConfigItem> configItems = new HashSet<>();
commitTxs.add(txRecord);
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsBranchServiceImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsBranchServiceImpl.java
index 52ce4fb8982..884db62be63 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsBranchServiceImpl.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsBranchServiceImpl.java
@@ -139,7 +139,7 @@ public class AtsBranchServiceImpl extends AbstractAtsBranchService {
txQuery.andCommitId(teamWf.getArtifactId());
txQuery.getResults().forEach(
tx -> commitArtifactIdMap.put(artId, new TransactionRecord(tx.getId(), tx.getBranch(), tx.getComment(),
- tx.getDate(), tx.getAuthor(), tx.getCommitArt().getId().intValue(), tx.getTxType(), tx.getBuildId())));
+ tx.getDate(), tx.getAuthor(), tx.getCommitArt().getId(), tx.getTxType(), tx.getBuildId())));
}
return commitArtifactIdMap.safeGetValues(artId);
}
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/ArtifactRendererTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/ArtifactRendererTest.java
index 31e8f77c153..2c4e239b052 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/ArtifactRendererTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/ArtifactRendererTest.java
@@ -66,13 +66,13 @@ public class ArtifactRendererTest {
String comment1 = getClass().getSimpleName() + "_1";
artifact1.persist(comment1);
endTx1 = TransactionManager.getTransaction(comment1).iterator().next();
- endTx1.setCommit(artifact1.getArtId());
+ endTx1.setCommit((long) artifact1.getArtId());
artifact2 = new Artifact(CoreBranches.COMMON, NAME2);
String comment2 = getClass().getSimpleName() + "_2";
artifact2.persist(comment2);
endTx2 = TransactionManager.getTransaction(comment2).iterator().next();
- endTx2.setCommit(artifact2.getArtId());
+ endTx2.setCommit((long) artifact2.getArtId());
}
@Test
diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockDataFactory.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockDataFactory.java
index 83a16530029..27765a67091 100644
--- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockDataFactory.java
+++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockDataFactory.java
@@ -13,13 +13,10 @@
package org.eclipse.osee.framework.core.model.mocks;
-import java.util.Date;
import org.eclipse.osee.framework.core.access.AccessDetail;
import org.eclipse.osee.framework.core.access.Scope;
-import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.DemoUsers;
import org.eclipse.osee.framework.core.enums.PermissionEnum;
-import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
import org.eclipse.osee.framework.core.model.TransactionRecord;
/**
@@ -40,15 +37,5 @@ public final class MockDataFactory {
return target;
}
- public static TransactionRecord createTransaction(int index, long branchUuid) {
- TransactionDetailsType type =
- TransactionDetailsType.values[Math.abs(index % TransactionDetailsType.values.length)];
- int value = index;
- if (value == 0) {
- value++;
- }
- IOseeBranch branch = IOseeBranch.create(branchUuid, "fake test branch");
- return new TransactionRecord(value * 47L, branch, "comment_" + value, new Date(), DemoUsers.Joe_Smith, value * 42,
- type, 0L);
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/type/TransactionRecordTest.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/type/TransactionRecordTest.java
index cb14fdd57b3..3b192729cc9 100644
--- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/type/TransactionRecordTest.java
+++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/type/TransactionRecordTest.java
@@ -20,9 +20,9 @@ import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.data.UserId;
import org.eclipse.osee.framework.core.enums.DemoUsers;
+import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.model.mocks.MockDataFactory;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.junit.Assert;
import org.junit.Test;
@@ -46,9 +46,9 @@ public class TransactionRecordTest {
private final String comment;
private final Date time;
private final UserId author;
- private final int commitArtId;
+ private final Long commitArtId;
- public TransactionRecordTest(int transactionNumber, BranchId branch, String comment, Date time, UserId author, int commitArtId, TransactionDetailsType txType) {
+ public TransactionRecordTest(int transactionNumber, BranchId branch, String comment, Date time, UserId author, Long commitArtId, TransactionDetailsType txType) {
this.transactionNumber = (long) transactionNumber;
this.branch = branch;
this.comment = comment;
@@ -112,27 +112,23 @@ public class TransactionRecordTest {
public void testGetSetCommit() {
Assert.assertEquals(commitArtId, transaction.getCommit());
- transaction.setCommit(commitArtId * 333);
- Assert.assertEquals(commitArtId * 333, transaction.getCommit());
+ Long otherId = commitArtId * 333;
+ transaction.setCommit(otherId);
+ Assert.assertEquals(otherId, transaction.getCommit());
transaction.setCommit(commitArtId);
}
@Test
public void testEqualsAndHashCode() {
- TransactionRecord tx2 = MockDataFactory.createTransaction(99, 2);
- TransactionId tx1 = TransactionId.valueOf(tx2.getId());
-
// Add some variation to tx2 so we are certain that only the txId is used in the equals method;
- tx2.setAuthor(UserId.SENTINEL);
- tx2.setComment("a");
- tx2.setCommit(1);
- tx2.setTimeStamp(new Date(11111111111L));
+ TransactionRecord tx2 =
+ new TransactionRecord(99L, CoreBranches.COMMON, "a", new Date(), 0L, 1L, TransactionDetailsType.Baselined);
+ TransactionId tx1 = TransactionId.valueOf(tx2.getId());
Assert.assertNotSame(tx1, tx2);
-
- Assert.assertTrue(tx1.equals(tx2));
- Assert.assertTrue(tx2.equals(tx1));
+ Assert.assertEquals(tx1, tx2);
+ Assert.assertEquals(tx2, tx1);
Assert.assertEquals(tx1.hashCode(), tx2.hashCode());
Assert.assertFalse(transaction.equals(tx1));
@@ -161,7 +157,7 @@ public class TransactionRecordTest {
BranchId branch = BranchId.valueOf(index * 9L);
String comment = GUID.create();
Date time = new Date();
- int commitArtId = index * 37;
+ Long commitArtId = index * 37L;
TransactionDetailsType txType = TransactionDetailsType.valueOf(index % TransactionDetailsType.values.length);
data.add(new Object[] {transactionNumber, branch, comment, time, DemoUsers.Joe_Smith, commitArtId, txType});
}
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecord.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecord.java
index fe7ce0984d3..b1b05465b97 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecord.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/TransactionRecord.java
@@ -14,9 +14,7 @@
package org.eclipse.osee.framework.core.model;
import java.util.Date;
-import org.eclipse.osee.framework.core.data.Adaptable;
import org.eclipse.osee.framework.core.data.BranchId;
-import org.eclipse.osee.framework.core.data.TransactionToken;
import org.eclipse.osee.framework.core.data.UserId;
import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
import org.eclipse.osee.framework.jdk.core.type.BaseId;
@@ -28,16 +26,16 @@ import org.eclipse.osee.framework.jdk.core.util.Strings;
*/
public class TransactionRecord extends BaseId implements TransactionToken, Adaptable {
public static TransactionRecord SENTINEL = new TransactionRecord(Id.SENTINEL, BranchId.SENTINEL, null, null,
- UserId.SENTINEL, 0, TransactionDetailsType.INVALID, 0L);
+ UserId.SENTINEL, 0L, TransactionDetailsType.INVALID, 0L);
private final TransactionDetailsType txType;
private final BranchId branch;
private String comment;
private Date time;
private UserId authorArtId;
- private int commitArtId;
+ private Long commitArtId;
private Long buildId;
- public TransactionRecord(Long id, BranchId branch, String comment, Date time, UserId authorArtId, int commitArtId, TransactionDetailsType txType, Long buildId) {
+ public TransactionRecord(Long id, BranchId branch, String comment, Date time, UserId authorArtId, Long commitArtId, TransactionDetailsType txType, Long buildId) {
super(id);
this.branch = branch;
this.buildId = buildId;
@@ -65,7 +63,7 @@ public class TransactionRecord extends BaseId implements TransactionToken, Adapt
return authorArtId;
}
- public int getCommit() {
+ public Long getCommit() {
return commitArtId;
}
@@ -85,7 +83,7 @@ public class TransactionRecord extends BaseId implements TransactionToken, Adapt
this.authorArtId = authorArtId;
}
- public void setCommit(int commitArtId) {
+ public void setCommit(Long commitArtId) {
this.commitArtId = commitArtId;
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseBranchAccessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseBranchAccessor.java
index 40db541d537..8a8c848b023 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseBranchAccessor.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseBranchAccessor.java
@@ -143,7 +143,7 @@ public class DatabaseBranchAccessor implements IOseeDataAccessor<Branch> {
String comment = stmt.getString(base ? "b_osee_comment" : "p_osee_comment");
Date timestamp = stmt.getTimestamp(base ? "b_time" : "p_time");
UserId authorArtId = UserId.valueOf(stmt.getLong(base ? "b_author" : "p_author"));
- Integer commitArtId = stmt.getInt(base ? "b_commit_art_id" : "p_commit_art_id");
+ Long commitArtId = stmt.getLong(base ? "b_commit_art_id" : "p_commit_art_id");
TransactionDetailsType txType = TransactionDetailsType.valueOf(stmt.getInt(base ? "b_tx_type" : "p_tx_type"));
Long txBuildId = stmt.getLong(base ? "b_tx_build_id" : "p_tx_build_id");
return new TransactionRecord(transactionId, branch, comment, timestamp, authorArtId, commitArtId, txType,
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java
index 17764279c98..b1b2694e3c3 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/transaction/SkynetTransaction.java
@@ -438,7 +438,7 @@ public final class SkynetTransaction extends TransactionOperation<BranchId> {
//keep transaction id's sequential in the face of concurrent transaction by multiple users
Long txId = ConnectionHandler.getNextSequence("SKYNET_TRANSACTION_ID_SEQ", false);
- return new TransactionRecord(txId, branch, comment, timestamp, userToBlame, 0, txType,
+ return new TransactionRecord(txId, branch, comment, timestamp, userToBlame, 0L, txType,
OseeCodeVersion.getVersionId());
}
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 903c2d9d322..67a804d0e97 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
@@ -192,7 +192,7 @@ public final class TransactionManager {
String comment = stmt.getString("osee_comment");
Date timestamp = stmt.getTimestamp("time");
UserId authorArtId = UserId.valueOf(stmt.getLong("author"));
- Integer commitArtId = stmt.getInt("commit_art_id");
+ Long commitArtId = stmt.getLong("commit_art_id");
Long buildId = stmt.getLong("build_id");
TransactionDetailsType txType = TransactionDetailsType.valueOf(stmt.getInt("tx_type"));
return new TransactionRecord(transactionNumber, branch, comment, timestamp, authorArtId, commitArtId, txType,
diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphLoader.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphLoader.java
index ef3d202639b..f3554147fdf 100644
--- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphLoader.java
+++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/GraphLoader.java
@@ -158,7 +158,7 @@ public class GraphLoader {
BranchId branch = BranchId.valueOf(chStmt.getLong("branch_id"));
TxData txData = new TxData(branch, UserId.valueOf(chStmt.getLong("author")), chStmt.getTimestamp("time"),
chStmt.getString("osee_comment"), TransactionDetailsType.valueOf(chStmt.getInt("tx_type")),
- chStmt.getInt("commit_art_id"), chStmt.getLong("transaction_id"));
+ chStmt.getLong("commit_art_id"), chStmt.getLong("transaction_id"));
txDatas.add(txData);
}
} finally {
diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/StubBranchModel.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/StubBranchModel.java
index 528740c7a7c..b552f630b37 100644
--- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/StubBranchModel.java
+++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/StubBranchModel.java
@@ -40,7 +40,7 @@ public class StubBranchModel extends BranchModel {
TxModel toReturn = stubs.get(value);
if (toReturn == null) {
toReturn = new TxModel(new TxData(STUB_BRANCH, UserId.SENTINEL, new Timestamp(new Date().getTime()),
- String.format("Transaction: [%s] not found", value), TransactionDetailsType.NonBaselined, 0, value));
+ String.format("Transaction: [%s] not found", value), TransactionDetailsType.NonBaselined, 0L, value));
addTx(toReturn);
}
return toReturn;
diff --git a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/TxData.java b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/TxData.java
index 551783880ba..f2c7d968b4f 100644
--- a/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/TxData.java
+++ b/plugins/org.eclipse.osee.framework.ui.branch.graph/src/org/eclipse/osee/framework/ui/branch/graph/model/TxData.java
@@ -31,11 +31,11 @@ public class TxData {
private final Date timeStamp;
private final String comment;
private final TransactionDetailsType txType;
- private final int commitArtId;
+ private final Long commitArtId;
private final BranchId branch;
private final Long txId;
- public TxData(BranchId branch, UserId authorId, Date timeStamp, String comment, TransactionDetailsType txType, int commitArtId, long txId) {
+ public TxData(BranchId branch, UserId authorId, Date timeStamp, String comment, TransactionDetailsType txType, Long commitArtId, long txId) {
this.authorId = authorId;
this.timeStamp = timeStamp;
this.comment = comment;
@@ -85,7 +85,7 @@ public class TxData {
/**
* @return the commitArtId
*/
- public int getCommitArtId() {
+ public Long getCommitArtId() {
return commitArtId;
}

Back to the top