Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2014-08-18 15:46:52 +0000
committerRoberto E. Escobar2014-09-29 22:58:20 +0000
commit19f4346b5bb116b36657ce4f1da451303626aa5d (patch)
tree8ef479d916befb5d6907c066e9141beb6801ce37
parent03451ab764f509756f2cf3492ca736d45adcf67f (diff)
downloadorg.eclipse.osee-19f4346b5bb116b36657ce4f1da451303626aa5d.tar.gz
org.eclipse.osee-19f4346b5bb116b36657ce4f1da451303626aa5d.tar.xz
org.eclipse.osee-19f4346b5bb116b36657ce4f1da451303626aa5d.zip
refactor[ats_ATS46139]: Remove server usage of branchCache
Remove server side usage of method getSystemRootBranch Change-Id: Ic1b0219b8d8395bb5a9b8013245e0525ba12f03b
-rw-r--r--plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockOseeTransactionDataAccessor.java3
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/ITransactionDataAccessor.java3
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientTransactionAccessor.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/BranchDataFactoryTest.java93
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsBranchImpl.java10
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/BranchDataFactory.java49
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseTransactionRecordAccessor.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/TransactionDataImpl.java16
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/TransactionReadable.java3
10 files changed, 117 insertions, 71 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockOseeTransactionDataAccessor.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockOseeTransactionDataAccessor.java
index c891ffd51d6..3f9ea47d1d9 100644
--- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockOseeTransactionDataAccessor.java
+++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/mocks/MockOseeTransactionDataAccessor.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.framework.core.model.mocks;
import java.util.Collection;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.TransactionVersion;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionRecord;
@@ -60,7 +61,7 @@ public class MockOseeTransactionDataAccessor implements ITransactionDataAccessor
}
@Override
- public TransactionRecord loadTransactionRecord(TransactionCache cache, Branch branch, TransactionVersion transactionType) throws OseeCoreException {
+ public TransactionRecord loadTransactionRecord(TransactionCache cache, IOseeBranch branch, TransactionVersion transactionType) throws OseeCoreException {
return null;
}
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/ITransactionDataAccessor.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/ITransactionDataAccessor.java
index bd7d85008c5..2145d9107fe 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/ITransactionDataAccessor.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/ITransactionDataAccessor.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.framework.core.model.cache;
import java.util.Collection;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.TransactionVersion;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionRecord;
@@ -38,7 +39,7 @@ public interface ITransactionDataAccessor {
* @param transactionType transaction type to load, can be {@link TransactionVersion#HEAD} or
* {@link TransactionVersion#BASE}
*/
- public TransactionRecord loadTransactionRecord(TransactionCache cache, Branch branch, TransactionVersion transactionType) throws OseeCoreException;
+ public TransactionRecord loadTransactionRecord(TransactionCache cache, IOseeBranch branch, TransactionVersion transactionType) throws OseeCoreException;
public void load(TransactionCache transactionCache) throws OseeCoreException;
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientTransactionAccessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientTransactionAccessor.java
index 13aa790fa7b..b3871822ad6 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientTransactionAccessor.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/ClientTransactionAccessor.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.framework.skynet.core.internal.accessors;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.OseeServerContext;
import org.eclipse.osee.framework.core.enums.CacheOperation;
import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
@@ -55,7 +56,7 @@ public class ClientTransactionAccessor implements ITransactionDataAccessor {
}
@Override
- public TransactionRecord loadTransactionRecord(TransactionCache cache, Branch branch, TransactionVersion transactionType) {
+ public TransactionRecord loadTransactionRecord(TransactionCache cache, IOseeBranch branch, TransactionVersion transactionType) {
return null;
}
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/BranchDataFactoryTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/BranchDataFactoryTest.java
index 8b79991ea21..b67dd01a04f 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/BranchDataFactoryTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/BranchDataFactoryTest.java
@@ -17,14 +17,17 @@ import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.ITransaction;
import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.enums.BranchType;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
-import org.eclipse.osee.framework.core.model.cache.TransactionCache;
+import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.orcs.data.ArtifactReadable;
+import org.eclipse.osee.orcs.data.BranchReadable;
import org.eclipse.osee.orcs.data.CreateBranchData;
+import org.eclipse.osee.orcs.data.TransactionReadable;
+import org.eclipse.osee.orcs.search.BranchQuery;
+import org.eclipse.osee.orcs.search.QueryFactory;
+import org.eclipse.osee.orcs.search.TransactionQuery;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -39,15 +42,18 @@ public class BranchDataFactoryTest {
public ExpectedException thrown = ExpectedException.none();
// @formatter:off
- @Mock private BranchCache branchCache;
- @Mock private TransactionCache txCache;
+ @Mock private BranchQuery branchQuery;
+ @Mock private TransactionQuery txQuery;
+ @Mock private QueryFactory queryFactory;
@Mock private IOseeBranch branch;
@Mock private IOseeBranch parentToken;
- @Mock private Branch parent;
+ @Mock private BranchReadable parent;
@Mock private ArtifactReadable author;
@Mock private ArtifactReadable associatedArtifact;
- @Mock private TransactionRecord txRecord;
+ @Mock private TransactionReadable txRecord;
+ @Mock private ResultSet<TransactionReadable> results;
+ @Mock private ResultSet<BranchReadable> branchResults;
// @formatter:on
private BranchDataFactory factory;
@@ -58,7 +64,9 @@ public class BranchDataFactoryTest {
when(author.getLocalId()).thenReturn(55);
when(associatedArtifact.getLocalId()).thenReturn(66);
- factory = new BranchDataFactory(branchCache);
+ when(queryFactory.transactionQuery()).thenReturn(txQuery);
+ when(queryFactory.branchQuery()).thenReturn(branchQuery);
+ factory = new BranchDataFactory(queryFactory);
}
@Test
@@ -68,13 +76,13 @@ public class BranchDataFactoryTest {
when(branch.getName()).thenReturn(branchName);
when(branch.getUuid()).thenReturn(branchUuid);
- when(branchCache.getSystemRootBranch()).thenReturn(parent);
- when(branchCache.getHeadTransaction(parent)).thenReturn(txRecord);
+ when(txQuery.andIsHead(CoreBranches.SYSTEM_ROOT)).thenReturn(txQuery);
+ when(txQuery.getResults()).thenReturn(results);
+ when(results.getExactlyOne()).thenReturn(txRecord);
CreateBranchData result = factory.createTopLevelBranchData(branch, author);
- verify(branchCache).getSystemRootBranch();
- verify(branchCache).getHeadTransaction(parent);
+ verify(txQuery).andIsHead(CoreBranches.SYSTEM_ROOT);
String comment = "Branch Creation for " + branchName;
assertData(result, branchName, branchUuid, BranchType.BASELINE, comment, txRecord, author, null, false);
@@ -87,13 +95,13 @@ public class BranchDataFactoryTest {
when(branch.getName()).thenReturn(branchName);
when(branch.getUuid()).thenReturn(branchUuid);
- when(branchCache.get(parentToken)).thenReturn(parent);
- when(branchCache.getHeadTransaction(parent)).thenReturn(txRecord);
+ when(txQuery.andIsHead(parentToken)).thenReturn(txQuery);
+ when(txQuery.getResults()).thenReturn(results);
+ when(results.getExactlyOne()).thenReturn(txRecord);
CreateBranchData result = factory.createBaselineBranchData(branch, author, parentToken, associatedArtifact);
- verify(branchCache).get(parentToken);
- verify(branchCache).getHeadTransaction(parent);
+ verify(txQuery).andIsHead(parentToken);
String comment = "Branch Creation for " + branchName;
assertData(result, branchName, branchUuid, BranchType.BASELINE, comment, txRecord, author, associatedArtifact,
@@ -107,18 +115,17 @@ public class BranchDataFactoryTest {
Long branchUuid = Lib.generateUuid();
when(branch.getName()).thenReturn(branchName);
when(branch.getUuid()).thenReturn(branchUuid);
+ when(parentToken.getName()).thenReturn(parentName);
- when(parent.getName()).thenReturn(parentName);
-
- when(branchCache.get(parentToken)).thenReturn(parent);
- when(branchCache.getHeadTransaction(parent)).thenReturn(txRecord);
+ when(txQuery.andIsHead(parentToken)).thenReturn(txQuery);
+ when(txQuery.getResults()).thenReturn(results);
+ when(results.getExactlyOne()).thenReturn(txRecord);
CreateBranchData result = factory.createWorkingBranchData(branch, author, parentToken, associatedArtifact);
- verify(branchCache).get(parentToken);
- verify(branchCache).getHeadTransaction(parent);
+ verify(txQuery).andIsHead(parentToken);
- String comment = String.format("New Branch from %s (%s)", parentName, txRecord.getId());
+ String comment = String.format("New Branch from %s (%s)", parentName, txRecord.getGuid());
assertData(result, branchName, branchUuid, BranchType.WORKING, comment, txRecord, author, associatedArtifact,
false);
}
@@ -130,18 +137,24 @@ public class BranchDataFactoryTest {
Long branchUuid = Lib.generateUuid();
when(branch.getName()).thenReturn(branchName);
when(branch.getUuid()).thenReturn(branchUuid);
-
when(parent.getName()).thenReturn(parentName);
- when(branchCache.getOrLoad(99)).thenReturn(txRecord);
- when(txRecord.getBranch()).thenReturn(parent);
-
ITransaction tx = TokenFactory.createTransaction(99);
+ when(txQuery.andTxId(tx.getGuid())).thenReturn(txQuery);
+ when(txQuery.getResults()).thenReturn(results);
+ when(results.getExactlyOne()).thenReturn(txRecord);
+ when(txRecord.getBranchId()).thenReturn(44L);
+ when(txRecord.getGuid()).thenReturn(99);
+
+ when(branchQuery.andUuids(txRecord.getBranchId())).thenReturn(branchQuery);
+ when(branchQuery.getResults()).thenReturn(branchResults);
+ when(branchResults.getExactlyOne()).thenReturn(parent);
+
CreateBranchData result = factory.createCopyTxBranchData(branch, author, tx, null);
- verify(branchCache).getOrLoad(99);
- verify(txRecord).getBranch();
+ verify(txQuery).andTxId(99);
+ verify(branchQuery).andUuids(txRecord.getBranchId());
String comment = String.format("Transaction %d copied from %s to create Branch %s", 99, parentName, branchName);
assertData(result, branchName, branchUuid, BranchType.WORKING, comment, txRecord, author, null, true);
@@ -154,24 +167,30 @@ public class BranchDataFactoryTest {
Long branchUuid = Lib.generateUuid();
when(branch.getName()).thenReturn(branchName);
when(branch.getUuid()).thenReturn(branchUuid);
-
when(parent.getName()).thenReturn(parentName);
- when(branchCache.getOrLoad(99)).thenReturn(txRecord);
- when(txRecord.getBranch()).thenReturn(parent);
-
ITransaction tx = TokenFactory.createTransaction(99);
+ when(txQuery.andTxId(tx.getGuid())).thenReturn(txQuery);
+ when(txQuery.getResults()).thenReturn(results);
+ when(results.getExactlyOne()).thenReturn(txRecord);
+ when(txRecord.getGuid()).thenReturn(99);
+ when(txRecord.getBranchId()).thenReturn(44L);
+
+ when(branchQuery.andUuids(txRecord.getBranchId())).thenReturn(branchQuery);
+ when(branchQuery.getResults()).thenReturn(branchResults);
+ when(branchResults.getExactlyOne()).thenReturn(parent);
+
CreateBranchData result = factory.createPortBranchData(branch, author, tx, null);
- verify(branchCache).getOrLoad(99);
- verify(txRecord).getBranch();
+ verify(txQuery).andTxId(99);
+ verify(branchQuery).andUuids(44L);
String comment = String.format("Transaction %d ported from %s to create Branch %s", 99, parentName, branchName);
assertData(result, branchName, branchUuid, BranchType.PORT, comment, txRecord, author, null, true);
}
- private static void assertData(CreateBranchData actual, String branchName, Long branchUuid, BranchType type, String comment, TransactionRecord fromTx, ArtifactReadable author, ArtifactReadable associatedArtifact, boolean isCopyFromTx) {
+ private static void assertData(CreateBranchData actual, String branchName, Long branchUuid, BranchType type, String comment, TransactionReadable fromTx, ArtifactReadable author, ArtifactReadable associatedArtifact, boolean isCopyFromTx) {
assertEquals(branchName, actual.getName());
assertEquals(branchUuid, actual.getGuid());
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java
index 1a45e3b9f78..b3fe7aa70f4 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java
@@ -228,8 +228,9 @@ public class OrcsApiImpl implements OrcsApi {
return new FutureTask<ArtifactReadable>(callable);
}
};
- return new OrcsBranchImpl(logger, session, module.getBranchDataStore(), cacheService.getBranchCache(),
- systemUser, getOrcsTypes(context));
+ QueryFactory queryFactory = getQueryFactory(context);
+ return new OrcsBranchImpl(logger, session, module.getBranchDataStore(), queryFactory, systemUser,
+ getOrcsTypes(context), cacheService.getBranchCache(), cacheService.getTransactionCache());
}
@Override
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsBranchImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsBranchImpl.java
index fcb486344dc..3171a4f1628 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsBranchImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsBranchImpl.java
@@ -42,6 +42,7 @@ import org.eclipse.osee.orcs.core.internal.branch.PurgeBranchCallable;
import org.eclipse.osee.orcs.data.ArchiveOperation;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.CreateBranchData;
+import org.eclipse.osee.orcs.search.QueryFactory;
/**
* @author Roberto E. Escobar
@@ -52,17 +53,20 @@ public class OrcsBranchImpl implements OrcsBranch {
private final OrcsSession session;
private final BranchDataStore branchStore;
- private final BranchCache branchCache;
private final BranchDataFactory branchDataFactory;
private final OrcsTypes orcsTypes;
- public OrcsBranchImpl(Log logger, OrcsSession session, BranchDataStore branchStore, BranchCache branchCache, LazyObject<ArtifactReadable> systemUser, OrcsTypes orcsTypes) {
+ private final BranchCache branchCache;
+ private final TransactionCache txCache;
+
+ public OrcsBranchImpl(Log logger, OrcsSession session, BranchDataStore branchStore, QueryFactory queryFactory, LazyObject<ArtifactReadable> systemUser, OrcsTypes orcsTypes, BranchCache branchCache, TransactionCache txCache) {
this.logger = logger;
this.session = session;
this.branchStore = branchStore;
+ branchDataFactory = new BranchDataFactory(queryFactory);
+ this.orcsTypes = orcsTypes;
this.branchCache = branchCache;
branchDataFactory = new BranchDataFactory(branchCache);
- this.orcsTypes = orcsTypes;
}
@Override
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/BranchDataFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/BranchDataFactory.java
index 7f211429f59..461cae64118 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/BranchDataFactory.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/BranchDataFactory.java
@@ -13,53 +13,52 @@ package org.eclipse.osee.orcs.core.internal.branch;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.ITransaction;
import org.eclipse.osee.framework.core.enums.BranchType;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
+import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.CreateBranchData;
+import org.eclipse.osee.orcs.data.TransactionReadable;
+import org.eclipse.osee.orcs.search.BranchQuery;
+import org.eclipse.osee.orcs.search.QueryFactory;
+import org.eclipse.osee.orcs.search.TransactionQuery;
/**
* @author David W. Miller
*/
public class BranchDataFactory {
- private final BranchCache branchCache;
+ private final QueryFactory queryFactory;
- public BranchDataFactory(BranchCache branchCache) {
- super();
- this.branchCache = branchCache;
+ public BranchDataFactory(QueryFactory queryFactory) {
+ this.queryFactory = queryFactory;
}
public CreateBranchData createTopLevelBranchData(IOseeBranch branch, ArtifactReadable author) throws OseeCoreException {
- Branch parentBranch = branchCache.getSystemRootBranch();
- TransactionRecord fromTx = branchCache.getHeadTransaction(parentBranch);
-
+ TransactionQuery txQuery = queryFactory.transactionQuery();
+ TransactionReadable fromTx = txQuery.andIsHead(CoreBranches.SYSTEM_ROOT).getResults().getExactlyOne();
String creationComment = String.format("Branch Creation for %s", branch.getName());
return createBranchData(branch, BranchType.BASELINE, creationComment, fromTx, author, null, false);
}
public CreateBranchData createBaselineBranchData(IOseeBranch branch, ArtifactReadable author, IOseeBranch parent, ArtifactReadable associatedArtifact) throws OseeCoreException {
- Branch parentBranch = branchCache.get(parent);
- TransactionRecord fromTx = branchCache.getHeadTransaction(parentBranch);
-
+ TransactionQuery txQuery = queryFactory.transactionQuery();
+ TransactionReadable fromTx = txQuery.andIsHead(parent).getResults().getExactlyOne();
String creationComment = String.format("Branch Creation for %s", branch.getName());
return createBranchData(branch, BranchType.BASELINE, creationComment, fromTx, author, associatedArtifact, false);
}
public CreateBranchData createWorkingBranchData(IOseeBranch branch, ArtifactReadable author, IOseeBranch parent, ArtifactReadable associatedArtifact) throws OseeCoreException {
- Branch parentBranch = branchCache.get(parent);
- TransactionRecord fromTx = branchCache.getHeadTransaction(parentBranch);
-
- String creationComment = String.format("New Branch from %s (%s)", parentBranch.getName(), fromTx.getId());
+ TransactionQuery txQuery = queryFactory.transactionQuery();
+ TransactionReadable fromTx = txQuery.andIsHead(parent).getResults().getExactlyOne();
+ String creationComment = String.format("New Branch from %s (%s)", parent.getName(), fromTx.getGuid());
return createBranchData(branch, BranchType.WORKING, creationComment, fromTx, author, associatedArtifact, false);
}
public CreateBranchData createCopyTxBranchData(IOseeBranch branch, ArtifactReadable author, ITransaction fromTransaction, ArtifactReadable associatedArtifact) throws OseeCoreException {
- int value = fromTransaction.getGuid();
- TransactionRecord fromTx = branchCache.getOrLoad(value);
- IOseeBranch parent = fromTx.getBranch();
+ TransactionQuery txQuery = queryFactory.transactionQuery();
+ BranchQuery branchQuery = queryFactory.branchQuery();
+ TransactionReadable fromTx = txQuery.andTxId(fromTransaction.getGuid()).getResults().getExactlyOne();
+ IOseeBranch parent = branchQuery.andUuids(fromTx.getBranchId()).getResults().getExactlyOne();
String creationComment =
String.format("Transaction %s copied from %s to create Branch %s", fromTransaction, parent.getName(),
@@ -68,16 +67,18 @@ public class BranchDataFactory {
}
public CreateBranchData createPortBranchData(IOseeBranch branch, ArtifactReadable author, ITransaction fromTransaction, ArtifactReadable associatedArtifact) throws OseeCoreException {
+ TransactionQuery txQuery = queryFactory.transactionQuery();
+ BranchQuery branchQuery = queryFactory.branchQuery();
int value = fromTransaction.getGuid();
- TransactionRecord fromTx = branchCache.getOrLoad(value);
- IOseeBranch parent = fromTx.getBranch();
+ TransactionReadable fromTx = txQuery.andTxId(value).getResults().getExactlyOne();
+ IOseeBranch parent = branchQuery.andUuids(fromTx.getBranchId()).getResults().getExactlyOne();
String creationComment =
String.format("Transaction %d ported from %s to create Branch %s", value, parent.getName(), branch.getName());
return createBranchData(branch, BranchType.PORT, creationComment, fromTx, author, associatedArtifact, true);
}
- private CreateBranchData createBranchData(IOseeBranch branch, BranchType branchType, String creationComment, ITransaction fromTx, ArtifactReadable author, ArtifactReadable associatedArtifact, boolean bCopyTx) {
+ private CreateBranchData createBranchData(IOseeBranch branch, BranchType branchType, String creationComment, TransactionReadable sysRootHeadTx, ArtifactReadable author, ArtifactReadable associatedArtifact, boolean bCopyTx) {
CreateBranchData createData = new CreateBranchData();
createData.setUuid(branch.getUuid());
createData.setName(branch.getName());
@@ -86,7 +87,7 @@ public class BranchDataFactory {
}
createData.setBranchType(branchType);
createData.setCreationComment(creationComment);
- createData.setFromTransaction(fromTx);
+ createData.setFromTransaction(sysRootHeadTx);
createData.setUserArtifact(author);
createData.setAssociatedArtifact(associatedArtifact);
createData.setTxCopyBranchType(bCopyTx);
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseTransactionRecordAccessor.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseTransactionRecordAccessor.java
index 74e57916d76..96c8f45d654 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseTransactionRecordAccessor.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/accessor/DatabaseTransactionRecordAccessor.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.orcs.db.internal.accessor;
import java.util.Collection;
import java.util.Date;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
import org.eclipse.osee.framework.core.enums.TransactionVersion;
import org.eclipse.osee.framework.core.model.Branch;
@@ -90,7 +91,7 @@ public class DatabaseTransactionRecordAccessor implements ITransactionDataAccess
}
@Override
- public TransactionRecord loadTransactionRecord(TransactionCache cache, Branch branch, TransactionVersion transactionType) throws OseeCoreException {
+ public TransactionRecord loadTransactionRecord(TransactionCache cache, IOseeBranch branch, TransactionVersion transactionType) throws OseeCoreException {
ensureDependantCachePopulated();
TransactionRecord toReturn = null;
switch (transactionType) {
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/TransactionDataImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/TransactionDataImpl.java
index bc2d2c6e098..f1cb77b1c4c 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/TransactionDataImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/TransactionDataImpl.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.orcs.db.internal.loader.data;
import java.util.Date;
import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
+import org.eclipse.osee.framework.jdk.core.type.Identity;
import org.eclipse.osee.orcs.core.ds.TxOrcsData;
import org.eclipse.osee.orcs.db.internal.sql.RelationalConstants;
@@ -96,4 +97,19 @@ public class TransactionDataImpl extends OrcsObjectImpl<Integer> implements TxOr
return "TransactionDataImpl [authorId=" + authorId + ", branchUuid=" + branchUuid + ", comment=" + comment + ", commitId=" + commitId + ", date=" + date + ", type=" + type + "]";
}
+ @Override
+ public Integer getGuid() {
+ return super.getLocalId();
+ }
+
+ @Override
+ public boolean matches(Identity<?>... identities) {
+ for (Identity<?> identity : identities) {
+ if (identity.getGuid().equals(this.getGuid())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/TransactionReadable.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/TransactionReadable.java
index 0eaa02c40a1..0724804b50b 100644
--- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/TransactionReadable.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/TransactionReadable.java
@@ -11,12 +11,13 @@
package org.eclipse.osee.orcs.data;
import java.util.Date;
+import org.eclipse.osee.framework.core.data.ITransaction;
import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
/**
* @author Roberto E. Escobar
*/
-public interface TransactionReadable extends HasLocalId<Integer> {
+public interface TransactionReadable extends HasLocalId<Integer>, ITransaction {
TransactionDetailsType getTxType();

Back to the top