Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2014-08-26 13:17:15 -0400
committerRoberto E. Escobar2014-10-01 17:03:19 -0400
commit1e8d8d173767d8eddbbfb7d7faf7953a43e47592 (patch)
treecbba44b8467cf3d14b6738b1036dd76873f9a6b5
parent4a2589ece3b57889a7df14294cd467fa822e7e7e (diff)
downloadorg.eclipse.osee-1e8d8d173767d8eddbbfb7d7faf7953a43e47592.tar.gz
org.eclipse.osee-1e8d8d173767d8eddbbfb7d7faf7953a43e47592.tar.xz
org.eclipse.osee-1e8d8d173767d8eddbbfb7d7faf7953a43e47592.zip
refactor[ats_ATS46139]: Finish removing BranchCache from server
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsConfigEndpointImpl.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/BranchCommitResponseTest.java8
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/DataAsserts.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java10
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionRecordTranslatorTest.java22
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCommitResponse.java13
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java3
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCommitResponseTranslator.java7
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java46
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/branch/AbstractBranchCallable.java17
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/branch/CommitBranchCallable.java8
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/branch/CompareBranchCallable.java11
-rw-r--r--plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/branch/CreateBranchCallable.java4
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/CommitBranchHttpRequestOperation.java4
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/UpdateBranchArchivedStateHttpRequestOperation.java4
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/UpdateBranchStateHttpRequestOperation.java4
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/UpdateBranchTypeHttpRequestOperation.java4
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseTransactionRecordAccessor.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactoryTest.java35
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/ArtifactTest.java24
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/branch/BranchDataFactoryTest.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphBuilderImplTest.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphDataImplTest.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/RelationTest.java19
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImplTest.java6
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TxCallableFactoryTest.java6
-rw-r--r--plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManagerTest.java51
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/ArtifactData.java1
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/BranchDataStore.java11
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/TransactionResult.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java54
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsBranchImpl.java30
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactory.java41
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactImpl.java13
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/BranchDataFactory.java20
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CommitBranchCallable.java36
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CompareBranchCallable.java20
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CreateBranchCallable.java14
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/GraphData.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/GraphFactory.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphBuilderImpl.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphDataImpl.java10
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphFactoryImpl.java23
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/Relation.java12
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationFactory.java11
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxCallableFactory.java10
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataLoaderImpl.java13
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManager.java13
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/util/ValueProviderFactory.java33
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryTest.java12
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriterTest.java10
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilderTest.java10
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchModule.java25
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/BranchCopyTxCallable.java78
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseCallable.java94
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseTxCallable.java113
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CompareDatabaseCallable.java48
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseTxCallable.java201
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/InitializeDatastoreCallable.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenTxsOnTheSameBranch.java20
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactory.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryImpl.java28
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/CommitTransactionDatabaseTxCallable.java48
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriter.java7
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxModule.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilder.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilderImpl.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsBranchTest.java9
-rw-r--r--plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsPortingTest.java27
-rw-r--r--plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsQueryTest.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTransactionTest.java37
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsBranch.java8
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/CreateBranchData.java9
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/TransactionReadableDelta.java63
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionBuilder.java4
76 files changed, 740 insertions, 853 deletions
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsConfigEndpointImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsConfigEndpointImpl.java
index f58e5912aa..b8ad918457 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsConfigEndpointImpl.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsConfigEndpointImpl.java
@@ -30,7 +30,6 @@ import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.enums.CoreArtifactTokens;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.model.BranchReadable;
import org.eclipse.osee.framework.jdk.core.type.IResourceRegistry;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
@@ -40,6 +39,7 @@ import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.data.ArtifactId;
import org.eclipse.osee.orcs.data.ArtifactReadable;
+import org.eclipse.osee.orcs.data.BranchReadable;
import org.eclipse.osee.orcs.transaction.TransactionBuilder;
import org.eclipse.osee.template.engine.PageCreator;
import org.eclipse.osee.template.engine.PageFactory;
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/BranchCommitResponseTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/BranchCommitResponseTest.java
index 838d6e2b32..7829e740a8 100644
--- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/BranchCommitResponseTest.java
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/BranchCommitResponseTest.java
@@ -39,11 +39,11 @@ public class BranchCommitResponseTest {
@Test
public void testGetSetTransaction() {
- Assert.assertNull(response.getTransaction());
- response.setTransaction(transaction);
+ Assert.assertNull(response.getTransactionId());
+ response.setTransactionId(transaction.getGuid());
- Assert.assertNotNull(response.getTransaction());
- Assert.assertEquals(transaction, response.getTransaction());
+ Assert.assertNotNull(response.getTransactionId());
+ Assert.assertEquals(transaction.getGuid(), response.getTransactionId());
}
@Parameters
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/DataAsserts.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/DataAsserts.java
index 195e291ac2..486ee2b3f4 100644
--- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/DataAsserts.java
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/DataAsserts.java
@@ -131,7 +131,7 @@ public final class DataAsserts {
if (expected == null) {
Assert.assertNull(actual);
} else {
- assertEquals(expected.getTransaction(), actual.getTransaction());
+ Assert.assertEquals(expected.getTransactionId(), actual.getTransactionId());
}
}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java
index 84b67677e7..cfa4991983 100644
--- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java
@@ -20,11 +20,7 @@ import org.eclipse.osee.framework.core.message.internal.translation.BranchCommit
import org.eclipse.osee.framework.core.message.internal.translation.TransactionRecordTranslator;
import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
import org.eclipse.osee.framework.core.message.test.mocks.MockDataFactory;
-import org.eclipse.osee.framework.core.message.test.mocks.MockOseeDataAccessor;
-import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.model.cache.TransactionCache;
import org.eclipse.osee.framework.core.translation.IDataTranslationService;
import org.eclipse.osee.framework.core.translation.ITranslator;
@@ -55,16 +51,14 @@ public class BranchCommitResponseTranslatorTest extends BaseTranslatorTest<Branc
List<Object[]> data = new ArrayList<Object[]>();
IDataTranslationService service = new DataTranslationService();
- BranchCache branchCache = new BranchCache(new MockOseeDataAccessor<Long, Branch>(), new TransactionCache());
- service.addTranslator(new TransactionRecordTranslator(new TransactionRecordFactory(), branchCache),
- CoreTranslatorId.TRANSACTION_RECORD);
+ service.addTranslator(new TransactionRecordTranslator(), CoreTranslatorId.TRANSACTION_RECORD);
ITranslator<BranchCommitResponse> translator = new BranchCommitResponseTranslator(service);
for (int index = 1; index <= 2; index++) {
TransactionRecord tx = MockDataFactory.createTransaction(index, index * 3);
BranchCommitResponse response = new BranchCommitResponse();
- response.setTransaction(tx);
+ response.setTransactionId(tx.getGuid());
data.add(new Object[] {response, translator});
}
data.add(new Object[] {new BranchCommitResponse(), translator});
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionRecordTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionRecordTranslatorTest.java
index 5704a73745..370e022ce3 100644
--- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionRecordTranslatorTest.java
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionRecordTranslatorTest.java
@@ -14,13 +14,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.eclipse.osee.framework.core.message.internal.translation.TransactionRecordTranslator;
-import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
-import org.eclipse.osee.framework.core.message.test.mocks.MockDataFactory;
-import org.eclipse.osee.framework.core.message.test.mocks.MockOseeDataAccessor;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.model.cache.TransactionCache;
import org.eclipse.osee.framework.core.translation.ITranslator;
import org.junit.Assert;
@@ -34,26 +27,23 @@ import org.junit.runners.Parameterized.Parameters;
* @author Roberto E. Escobar
*/
@RunWith(Parameterized.class)
-public class TransactionRecordTranslatorTest extends BaseTranslatorTest<TransactionRecord> {
+public class TransactionRecordTranslatorTest extends BaseTranslatorTest<Integer> {
- public TransactionRecordTranslatorTest(TransactionRecord data, ITranslator<TransactionRecord> translator) {
+ public TransactionRecordTranslatorTest(Integer data, ITranslator<Integer> translator) {
super(data, translator);
}
@Override
- protected void checkEquals(TransactionRecord expected, TransactionRecord actual) {
- Assert.assertNotSame(expected, actual);
- DataAsserts.assertEquals(expected, actual);
+ protected void checkEquals(Integer expected, Integer actual) {
+ Assert.assertEquals(expected, actual);
}
@Parameters
public static Collection<Object[]> data() {
- BranchCache branchCache = new BranchCache(new MockOseeDataAccessor<Long, Branch>(), new TransactionCache());
- ITranslator<TransactionRecord> translator =
- new TransactionRecordTranslator(new TransactionRecordFactory(), branchCache);
+ ITranslator<Integer> translator = new TransactionRecordTranslator();
List<Object[]> data = new ArrayList<Object[]>();
for (int index = 1; index <= 2; index++) {
- data.add(new Object[] {MockDataFactory.createTransaction(index * 10, index * 3), translator});
+ data.add(new Object[] {index * 10, translator});
}
return data;
}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCommitResponse.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCommitResponse.java
index 87258cb1f3..e106f5591a 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCommitResponse.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCommitResponse.java
@@ -10,23 +10,22 @@
*******************************************************************************/
package org.eclipse.osee.framework.core.message;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
/**
* @author Megumi Telles
*/
public class BranchCommitResponse {
- private TransactionRecord transactionRecord;
+ private Integer transactionId;
public BranchCommitResponse() {
- this.transactionRecord = null;
+ this.transactionId = null;
}
- public TransactionRecord getTransaction() {
- return transactionRecord;
+ public Integer getTransactionId() {
+ return transactionId;
}
- public void setTransaction(TransactionRecord transactionRecord) {
- this.transactionRecord = transactionRecord;
+ public void setTransactionId(Integer transactionId) {
+ this.transactionId = transactionId;
}
}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java
index b43548fe11..a8b4e85665 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java
@@ -53,8 +53,7 @@ public class DataTranslationServiceFactory {
public void configureService(IDataTranslationService service, TransactionRecordFactory txRecordFactory, AttributeTypeFactory attributeTypeFactory, TempCachingService cachingService) throws OseeCoreException {
BranchCache branchCache = cachingService.getBranchCache();
- service.addTranslator(new TransactionRecordTranslator(txRecordFactory, branchCache),
- CoreTranslatorId.TRANSACTION_RECORD);
+ service.addTranslator(new TransactionRecordTranslator(), CoreTranslatorId.TRANSACTION_RECORD);
service.addTranslator(new BranchCreationRequestTranslator(), CoreTranslatorId.BRANCH_CREATION_REQUEST);
service.addTranslator(new BranchCreationResponseTranslator(), CoreTranslatorId.BRANCH_CREATION_RESPONSE);
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCommitResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCommitResponseTranslator.java
index f2fc422b85..f9c79e4ff7 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCommitResponseTranslator.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCommitResponseTranslator.java
@@ -12,7 +12,6 @@ package org.eclipse.osee.framework.core.message.internal.translation;
import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
import org.eclipse.osee.framework.core.message.BranchCommitResponse;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.translation.IDataTranslationService;
import org.eclipse.osee.framework.core.translation.ITranslator;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -37,15 +36,15 @@ public class BranchCommitResponseTranslator implements ITranslator<BranchCommitR
public BranchCommitResponse convert(PropertyStore propertyStore) throws OseeCoreException {
BranchCommitResponse response = new BranchCommitResponse();
PropertyStore innerStore = propertyStore.getPropertyStore(Entry.TRANSACTION_NUMBER.name());
- TransactionRecord transactionRecord = service.convert(innerStore, CoreTranslatorId.TRANSACTION_RECORD);
- response.setTransaction(transactionRecord);
+ Integer transactionRecord = service.convert(innerStore, CoreTranslatorId.TRANSACTION_RECORD);
+ response.setTransactionId(transactionRecord);
return response;
}
@Override
public PropertyStore convert(BranchCommitResponse data) throws OseeCoreException {
PropertyStore store = new PropertyStore();
- TransactionRecord record = data.getTransaction();
+ Integer record = data.getTransactionId();
PropertyStore property = service.convert(record, CoreTranslatorId.TRANSACTION_RECORD);
store.put(Entry.TRANSACTION_NUMBER.name(), property);
return store;
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java
index 471ac1cda5..beb7f785c3 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java
@@ -10,12 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.framework.core.message.internal.translation;
-import java.sql.Timestamp;
-import java.util.Date;
-import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.translation.ITranslator;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
@@ -23,51 +17,21 @@ import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
/**
* @author Roberto E. Escobar
*/
-public final class TransactionRecordTranslator implements ITranslator<TransactionRecord> {
+public final class TransactionRecordTranslator implements ITranslator<Integer> {
private static enum Entry {
TRANSACTION_ID,
- TRANSACTION_BRANCH,
- TRANSACTION_TX_TYPE,
- TRANSACTION_COMMENT,
- TRANSACTION_TIMESTAMP,
- TRANSACTION_AUTHOR_ART_ID,
- TRANSACTION_COMMIT_ART_ID;
- }
-
- private final TransactionRecordFactory txRecordFactory;
- private final BranchCache branchCache;
-
- public TransactionRecordTranslator(TransactionRecordFactory txRecordFactory, BranchCache branchCache) {
- this.txRecordFactory = txRecordFactory;
- this.branchCache = branchCache;
}
@Override
- public TransactionRecord convert(PropertyStore store) throws OseeCoreException {
- int transactionNumber = store.getInt(Entry.TRANSACTION_ID.name());
- TransactionDetailsType txType = TransactionDetailsType.valueOf(store.get(Entry.TRANSACTION_TX_TYPE.name()));
- String comment = store.get(Entry.TRANSACTION_COMMENT.name());
- Date time = new Timestamp(store.getLong(Entry.TRANSACTION_TIMESTAMP.name()));
- int authorArtId = store.getInt(Entry.TRANSACTION_AUTHOR_ART_ID.name());
- int commitArtId = store.getInt(Entry.TRANSACTION_COMMIT_ART_ID.name());
- long branchUuid = store.getLong(Entry.TRANSACTION_BRANCH.name());
- return txRecordFactory.create(transactionNumber, branchUuid, comment, time, authorArtId, commitArtId, txType,
- branchCache);
+ public Integer convert(PropertyStore store) throws OseeCoreException {
+ return store.getInt(Entry.TRANSACTION_ID.name());
}
@Override
- public PropertyStore convert(TransactionRecord data) {
+ public PropertyStore convert(Integer transactionId) {
PropertyStore store = new PropertyStore();
- store.put(Entry.TRANSACTION_ID.name(), data.getId());
- store.put(Entry.TRANSACTION_TX_TYPE.name(), data.getTxType().name());
- store.put(Entry.TRANSACTION_COMMENT.name(), data.getComment());
- store.put(Entry.TRANSACTION_TIMESTAMP.name(), data.getTimeStamp().getTime());
- store.put(Entry.TRANSACTION_AUTHOR_ART_ID.name(), data.getAuthor());
-
- store.put(Entry.TRANSACTION_COMMIT_ART_ID.name(), data.getCommit());
-
- store.put(Entry.TRANSACTION_BRANCH.name(), data.getBranchId());
+ store.put(Entry.TRANSACTION_ID.name(), transactionId);
return store;
}
}
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/branch/AbstractBranchCallable.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/branch/AbstractBranchCallable.java
index 3d049b297b..34edc93b6c 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/branch/AbstractBranchCallable.java
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/branch/AbstractBranchCallable.java
@@ -15,7 +15,6 @@ import java.util.concurrent.Callable;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.osee.executor.admin.CancellableCallable;
-import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
import org.eclipse.osee.framework.core.translation.IDataTranslationService;
@@ -25,8 +24,10 @@ import org.eclipse.osee.orcs.ApplicationContext;
import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.OrcsBranch;
import org.eclipse.osee.orcs.data.ArtifactReadable;
+import org.eclipse.osee.orcs.data.BranchReadable;
import org.eclipse.osee.orcs.search.BranchQuery;
import org.eclipse.osee.orcs.search.QueryFactory;
+import org.eclipse.osee.orcs.search.TransactionQuery;
/**
* @author Roberto E. Escobar
@@ -110,10 +111,14 @@ public abstract class AbstractBranchCallable<REQ_TYPE, RESP_TYPE> extends Cancel
return branchOps;
}
- protected IOseeBranch getBranchFromUuid(long uuid) {
+ protected QueryFactory getQueryFactory() {
+ return orcsApi.getQueryFactory(getContext());
+ }
+
+ protected BranchReadable getBranchFromUuid(long uuid) {
BranchQuery branchQuery = orcsApi.getQueryFactory(getContext()).branchQuery();
branchQuery.andUuids(uuid);
- return branchQuery.getResultsAsId().getExactlyOne();
+ return branchQuery.getResults().getExactlyOne();
}
protected ApplicationContext getContext() {
@@ -129,4 +134,10 @@ public abstract class AbstractBranchCallable<REQ_TYPE, RESP_TYPE> extends Cancel
return artifact;
}
+ protected Long getBranchUuidFromTxId(int tx) {
+ TransactionQuery txQuery = getQueryFactory().transactionQuery();
+ Long branchId = txQuery.andTxId(tx).getResults().getExactlyOne().getBranchId();
+ return branchId;
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/branch/CommitBranchCallable.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/branch/CommitBranchCallable.java
index 3a1e5410a9..f5a896c614 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/branch/CommitBranchCallable.java
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/branch/CommitBranchCallable.java
@@ -17,12 +17,12 @@ import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
import org.eclipse.osee.framework.core.message.BranchCommitRequest;
import org.eclipse.osee.framework.core.message.BranchCommitResponse;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.translation.IDataTranslationService;
import org.eclipse.osee.orcs.ApplicationContext;
import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.data.ArchiveOperation;
import org.eclipse.osee.orcs.data.ArtifactReadable;
+import org.eclipse.osee.orcs.data.TransactionReadable;
/**
* @author Roberto E. Escobar
@@ -41,11 +41,11 @@ public class CommitBranchCallable extends AbstractBranchCallable<BranchCommitReq
ArtifactReadable committer = getArtifactById(request.getUserArtId());
- Callable<TransactionRecord> callable = getBranchOps().commitBranch(committer, source, destination);
- TransactionRecord transactionRecord = callAndCheckForCancel(callable);
+ Callable<TransactionReadable> callable = getBranchOps().commitBranch(committer, source, destination);
+ TransactionReadable transactionRecord = callAndCheckForCancel(callable);
BranchCommitResponse responseData = new BranchCommitResponse();
- responseData.setTransaction(transactionRecord);
+ responseData.setTransactionId(transactionRecord.getGuid());
if (request.isArchiveAllowed()) {
Callable<Void> archiveCallable = getBranchOps().archiveUnarchiveBranch(source, ArchiveOperation.ARCHIVE);
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/branch/CompareBranchCallable.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/branch/CompareBranchCallable.java
index dbe8fcf703..3c5b2db30f 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/branch/CompareBranchCallable.java
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/branch/CompareBranchCallable.java
@@ -14,8 +14,6 @@ import java.util.List;
import java.util.concurrent.Callable;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.eclipse.osee.framework.core.data.ITransaction;
-import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
import org.eclipse.osee.framework.core.message.ChangeReportRequest;
import org.eclipse.osee.framework.core.message.ChangeReportResponse;
@@ -23,6 +21,8 @@ import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.core.translation.IDataTranslationService;
import org.eclipse.osee.orcs.ApplicationContext;
import org.eclipse.osee.orcs.OrcsApi;
+import org.eclipse.osee.orcs.data.TransactionReadable;
+import org.eclipse.osee.orcs.search.QueryFactory;
/**
* @author Roberto E. Escobar
@@ -36,8 +36,11 @@ public class CompareBranchCallable extends AbstractBranchCallable<ChangeReportRe
@Override
protected ChangeReportResponse executeCall(ChangeReportRequest request) throws Exception {
- ITransaction sourceTx = TokenFactory.createTransaction(request.getSourceTx());
- ITransaction destinationTx = TokenFactory.createTransaction(request.getDestinationTx());
+ QueryFactory queryFactory = getQueryFactory();
+ TransactionReadable sourceTx =
+ queryFactory.transactionQuery().andTxId(request.getSourceTx()).getResults().getExactlyOne();
+ TransactionReadable destinationTx =
+ queryFactory.transactionQuery().andTxId(request.getDestinationTx()).getResults().getExactlyOne();
Callable<List<ChangeItem>> callable = getBranchOps().compareBranch(sourceTx, destinationTx);
List<ChangeItem> items = callAndCheckForCancel(callable);
diff --git a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/branch/CreateBranchCallable.java b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/branch/CreateBranchCallable.java
index 4e3c3ccf5d..103b3369f9 100644
--- a/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/branch/CreateBranchCallable.java
+++ b/plugins/org.eclipse.osee.framework.manager.servlet/src/org/eclipse/osee/framework/manager/servlet/branch/CreateBranchCallable.java
@@ -17,11 +17,11 @@ import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
import org.eclipse.osee.framework.core.message.BranchCreationRequest;
import org.eclipse.osee.framework.core.message.BranchCreationResponse;
-import org.eclipse.osee.framework.core.model.BranchReadable;
import org.eclipse.osee.framework.core.translation.IDataTranslationService;
import org.eclipse.osee.orcs.ApplicationContext;
import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.data.ArtifactReadable;
+import org.eclipse.osee.orcs.data.BranchReadable;
import org.eclipse.osee.orcs.data.CreateBranchData;
/**
@@ -55,6 +55,8 @@ public class CreateBranchCallable extends AbstractBranchCallable<BranchCreationR
createData.setAssociatedArtifact(associatedWith);
createData.setMergeDestinationBranchId(request.getMergeDestinationBranchId());
+ Long parentBranch = getBranchUuidFromTxId(request.getSourceTransactionId());
+ createData.setParentBranchUuid(parentBranch);
createData.setMergeAddressingQueryId(request.getMergeAddressingQueryId());
createData.setTxCopyBranchType(request.txIsCopied());
Callable<BranchReadable> callable;
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/CommitBranchHttpRequestOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/CommitBranchHttpRequestOperation.java
index 7d85778a04..d39f7453c3 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/CommitBranchHttpRequestOperation.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/CommitBranchHttpRequestOperation.java
@@ -96,6 +96,7 @@ public final class CommitBranchHttpRequestOperation extends AbstractOperation {
response =
HttpClientMessage.send(OseeServerContext.BRANCH_CONTEXT, parameters,
CoreTranslatorId.BRANCH_COMMIT_REQUEST, requestData, CoreTranslatorId.BRANCH_COMMIT_RESPONSE);
+ sourceBranch.setBranchState(BranchState.COMMITTED);
} catch (OseeCoreException ex) {
sourceBranch.setBranchState(currentState);
OseeEventManager.kickBranchEvent(getClass(),
@@ -109,7 +110,8 @@ public final class CommitBranchHttpRequestOperation extends AbstractOperation {
}
private void handleResponse(BranchCommitResponse response, IProgressMonitor monitor, Branch sourceBranch, Branch destinationBranch) throws OseeCoreException {
- TransactionRecord newTransaction = response.getTransaction();
+ Integer newTxId = response.getTransactionId();
+ TransactionRecord newTransaction = TransactionManager.getTransactionId(newTxId);
AccessPolicy accessPolicy = ServiceUtil.getAccessPolicy();
accessPolicy.removePermissions(sourceBranch);
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/UpdateBranchArchivedStateHttpRequestOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/UpdateBranchArchivedStateHttpRequestOperation.java
index d537396ae8..4b1daf4f54 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/UpdateBranchArchivedStateHttpRequestOperation.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/UpdateBranchArchivedStateHttpRequestOperation.java
@@ -18,6 +18,7 @@ import org.eclipse.osee.framework.core.enums.BranchArchivedState;
import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
import org.eclipse.osee.framework.core.enums.Function;
import org.eclipse.osee.framework.core.message.ChangeBranchArchiveStateRequest;
+import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.operation.AbstractOperation;
import org.eclipse.osee.framework.core.util.HttpProcessor.AcquireResult;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -53,7 +54,8 @@ public final class UpdateBranchArchivedStateHttpRequestOperation extends Abstrac
CoreTranslatorId.CHANGE_BRANCH_ARCHIVE_STATE, requestData, null);
if (response.wasSuccessful()) {
- BranchManager.refreshBranches();
+ Branch branch = BranchManager.getBranch(branchUuid);
+ branch.setArchived(branchState.isArchived());
OseeEventManager.kickBranchEvent(getClass(), new BranchEvent(BranchEventType.ArchiveStateUpdated, branchUuid));
}
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/UpdateBranchStateHttpRequestOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/UpdateBranchStateHttpRequestOperation.java
index 6089719f82..f2e4dad327 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/UpdateBranchStateHttpRequestOperation.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/UpdateBranchStateHttpRequestOperation.java
@@ -18,6 +18,7 @@ import org.eclipse.osee.framework.core.enums.BranchState;
import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
import org.eclipse.osee.framework.core.enums.Function;
import org.eclipse.osee.framework.core.message.ChangeBranchStateRequest;
+import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.operation.AbstractOperation;
import org.eclipse.osee.framework.core.util.HttpProcessor.AcquireResult;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -53,7 +54,8 @@ public class UpdateBranchStateHttpRequestOperation extends AbstractOperation {
requestData, null);
if (response.wasSuccessful()) {
- BranchManager.refreshBranches();
+ Branch branch = BranchManager.getBranch(branchUuid);
+ branch.setBranchState(branchState);
OseeEventManager.kickBranchEvent(getClass(), new BranchEvent(BranchEventType.StateUpdated, branchUuid));
}
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/UpdateBranchTypeHttpRequestOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/UpdateBranchTypeHttpRequestOperation.java
index e07af5e278..d53699883c 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/UpdateBranchTypeHttpRequestOperation.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/UpdateBranchTypeHttpRequestOperation.java
@@ -18,6 +18,7 @@ import org.eclipse.osee.framework.core.enums.BranchType;
import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
import org.eclipse.osee.framework.core.enums.Function;
import org.eclipse.osee.framework.core.message.ChangeBranchTypeRequest;
+import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.operation.AbstractOperation;
import org.eclipse.osee.framework.core.util.HttpProcessor.AcquireResult;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -53,7 +54,8 @@ public final class UpdateBranchTypeHttpRequestOperation extends AbstractOperatio
requestData, null);
if (response.wasSuccessful()) {
- BranchManager.refreshBranches();
+ Branch branch = BranchManager.getBranch(branchUuid);
+ branch.setBranchType(type);
OseeEventManager.kickBranchEvent(getClass(), new BranchEvent(BranchEventType.TypeUpdated, branchUuid));
}
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseTransactionRecordAccessor.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseTransactionRecordAccessor.java
index d70921212c..7e10ff72ad 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseTransactionRecordAccessor.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/internal/accessors/DatabaseTransactionRecordAccessor.java
@@ -170,7 +170,7 @@ public class DatabaseTransactionRecordAccessor implements ITransactionDataAccess
@Override
public TransactionRecord getHeadTransaction(TransactionCache cache, Branch branch) throws OseeCoreException {
- return cache.getOrLoad(oseeDatabaseService.runPreparedQueryFetchObject(-1,
- ClientSessionManager.getSql(OseeSql.TX_GET_MAX_AS_LARGEST_TX), branch.getUuid()));
+ String query = ClientSessionManager.getSql(OseeSql.TX_GET_MAX_AS_LARGEST_TX);
+ return cache.getOrLoad(oseeDatabaseService.runPreparedQueryFetchObject(-1, query, branch.getUuid()));
}
}
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactoryTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactoryTest.java
index a55f79c395..d4fab809e4 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactoryTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactoryTest.java
@@ -28,18 +28,19 @@ import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.orcs.OrcsSession;
import org.eclipse.osee.orcs.core.ds.ArtifactData;
import org.eclipse.osee.orcs.core.ds.ArtifactDataFactory;
import org.eclipse.osee.orcs.core.ds.AttributeData;
-import org.eclipse.osee.orcs.core.ds.OrcsData;
import org.eclipse.osee.orcs.core.ds.VersionData;
+import org.eclipse.osee.orcs.core.internal.artifact.ArtifactFactory.BranchProviderFactory;
+import org.eclipse.osee.orcs.core.internal.artifact.ArtifactImpl.BranchProvider;
import org.eclipse.osee.orcs.core.internal.attribute.Attribute;
import org.eclipse.osee.orcs.core.internal.attribute.AttributeFactory;
import org.eclipse.osee.orcs.core.internal.attribute.AttributeManager;
import org.eclipse.osee.orcs.core.internal.relation.RelationFactory;
-import org.eclipse.osee.orcs.core.internal.util.ValueProvider;
-import org.eclipse.osee.orcs.core.internal.util.ValueProviderFactory;
import org.eclipse.osee.orcs.data.ArtifactTypes;
+import org.eclipse.osee.orcs.data.BranchReadable;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
@@ -62,7 +63,7 @@ public class ArtifactFactoryTest {
public ExpectedException thrown = ExpectedException.none();
// @formatter:off
- @Mock private Branch branch;
+ @Mock private BranchReadable branch;
@Mock private IArtifactType artifactType;
@Mock private ArtifactData artifactData;
@Mock private VersionData artifactVersion;
@@ -71,12 +72,13 @@ public class ArtifactFactoryTest {
@Mock private AttributeFactory attributeFactory;
@Mock private RelationFactory relationFactory;
@Mock private ArtifactTypes artifactTypeCache;
- @Mock private ValueProviderFactory providerFactory;
- @Mock private ValueProvider<Branch, OrcsData> branchProvider;
+ @Mock private BranchProviderFactory branchProviderFactory;
+ @Mock private BranchProvider branchProvider;
@Mock private Attribute<Object> attribute;
@Mock private AttributeData attributeData;
@Mock private Artifact source;
+ @Mock private OrcsSession session;
@Mock private ArtifactData otherArtifactData;
// @formatter:on
@@ -89,7 +91,8 @@ public class ArtifactFactoryTest {
public void init() throws OseeCoreException {
MockitoAnnotations.initMocks(this);
- artifactFactory = new ArtifactFactory(dataFactory, attributeFactory, artifactTypeCache, providerFactory);
+ artifactFactory = new ArtifactFactory(dataFactory, attributeFactory, artifactTypeCache, branchProviderFactory);
+ when(branchProviderFactory.createBranchProvider(any(OrcsSession.class))).thenReturn(branchProvider);
guid = GUID.create();
@@ -103,6 +106,7 @@ public class ArtifactFactoryTest {
when(artifactData.getTypeUuid()).thenReturn(65L);
when(artifactData.getVersion()).thenReturn(artifactVersion);
when(artifactVersion.getBranchId()).thenReturn(23L);
+ when(branch.getGuid()).thenReturn(23L);
when(
attributeFactory.copyAttribute(any(AttributeData.class), any(IOseeBranch.class), any(AttributeManager.class))).thenReturn(
@@ -113,10 +117,7 @@ public class ArtifactFactoryTest {
when(otherArtifactData.getTypeUuid()).thenReturn(65L);
when(otherArtifactData.getVersion()).thenReturn(artifactVersion);
- when(providerFactory.createBranchProvider(artifactData)).thenReturn(branchProvider);
- when(providerFactory.createBranchProvider(otherArtifactData)).thenReturn(branchProvider);
-
- when(branchProvider.get()).thenReturn(branch);
+ when(branchProvider.getBranch(23L)).thenReturn(branch);
when(artifactTypeCache.getByUuid(65L)).thenReturn(artifactType);
}
@@ -125,7 +126,7 @@ public class ArtifactFactoryTest {
public void testCreateArtifactFromBranchTypeAndGuid() throws OseeCoreException {
when(dataFactory.create(branch, artifactType, guid)).thenReturn(artifactData);
- Artifact artifact = artifactFactory.createArtifact(branch, artifactType, guid);
+ Artifact artifact = artifactFactory.createArtifact(session, branch, artifactType, guid);
verify(dataFactory).create(branch, artifactType, guid);
assertEquals(artifactType, artifact.getArtifactType());
@@ -134,7 +135,7 @@ public class ArtifactFactoryTest {
@Test
public void testCreateArtifactFromArtifactData() throws OseeCoreException {
- Artifact artifact = artifactFactory.createArtifact(artifactData);
+ Artifact artifact = artifactFactory.createArtifact(session, artifactData);
assertEquals(artifactType, artifact.getArtifactType());
assertEquals(guid, artifact.getGuid());
@@ -151,7 +152,7 @@ public class ArtifactFactoryTest {
ArgumentCaptor<Artifact> implCapture = ArgumentCaptor.forClass(Artifact.class);
- Artifact actual = artifactFactory.copyArtifact(source, types, branch);
+ Artifact actual = artifactFactory.copyArtifact(session, source, types, branch);
verify(source, times(0)).getAttributes(CoreAttributeTypes.RelationOrder);
verify(source, times(0)).getAttributes(CoreAttributeTypes.City);
@@ -168,7 +169,7 @@ public class ArtifactFactoryTest {
thrown.expect(OseeArgumentException.class);
thrown.expectMessage("Source artifact is on the same branch as [" + branch + "]");
- artifactFactory.introduceArtifact(source, branch);
+ artifactFactory.introduceArtifact(session, source, branch);
}
@Test
@@ -187,7 +188,7 @@ public class ArtifactFactoryTest {
ArgumentCaptor<Artifact> implCapture = ArgumentCaptor.forClass(Artifact.class);
- Artifact actual = artifactFactory.introduceArtifact(source, branch);
+ Artifact actual = artifactFactory.introduceArtifact(session, source, branch);
verify(source, times(0)).getAttributes(CoreAttributeTypes.RelationOrder);
verify(source, times(0)).getAttributes(CoreAttributeTypes.City);
@@ -211,7 +212,7 @@ public class ArtifactFactoryTest {
ArgumentCaptor<Artifact> implCapture = ArgumentCaptor.forClass(Artifact.class);
- Artifact actual = artifactFactory.copyArtifact(source, types, branch);
+ Artifact actual = artifactFactory.copyArtifact(session, source, types, branch);
verify(source, times(0)).getAttributes(CoreAttributeTypes.RelationOrder);
verify(source, times(0)).getAttributes(CoreAttributeTypes.City);
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/ArtifactTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/ArtifactTest.java
index 43f171c97b..8122cd167d 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/ArtifactTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/attribute/ArtifactTest.java
@@ -31,13 +31,13 @@ import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.orcs.core.ds.ArtifactData;
import org.eclipse.osee.orcs.core.ds.AttributeData;
-import org.eclipse.osee.orcs.core.ds.OrcsData;
import org.eclipse.osee.orcs.core.ds.VersionData;
import org.eclipse.osee.orcs.core.internal.artifact.Artifact;
import org.eclipse.osee.orcs.core.internal.artifact.ArtifactImpl;
+import org.eclipse.osee.orcs.core.internal.artifact.ArtifactImpl.BranchProvider;
import org.eclipse.osee.orcs.core.internal.graph.GraphData;
-import org.eclipse.osee.orcs.core.internal.util.ValueProvider;
import org.eclipse.osee.orcs.data.ArtifactTypes;
+import org.eclipse.osee.orcs.data.BranchReadable;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
@@ -58,12 +58,12 @@ public class ArtifactTest {
@Mock private Artifact artifact;
@Mock private ArtifactData artifactData;
@Mock private AttributeFactory attributeFactory;
- @Mock private ValueProvider<Branch, OrcsData> branchProvider;
@Mock private ArtifactTypes types;
+ @Mock private BranchProvider branchProvider;
@Mock private VersionData version;
@Mock private AttributeData attributeData;
- @Mock private Branch branch;
+ @Mock private BranchReadable branch;
@SuppressWarnings("rawtypes")
@Mock private Attribute attribute;
@@ -103,7 +103,8 @@ public class ArtifactTest {
when(artifactData.getVersion()).thenReturn(version);
when(artifactData.getTypeUuid()).thenReturn(artifactType.getGuid());
when(artifactData.getLocalId()).thenReturn(0);
- when(branchProvider.get()).thenReturn(branch);
+ when(version.getBranchId()).thenReturn(55L);
+ when(branchProvider.getBranch(55L)).thenReturn(branch);
when(deleted.isDeleted()).thenReturn(true);
when(notDeleted.getOrcsData()).thenReturn(attributeData);
@@ -157,13 +158,6 @@ public class ArtifactTest {
}
@Test
- public void testSetOrcsData() {
- ArtifactData newOrcsData = mock(ArtifactData.class);
- artifact.setOrcsData(newOrcsData);
- verify(branchProvider).setOrcsData(newOrcsData);
- }
-
- @Test
public void testGetLocalId() {
artifact.getLocalId();
verify(artifactData).getLocalId();
@@ -197,12 +191,6 @@ public class ArtifactTest {
}
@Test
- public void testGetBranch() throws OseeCoreException {
- artifact.getBranch();
- verify(branchProvider).get();
- }
-
- @Test
public void testArtifactType() throws OseeCoreException {
artifact.getArtifactType();
verify(types).getByUuid(artifactData.getTypeUuid());
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 b67dd01a04..f3cf803556 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
@@ -199,7 +199,7 @@ public class BranchDataFactoryTest {
assertEquals(fromTx, actual.getFromTransaction());
assertEquals(-1, actual.getMergeAddressingQueryId());
- assertEquals(-1, actual.getMergeDestinationBranchId());
+ assertEquals(-1L, actual.getMergeDestinationBranchId());
assertEquals(author, actual.getUserArtifact());
assertEquals(author.getLocalId(), actual.getUserArtifactId());
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphBuilderImplTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphBuilderImplTest.java
index 508a545166..6ed39b267f 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphBuilderImplTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphBuilderImplTest.java
@@ -125,17 +125,18 @@ public class GraphBuilderImplTest {
@Test
public void testGetNodeOrAdjanciesNull() throws OseeCoreException {
when(graphData.getNode(artifactData)).thenReturn(null);
- when(artifactFactory.createArtifact(artifactData)).thenReturn(artifact);
+ when(artifactFactory.createArtifact(session, artifactData)).thenReturn(artifact);
when(graphData.getNode(60)).thenReturn(null);
when(graphData.getNode(relationData)).thenReturn(null);
+ when(graphData.getSession()).thenReturn(session);
builder.onLoadStart();
builder.onLoadDescription(description);
builder.onData(artifactData);
verify(graphData).addNode(artifact);
- verify(artifactFactory).createArtifact(artifactData);
+ verify(artifactFactory).createArtifact(session, artifactData);
verify(relationFactory, times(1)).createRelationContainer();
reset(relationFactory);
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphDataImplTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphDataImplTest.java
index c45b22f949..7e3c5a2c1d 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphDataImplTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphDataImplTest.java
@@ -25,6 +25,7 @@ import org.eclipse.osee.framework.core.enums.DeletionFlag;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.OrcsSession;
import org.eclipse.osee.orcs.core.ds.ArtifactData;
import org.eclipse.osee.orcs.core.ds.AttributeData;
import org.eclipse.osee.orcs.core.ds.LoadDescription;
@@ -84,6 +85,8 @@ public class GraphDataImplTest {
@Mock private Relation relation2;
@Mock private Relation relation3;
+ @Mock private OrcsSession session;
+
// @formatter:on
private GraphDataImpl graph;
@@ -93,7 +96,7 @@ public class GraphDataImplTest {
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
- graph = new GraphDataImpl(branch, TRANSACTION_ID);
+ graph = new GraphDataImpl(session, branch, TRANSACTION_ID);
}
@Test
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/RelationTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/RelationTest.java
index 29c99aeed1..7f7480dff1 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/RelationTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/relation/RelationTest.java
@@ -19,11 +19,8 @@ import static org.mockito.Mockito.when;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.enums.RelationSide;
-import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.orcs.core.ds.OrcsData;
import org.eclipse.osee.orcs.core.ds.RelationData;
-import org.eclipse.osee.orcs.core.internal.util.ValueProvider;
import org.eclipse.osee.orcs.data.RelationTypes;
import org.junit.Before;
import org.junit.Test;
@@ -41,7 +38,6 @@ public class RelationTest {
private static final long TYPE_UUID = 123124514L;
// @formatter:off
- @Mock private ValueProvider<Branch, OrcsData> branchProvider;
@Mock private RelationTypes relationTypes;
@Mock RelationData data;
// @formatter:on
@@ -52,7 +48,7 @@ public class RelationTest {
public void init() {
MockitoAnnotations.initMocks(this);
- relation = new Relation(relationTypes, data, branchProvider);
+ relation = new Relation(relationTypes, data);
when(data.getTypeUuid()).thenReturn(TYPE_UUID);
}
@@ -84,12 +80,6 @@ public class RelationTest {
}
@Test
- public void testGetBranch() throws OseeCoreException {
- relation.getBranch();
- verify(branchProvider).get();
- }
-
- @Test
public void testGetRelationType() throws OseeCoreException {
relation.getRelationType();
@@ -108,13 +98,6 @@ public class RelationTest {
}
@Test
- public void testSetOrcsData() {
- relation.setOrcsData(data);
-
- verify(branchProvider).setOrcsData(data);
- }
-
- @Test
public void testDirty() {
relation.setDirty();
assertTrue(relation.isDirty());
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImplTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImplTest.java
index 7d3273c220..83289db0f7 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImplTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImplTest.java
@@ -45,7 +45,6 @@ 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.CoreBranches;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.logger.Log;
@@ -56,6 +55,7 @@ import org.eclipse.osee.orcs.core.internal.relation.RelationUtil;
import org.eclipse.osee.orcs.data.ArtifactId;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.AttributeReadable;
+import org.eclipse.osee.orcs.data.TransactionReadable;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -348,8 +348,8 @@ public class TransactionBuilderImplTest {
@SuppressWarnings("unchecked")
@Test
public void testCommit() throws Exception {
- CancellableCallable<TransactionRecord> callable = mock(CancellableCallable.class);
- TransactionRecord tx = mock(TransactionRecord.class);
+ CancellableCallable<TransactionReadable> callable = mock(CancellableCallable.class);
+ TransactionReadable tx = mock(TransactionReadable.class);
when(txCallableFactory.createTx(txData)).thenReturn(callable);
when(callable.call()).thenReturn(tx);
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TxCallableFactoryTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TxCallableFactoryTest.java
index c79386f34f..331e7b4276 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TxCallableFactoryTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TxCallableFactoryTest.java
@@ -23,7 +23,6 @@ import java.util.Collections;
import java.util.concurrent.Callable;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.ITransaction;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsSession;
@@ -36,6 +35,7 @@ import org.eclipse.osee.orcs.core.internal.proxy.ExternalArtifactManager;
import org.eclipse.osee.orcs.core.internal.relation.RelationManager;
import org.eclipse.osee.orcs.core.internal.transaction.TxDataManager.TxDataLoader;
import org.eclipse.osee.orcs.data.ArtifactReadable;
+import org.eclipse.osee.orcs.data.TransactionReadable;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
@@ -117,13 +117,13 @@ public class TxCallableFactoryTest {
}
});
- TransactionRecord newTx = mock(TransactionRecord.class);
+ TransactionReadable newTx = mock(TransactionReadable.class);
when(txResult.getTransaction()).thenReturn(newTx);
Assert.assertFalse(data.isCommitInProgress());
- TransactionRecord actual = txFactory.createTx(data).call();
+ TransactionReadable actual = txFactory.createTx(data).call();
assertEquals(newTx, actual);
assertFalse(data.isCommitInProgress());
diff --git a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManagerTest.java b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManagerTest.java
index 95ae043cdf..ad06da19be 100644
--- a/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManagerTest.java
+++ b/plugins/org.eclipse.osee.orcs.core.test/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManagerTest.java
@@ -40,11 +40,12 @@ import org.eclipse.osee.framework.jdk.core.type.ResultSets;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.orcs.OrcsSession;
import org.eclipse.osee.orcs.core.ds.ArtifactData;
-import org.eclipse.osee.orcs.core.ds.OrcsData;
import org.eclipse.osee.orcs.core.ds.TransactionData;
+import org.eclipse.osee.orcs.core.ds.VersionData;
import org.eclipse.osee.orcs.core.internal.artifact.Artifact;
import org.eclipse.osee.orcs.core.internal.artifact.ArtifactFactory;
import org.eclipse.osee.orcs.core.internal.artifact.ArtifactImpl;
+import org.eclipse.osee.orcs.core.internal.artifact.ArtifactImpl.BranchProvider;
import org.eclipse.osee.orcs.core.internal.graph.GraphData;
import org.eclipse.osee.orcs.core.internal.proxy.ExternalArtifactManager;
import org.eclipse.osee.orcs.core.internal.relation.Relation;
@@ -53,7 +54,6 @@ import org.eclipse.osee.orcs.core.internal.relation.RelationNode;
import org.eclipse.osee.orcs.core.internal.relation.impl.RelationNodeAdjacencies;
import org.eclipse.osee.orcs.core.internal.transaction.TxData.TxState;
import org.eclipse.osee.orcs.core.internal.transaction.TxDataManager.TxDataLoader;
-import org.eclipse.osee.orcs.core.internal.util.ValueProvider;
import org.eclipse.osee.orcs.data.ArtifactId;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.junit.Before;
@@ -86,6 +86,7 @@ public class TxDataManagerTest {
@Mock private ArtifactFactory artifactFactory;
@Mock private RelationManager relationManager;
@Mock private TxDataLoader loader;
+ @Mock private BranchProvider provider;
@Mock private TxData txData;
@Mock private GraphData graph;
@@ -122,6 +123,9 @@ public class TxDataManagerTest {
when(proxyManager.asInternalArtifact(readable1)).thenReturn(artifact1);
when(proxyManager.asExternalArtifact(session, artifact1)).thenReturn(readable1);
+ when(branch.getUuid()).thenReturn(111L);
+ when(provider.getBranch(111L)).thenReturn(branch);
+
when(txData.getSession()).thenReturn(session);
when(txData.getBranch()).thenReturn(branch);
when(txData.getGraph()).thenReturn(graph);
@@ -225,13 +229,13 @@ public class TxDataManagerTest {
public void testGetForWriteReadable() throws OseeCoreException {
when(txData.getWriteable(readable1)).thenReturn(null);
when(proxyManager.asInternalArtifact(readable1)).thenReturn(artifact1);
- when(artifactFactory.clone(artifact1)).thenReturn(artifact2);
+ when(artifactFactory.clone(session, artifact1)).thenReturn(artifact2);
Artifact actual = txDataManager.getForWrite(txData, readable1);
verify(txData).getWriteable(readable1);
verify(proxyManager).asInternalArtifact(readable1);
- verify(artifactFactory).clone(artifact1);
+ verify(artifactFactory).clone(session, artifact1);
assertEquals(artifact2, actual);
}
@@ -259,12 +263,12 @@ public class TxDataManagerTest {
@Test
public void testGetForWriteArtifact() throws OseeCoreException {
when(txData.getWriteable(artifact1)).thenReturn(null);
- when(artifactFactory.clone(artifact1)).thenReturn(artifact2);
+ when(artifactFactory.clone(session, artifact1)).thenReturn(artifact2);
Artifact actual = txDataManager.getForWrite(txData, artifact1);
verify(txData).getWriteable(artifact1);
- verify(artifactFactory).clone(artifact1);
+ verify(artifactFactory).clone(session, artifact1);
assertEquals(artifact2, actual);
}
@@ -313,7 +317,7 @@ public class TxDataManagerTest {
@Test
public void testGetForWriteDuringWrite() throws OseeCoreException {
when(txData.add(artifact1)).thenReturn(artifact3);
- when(artifactFactory.clone(artifact1)).thenReturn(artifact1);
+ when(artifactFactory.clone(session, artifact1)).thenReturn(artifact1);
thrown.expect(OseeArgumentException.class);
thrown.expectMessage("Another instance of writeable detected - writeable tracking would be inconsistent");
@@ -352,13 +356,13 @@ public class TxDataManagerTest {
public void testCreateArtifact() throws OseeCoreException {
when(txData.isCommitInProgress()).thenReturn(false);
when(txData.getTxState()).thenReturn(TxState.NEW_TX);
- when(artifactFactory.createArtifact(branch, DirectSoftwareRequirement, guid)).thenReturn(artifact1);
+ when(artifactFactory.createArtifact(session, branch, DirectSoftwareRequirement, guid)).thenReturn(artifact1);
when(proxyManager.asExternalArtifact(session, artifact1)).thenReturn(readable1);
ArtifactReadable actual =
txDataManager.createArtifact(txData, DirectSoftwareRequirement, "Direct SW requirement", guid);
- verify(artifactFactory).createArtifact(branch, DirectSoftwareRequirement, guid);
+ verify(artifactFactory).createArtifact(session, branch, DirectSoftwareRequirement, guid);
assertEquals(readable1, actual);
}
@@ -367,13 +371,13 @@ public class TxDataManagerTest {
when(txData.isCommitInProgress()).thenReturn(false);
when(txData.getTxState()).thenReturn(TxState.NEW_TX);
when(txData.getWriteable(readable1)).thenReturn(artifact1);
- when(artifactFactory.copyArtifact(artifact1, types, branch)).thenReturn(artifact2);
+ when(artifactFactory.copyArtifact(session, artifact1, types, branch)).thenReturn(artifact2);
when(proxyManager.asExternalArtifact(session, artifact2)).thenReturn(readable2);
ArtifactReadable actual = txDataManager.copyArtifact(txData, branch, readable1);
verify(txData).getWriteable(readable1);
- verify(artifactFactory).copyArtifact(artifact1, types, branch);
+ verify(artifactFactory).copyArtifact(session, artifact1, types, branch);
verify(proxyManager).asExternalArtifact(session, artifact2);
assertEquals(readable2, actual);
@@ -387,14 +391,14 @@ public class TxDataManagerTest {
when(txData.getWriteable(readable1)).thenReturn(null);
when(proxyManager.asInternalArtifact(readable1)).thenReturn(artifact1);
- when(artifactFactory.copyArtifact(artifact1, types, branch)).thenReturn(artifact2);
+ when(artifactFactory.copyArtifact(session, artifact1, types, branch)).thenReturn(artifact2);
when(proxyManager.asExternalArtifact(session, artifact2)).thenReturn(readable2);
ArtifactReadable actual = txDataManager.copyArtifact(txData, branch, readable1);
verify(txData).getWriteable(readable1);
verify(proxyManager).asInternalArtifact(readable1);
- verify(artifactFactory).copyArtifact(artifact1, types, branch);
+ verify(artifactFactory).copyArtifact(session, artifact1, types, branch);
verify(proxyManager).asExternalArtifact(session, artifact2);
assertEquals(readable2, actual);
@@ -405,14 +409,13 @@ public class TxDataManagerTest {
String guid = GUID.create();
ArtifactData data = Mockito.mock(ArtifactData.class);
-
- @SuppressWarnings("unchecked")
- ValueProvider<IOseeBranch, OrcsData> provider = Mockito.mock(ValueProvider.class);
+ VersionData version = Mockito.mock(VersionData.class);
+ when(data.getVersion()).thenReturn(version);
+ when(version.getBranchId()).thenReturn(111L);
Artifact sourceArtifact = Mockito.spy(new ArtifactImpl(null, data, null, provider));
when(data.getGuid()).thenReturn(guid);
- when(provider.get()).thenReturn(branch);
List<? extends IAttributeType> copyTypes = Arrays.asList(CoreAttributeTypes.Active, CoreAttributeTypes.Name);
when(sourceArtifact.getExistingAttributeTypes()).thenAnswer(answerValue(copyTypes));
@@ -420,13 +423,13 @@ public class TxDataManagerTest {
when(txData.isCommitInProgress()).thenReturn(false);
when(txData.getTxState()).thenReturn(TxState.NEW_TX);
when(txData.getWriteable(sourceArtifact)).thenReturn(null);
- when(artifactFactory.copyArtifact(sourceArtifact, copyTypes, branch)).thenReturn(artifact2);
+ when(artifactFactory.copyArtifact(session, sourceArtifact, copyTypes, branch)).thenReturn(artifact2);
when(proxyManager.asExternalArtifact(session, artifact2)).thenReturn(readable2);
ArtifactReadable actual = txDataManager.copyArtifact(txData, branch, sourceArtifact);
verify(txData).getWriteable(sourceArtifact);
- verify(artifactFactory).copyArtifact(sourceArtifact, copyTypes, branch);
+ verify(artifactFactory).copyArtifact(session, sourceArtifact, copyTypes, branch);
assertEquals(readable2, actual);
}
@@ -437,13 +440,13 @@ public class TxDataManagerTest {
when(txData.getTxState()).thenReturn(TxState.NEW_TX);
when(txData.getWriteable(artifactId1)).thenReturn(artifact1);
when(artifact1.getExistingAttributeTypes()).thenAnswer(answerValue(types));
- when(artifactFactory.copyArtifact(artifact1, types, branch)).thenReturn(artifact2);
+ when(artifactFactory.copyArtifact(session, artifact1, types, branch)).thenReturn(artifact2);
when(proxyManager.asExternalArtifact(session, artifact2)).thenReturn(readable2);
ArtifactReadable actual = txDataManager.copyArtifact(txData, branch, artifactId1);
verify(txData).getWriteable(artifactId1);
- verify(artifactFactory).copyArtifact(artifact1, types, branch);
+ verify(artifactFactory).copyArtifact(session, artifact1, types, branch);
verify(proxyManager).asExternalArtifact(session, artifact2);
assertEquals(readable2, actual);
@@ -468,21 +471,21 @@ public class TxDataManagerTest {
ResultSet<Artifact> loaded = ResultSets.singleton(artifact1);
when(loader.loadArtifacts(eq(session), eq(COMMON), anyCollectionOf(ArtifactId.class))).thenReturn(loaded);
- when(artifactFactory.introduceArtifact(artifact1, branch)).thenReturn(artifact2);
+ when(artifactFactory.introduceArtifact(session, artifact1, branch)).thenReturn(artifact2);
when(proxyManager.asExternalArtifact(session, artifact2)).thenReturn(readable2);
ArtifactReadable actual = txDataManager.introduceArtifact(txData, COMMON, artifactId1);
verify(loader).loadArtifacts(eq(session), eq(COMMON), idCaptor.capture());
assertEquals(artifactId1, idCaptor.getValue().iterator().next());
- verify(artifactFactory).introduceArtifact(artifact1, branch);
+ verify(artifactFactory).introduceArtifact(session, artifact1, branch);
verify(proxyManager).asExternalArtifact(session, artifact2);
assertEquals(readable2, actual);
}
@Test
public void testDeleteArtifact() throws OseeCoreException {
- when(artifactFactory.clone(artifact1)).thenReturn(artifact2);
+ when(artifactFactory.clone(session, artifact1)).thenReturn(artifact2);
txDataManager.deleteArtifact(txData, artifact1);
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/ArtifactData.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/ArtifactData.java
index d7b7ea1a84..dfa588758b 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/ArtifactData.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/ArtifactData.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.orcs.core.ds;
+
/**
* @author Roberto E. Escobar
*/
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/BranchDataStore.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/BranchDataStore.java
index e01178bdf2..9e0c680ebf 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/BranchDataStore.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/BranchDataStore.java
@@ -16,8 +16,6 @@ import java.util.concurrent.Callable;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.BranchState;
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.change.ChangeItem;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.orcs.OrcsSession;
@@ -26,21 +24,22 @@ import org.eclipse.osee.orcs.data.ArchiveOperation;
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;
/**
* @author Roberto E. Escobar
*/
public interface BranchDataStore {
- Callable<Branch> createBranch(OrcsSession session, CreateBranchData branchData);
+ Callable<Void> createBranch(OrcsSession session, CreateBranchData branchData);
- Callable<Branch> createBranchCopyTx(OrcsSession session, CreateBranchData branchData);
+ Callable<Void> createBranchCopyTx(OrcsSession session, CreateBranchData branchData);
Callable<Void> purgeBranch(OrcsSession session, BranchReadable branch);
- Callable<TransactionRecord> commitBranch(OrcsSession session, ArtifactReadable committer, Branch source, Branch destination);
+ Callable<Integer> commitBranch(OrcsSession session, ArtifactReadable committer, BranchReadable source, TransactionReadable sourceHead, BranchReadable destination, TransactionReadable destinationHead);
- Callable<List<ChangeItem>> compareBranch(OrcsSession session, TransactionRecord sourceTx, TransactionRecord destinationTx);
+ Callable<List<ChangeItem>> compareBranch(OrcsSession session, TransactionReadable sourceTx, TransactionReadable destinationTx);
Callable<URI> exportBranch(OrcsSession session, OrcsTypes orcsTypes, List<IOseeBranch> branches, PropertyStore options, String exportName);
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/TransactionResult.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/TransactionResult.java
index a6217773b8..9ac1192245 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/TransactionResult.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/ds/TransactionResult.java
@@ -10,10 +10,10 @@
*******************************************************************************/
package org.eclipse.osee.orcs.core.ds;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.orcs.data.TransactionReadable;
public interface TransactionResult extends HasOrcsChangeSet {
- TransactionRecord getTransaction();
+ TransactionReadable getTransaction();
}
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 b3fe7aa70f..71a1b982e0 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
@@ -35,6 +35,8 @@ import org.eclipse.osee.orcs.core.SystemPreferences;
import org.eclipse.osee.orcs.core.ds.DataModule;
import org.eclipse.osee.orcs.core.ds.OrcsDataStore;
import org.eclipse.osee.orcs.core.internal.artifact.ArtifactFactory;
+import org.eclipse.osee.orcs.core.internal.artifact.ArtifactFactory.BranchProviderFactory;
+import org.eclipse.osee.orcs.core.internal.artifact.ArtifactImpl.BranchProvider;
import org.eclipse.osee.orcs.core.internal.attribute.AttributeClassRegistry;
import org.eclipse.osee.orcs.core.internal.attribute.AttributeClassResolver;
import org.eclipse.osee.orcs.core.internal.attribute.AttributeFactory;
@@ -56,12 +58,13 @@ import org.eclipse.osee.orcs.core.internal.session.OrcsSessionImpl;
import org.eclipse.osee.orcs.core.internal.transaction.TransactionFactoryImpl;
import org.eclipse.osee.orcs.core.internal.transaction.TxCallableFactory;
import org.eclipse.osee.orcs.core.internal.transaction.TxDataLoaderImpl;
+import org.eclipse.osee.orcs.core.internal.transaction.TxDataLoaderImpl.TransactionProvider;
import org.eclipse.osee.orcs.core.internal.transaction.TxDataManager;
import org.eclipse.osee.orcs.core.internal.transaction.TxDataManager.TxDataLoader;
import org.eclipse.osee.orcs.core.internal.types.BranchHierarchyProvider;
import org.eclipse.osee.orcs.core.internal.types.OrcsTypesModule;
-import org.eclipse.osee.orcs.core.internal.util.ValueProviderFactory;
import org.eclipse.osee.orcs.data.ArtifactReadable;
+import org.eclipse.osee.orcs.data.BranchReadable;
import org.eclipse.osee.orcs.search.BranchQuery;
import org.eclipse.osee.orcs.search.QueryFactory;
import org.eclipse.osee.orcs.search.QueryIndexer;
@@ -153,14 +156,14 @@ public class OrcsApiImpl implements OrcsApi {
AttributeClassResolver resolver = new AttributeClassResolver(registry, orcsTypes.getAttributeTypes());
AttributeFactory attributeFactory =
new AttributeFactory(resolver, module.getDataFactory(), orcsTypes.getAttributeTypes());
- ValueProviderFactory providerFactory = new ValueProviderFactory(cacheService.getBranchCache());
+
ArtifactFactory artifactFactory =
- new ArtifactFactory(module.getDataFactory(), attributeFactory, orcsTypes.getArtifactTypes(), providerFactory);
+ new ArtifactFactory(module.getDataFactory(), attributeFactory, orcsTypes.getArtifactTypes(),
+ new BranchProviderFactoryImpl());
- RelationFactory relationFactory =
- new RelationFactory(orcsTypes.getRelationTypes(), module.getDataFactory(), providerFactory);
+ RelationFactory relationFactory = new RelationFactory(orcsTypes.getRelationTypes(), module.getDataFactory());
- final GraphFactory graphFactory = new GraphFactoryImpl(cacheService.getBranchCache());
+ final GraphFactory graphFactory = new GraphFactoryImpl();
GraphBuilderFactory graphBuilderFactory =
new GraphBuilderFactory(logger, artifactFactory, attributeFactory, relationFactory);
@@ -172,14 +175,24 @@ public class OrcsApiImpl implements OrcsApi {
@Override
public GraphData getGraph(OrcsSession session, IOseeBranch branch, int transactionId) throws OseeCoreException {
- return graphFactory.createGraph(branch, transactionId);
+ return graphFactory.createGraph(session, branch, transactionId);
}
};
ExternalArtifactManager proxyManager = new ExternalArtifactManagerImpl(relationManager);
+ TransactionProvider txProvider = new TransactionProvider() {
+
+ @Override
+ public int getHeadTransaction(OrcsSession session, IOseeBranch branch) {
+ QueryFactory queryFactory = queryModule.createQueryFactory(session);
+ return queryFactory.transactionQuery().andIsHead(branch).getResultsAsIds().getExactlyOne();
+ }
+ };
+
TxDataLoader txDataLoader =
- new TxDataLoaderImpl(module.getDataLoaderFactory(), graphFactory, graphBuilderFactory, graphProvider);
+ new TxDataLoaderImpl(module.getDataLoaderFactory(), graphFactory, graphBuilderFactory, graphProvider,
+ txProvider);
txDataManager = new TxDataManager(proxyManager, artifactFactory, relationManager, txDataLoader);
txCallableFactory = new TxCallableFactory(logger, module.getTxDataStore(), txDataManager);
@@ -230,7 +243,7 @@ public class OrcsApiImpl implements OrcsApi {
};
QueryFactory queryFactory = getQueryFactory(context);
return new OrcsBranchImpl(logger, session, module.getBranchDataStore(), queryFactory, systemUser,
- getOrcsTypes(context), cacheService.getBranchCache(), cacheService.getTransactionCache());
+ getOrcsTypes(context));
}
@Override
@@ -284,4 +297,27 @@ public class OrcsApiImpl implements OrcsApi {
return new OrcsSessionImpl(sessionId);
}
+ private class BranchProviderFactoryImpl implements BranchProviderFactory {
+
+ @Override
+ public BranchProvider createBranchProvider(final OrcsSession session) {
+ BranchProvider provider = new BranchProvider() {
+
+ BranchReadable cached = null;
+
+ @Override
+ public BranchReadable getBranch(Long branchUuid) {
+ if (cached == null || !cached.getUuid().equals(branchUuid)) {
+ BranchQuery query = queryModule.createQueryFactory(session).branchQuery();
+ cached = query.andUuids(branchUuid).getResults().getExactlyOne();
+ }
+ return cached;
+ }
+
+ };
+ return provider;
+ }
+
+ }
+
}
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 eccf5a865a..90e5968697 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
@@ -17,10 +17,6 @@ import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.ITransaction;
import org.eclipse.osee.framework.core.enums.BranchState;
import org.eclipse.osee.framework.core.enums.BranchType;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.BranchReadable;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.jdk.core.type.LazyObject;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -37,7 +33,9 @@ import org.eclipse.osee.orcs.core.internal.branch.CreateBranchCallable;
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.BranchReadable;
import org.eclipse.osee.orcs.data.CreateBranchData;
+import org.eclipse.osee.orcs.data.TransactionReadable;
import org.eclipse.osee.orcs.search.QueryFactory;
/**
@@ -53,23 +51,18 @@ public class OrcsBranchImpl implements OrcsBranch {
private final OrcsTypes orcsTypes;
private final QueryFactory queryFactory;
- 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) {
+ public OrcsBranchImpl(Log logger, OrcsSession session, BranchDataStore branchStore, QueryFactory queryFactory, LazyObject<ArtifactReadable> systemUser, OrcsTypes orcsTypes) {
this.logger = logger;
this.session = session;
this.branchStore = branchStore;
branchDataFactory = new BranchDataFactory(queryFactory);
this.orcsTypes = orcsTypes;
- this.branchCache = branchCache;
- branchDataFactory = new BranchDataFactory(branchCache);
this.queryFactory = queryFactory;
}
@Override
public Callable<BranchReadable> createBranch(CreateBranchData branchData) {
- return new CreateBranchCallable(logger, session, branchStore, branchData);
+ return new CreateBranchCallable(logger, session, branchStore, branchData, queryFactory);
}
@Override
@@ -88,20 +81,21 @@ public class OrcsBranchImpl implements OrcsBranch {
}
@Override
- public Callable<TransactionRecord> commitBranch(ArtifactReadable committer, IOseeBranch source, IOseeBranch destination) {
- return new CommitBranchCallable(logger, session, branchStore, branchCache, committer, source, destination);
+ public Callable<TransactionReadable> commitBranch(ArtifactReadable committer, IOseeBranch source, IOseeBranch destination) {
+ return new CommitBranchCallable(logger, session, branchStore, queryFactory, committer, source, destination);
}
@Override
- public Callable<List<ChangeItem>> compareBranch(ITransaction sourceTx, ITransaction destinationTx) {
- return new CompareBranchCallable(logger, session, branchCache, branchStore, sourceTx, destinationTx);
+ public Callable<List<ChangeItem>> compareBranch(TransactionReadable sourceTx, TransactionReadable destinationTx) {
+ return new CompareBranchCallable(logger, session, branchStore, sourceTx, destinationTx);
}
@Override
public Callable<List<ChangeItem>> compareBranch(IOseeBranch branch) throws OseeCoreException {
- Branch fullBranch = branchCache.get(branch);
- TransactionRecord fromTx = fullBranch.getBaseTransaction();
- TransactionRecord toTx = branchCache.getHeadTransaction(fullBranch);
+ int baseTransaction = queryFactory.branchQuery().andIds(branch).getResults().getExactlyOne().getBaseTransaction();
+ TransactionReadable fromTx =
+ queryFactory.transactionQuery().andTxId(baseTransaction).getResults().getExactlyOne();
+ TransactionReadable toTx = queryFactory.transactionQuery().andIsHead(branch).getResults().getExactlyOne();
return branchStore.compareBranch(session, fromTx, toTx);
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactory.java
index 68cabb36e7..3692db6c5b 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactory.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactFactory.java
@@ -17,17 +17,15 @@ import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
+import org.eclipse.osee.orcs.OrcsSession;
import org.eclipse.osee.orcs.core.ds.ArtifactData;
import org.eclipse.osee.orcs.core.ds.ArtifactDataFactory;
import org.eclipse.osee.orcs.core.ds.AttributeData;
-import org.eclipse.osee.orcs.core.ds.OrcsData;
+import org.eclipse.osee.orcs.core.internal.artifact.ArtifactImpl.BranchProvider;
import org.eclipse.osee.orcs.core.internal.attribute.Attribute;
import org.eclipse.osee.orcs.core.internal.attribute.AttributeFactory;
-import org.eclipse.osee.orcs.core.internal.util.ValueProvider;
-import org.eclipse.osee.orcs.core.internal.util.ValueProviderFactory;
import org.eclipse.osee.orcs.data.ArtifactTypes;
import org.eclipse.osee.orcs.data.AttributeReadable;
@@ -39,35 +37,34 @@ public class ArtifactFactory {
private final ArtifactDataFactory factory;
private final AttributeFactory attributeFactory;
private final ArtifactTypes artifactTypeCache;
- private final ValueProviderFactory providerFactory;
+ private final BranchProviderFactory branchProviderFactory;
- public ArtifactFactory(ArtifactDataFactory factory, AttributeFactory attributeFactory, ArtifactTypes artifactTypeCache, ValueProviderFactory providerFactory) {
- super();
+ public static interface BranchProviderFactory {
+ BranchProvider createBranchProvider(OrcsSession session);
+ }
+
+ public ArtifactFactory(ArtifactDataFactory factory, AttributeFactory attributeFactory, ArtifactTypes artifactTypeCache, BranchProviderFactory branchProviderFactory) {
this.factory = factory;
this.attributeFactory = attributeFactory;
this.artifactTypeCache = artifactTypeCache;
- this.providerFactory = providerFactory;
+ this.branchProviderFactory = branchProviderFactory;
}
- public Artifact createArtifact(ArtifactData artifactData) throws OseeCoreException {
- //TODO implement an artifact class resolver for specific artifact types
- ValueProvider<Branch, OrcsData> branchProvider = providerFactory.createBranchProvider(artifactData);
+ public Artifact createArtifact(final OrcsSession session, ArtifactData artifactData) throws OseeCoreException {
+ BranchProvider branchProvider = branchProviderFactory.createBranchProvider(session);
return new ArtifactImpl(artifactTypeCache, artifactData, attributeFactory, branchProvider);
}
- public Artifact createArtifact(IOseeBranch branch, IArtifactType artifactType, String guid) throws OseeCoreException {
+ public Artifact createArtifact(OrcsSession session, IOseeBranch branch, IArtifactType artifactType, String guid) throws OseeCoreException {
ArtifactData artifactData = factory.create(branch, artifactType, guid);
- Artifact artifact = createArtifact(artifactData);
+ Artifact artifact = createArtifact(session, artifactData);
artifact.setLoaded(true);
-
- // ArtifactCache.cache(artifact);
- // artifact.setLinksLoaded(true);
return artifact;
}
- public Artifact copyArtifact(Artifact source, Collection<? extends IAttributeType> types, IOseeBranch ontoBranch) throws OseeCoreException {
+ public Artifact copyArtifact(OrcsSession session, Artifact source, Collection<? extends IAttributeType> types, IOseeBranch ontoBranch) throws OseeCoreException {
ArtifactData artifactData = factory.copy(ontoBranch, source.getOrcsData());
- Artifact copy = createArtifact(artifactData);
+ Artifact copy = createArtifact(session, artifactData);
Collection<? extends IAttributeType> typeToCopy = getAllowedTypes(copy, types);
for (IAttributeType attributeType : typeToCopy) {
for (AttributeReadable<?> attributeSource : source.getAttributes(attributeType)) {
@@ -79,12 +76,12 @@ public class ArtifactFactory {
return copy;
}
- public Artifact introduceArtifact(Artifact source, IOseeBranch ontoBranch) throws OseeCoreException {
+ public Artifact introduceArtifact(OrcsSession session, Artifact source, IOseeBranch ontoBranch) throws OseeCoreException {
Conditions.checkExpressionFailOnTrue(ontoBranch.equals(source.getBranch()),
"Source artifact is on the same branch as [%s]", ontoBranch);
ArtifactData artifactData = factory.introduce(ontoBranch, source.getOrcsData());
- Artifact introducedArt = createArtifact(artifactData);
+ Artifact introducedArt = createArtifact(session, artifactData);
Collection<? extends IAttributeType> typeToCopy =
getAllowedTypes(introducedArt, source.getExistingAttributeTypes());
for (IAttributeType attributeType : typeToCopy) {
@@ -97,9 +94,9 @@ public class ArtifactFactory {
return introducedArt;
}
- public Artifact clone(Artifact source) throws OseeCoreException {
+ public Artifact clone(OrcsSession session, Artifact source) throws OseeCoreException {
ArtifactData artifactData = factory.clone(source.getOrcsData());
- Artifact copy = createArtifact(artifactData);
+ Artifact copy = createArtifact(session, artifactData);
for (IAttributeType attributeType : source.getExistingAttributeTypes()) {
for (AttributeReadable<?> attributeSource : source.getAttributes(attributeType)) {
AttributeData data = getAttributeData(attributeSource);
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactImpl.java
index 16e0246ed0..41c469901b 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/artifact/ArtifactImpl.java
@@ -21,25 +21,27 @@ import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.orcs.core.ds.ArtifactData;
-import org.eclipse.osee.orcs.core.ds.OrcsData;
import org.eclipse.osee.orcs.core.internal.attribute.Attribute;
import org.eclipse.osee.orcs.core.internal.attribute.AttributeFactory;
import org.eclipse.osee.orcs.core.internal.attribute.AttributeManagerImpl;
import org.eclipse.osee.orcs.core.internal.graph.GraphData;
import org.eclipse.osee.orcs.core.internal.relation.order.OrderChange;
-import org.eclipse.osee.orcs.core.internal.util.ValueProvider;
import org.eclipse.osee.orcs.data.ArtifactTypes;
public class ArtifactImpl extends AttributeManagerImpl implements Artifact {
private final ArtifactTypes artifactTypeCache;
- private final ValueProvider<? extends IOseeBranch, OrcsData> branchProvider;
private EditState objectEditState;
private ArtifactData artifactData;
private GraphData graph;
+ private final BranchProvider branchProvider;
- public ArtifactImpl(ArtifactTypes artifactTypeCache, ArtifactData artifactData, AttributeFactory attributeFactory, ValueProvider<? extends IOseeBranch, OrcsData> branchProvider) {
+ public static interface BranchProvider {
+ IOseeBranch getBranch(Long branchUuid);
+ }
+
+ public ArtifactImpl(ArtifactTypes artifactTypeCache, ArtifactData artifactData, AttributeFactory attributeFactory, BranchProvider branchProvider) {
super(artifactData.getGuid(), attributeFactory);
this.artifactTypeCache = artifactTypeCache;
this.artifactData = artifactData;
@@ -66,7 +68,6 @@ public class ArtifactImpl extends AttributeManagerImpl implements Artifact {
public void setOrcsData(ArtifactData data) {
this.artifactData = data;
objectEditState = EditState.NO_CHANGE;
- branchProvider.setOrcsData(data);
}
private ModificationType getModificationType() {
@@ -94,7 +95,7 @@ public class ArtifactImpl extends AttributeManagerImpl implements Artifact {
@Override
public IOseeBranch getBranch() throws OseeCoreException {
- return branchProvider.get();
+ return branchProvider.getBranch(artifactData.getVersion().getBranchId());
}
@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 461cae6411..a4f2576653 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
@@ -37,21 +37,24 @@ public class BranchDataFactory {
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);
+ return createBranchData(branch, CoreBranches.SYSTEM_ROOT, BranchType.BASELINE, creationComment, fromTx, author,
+ null, false);
}
public CreateBranchData createBaselineBranchData(IOseeBranch branch, ArtifactReadable author, IOseeBranch parent, ArtifactReadable associatedArtifact) throws OseeCoreException {
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);
+ return createBranchData(branch, parent, BranchType.BASELINE, creationComment, fromTx, author, associatedArtifact,
+ false);
}
public CreateBranchData createWorkingBranchData(IOseeBranch branch, ArtifactReadable author, IOseeBranch parent, ArtifactReadable associatedArtifact) throws OseeCoreException {
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);
+ return createBranchData(branch, parent, BranchType.WORKING, creationComment, fromTx, author, associatedArtifact,
+ false);
}
public CreateBranchData createCopyTxBranchData(IOseeBranch branch, ArtifactReadable author, ITransaction fromTransaction, ArtifactReadable associatedArtifact) throws OseeCoreException {
@@ -63,7 +66,8 @@ public class BranchDataFactory {
String creationComment =
String.format("Transaction %s copied from %s to create Branch %s", fromTransaction, parent.getName(),
branch.getName());
- return createBranchData(branch, BranchType.WORKING, creationComment, fromTx, author, associatedArtifact, true);
+ return createBranchData(branch, parent, BranchType.WORKING, creationComment, fromTx, author, associatedArtifact,
+ true);
}
public CreateBranchData createPortBranchData(IOseeBranch branch, ArtifactReadable author, ITransaction fromTransaction, ArtifactReadable associatedArtifact) throws OseeCoreException {
@@ -75,10 +79,11 @@ public class BranchDataFactory {
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);
+ return createBranchData(branch, parent, BranchType.PORT, creationComment, fromTx, author, associatedArtifact,
+ true);
}
- private CreateBranchData createBranchData(IOseeBranch branch, BranchType branchType, String creationComment, TransactionReadable sysRootHeadTx, ArtifactReadable author, ArtifactReadable associatedArtifact, boolean bCopyTx) {
+ private CreateBranchData createBranchData(IOseeBranch branch, IOseeBranch parent, BranchType branchType, String creationComment, TransactionReadable sysRootHeadTx, ArtifactReadable author, ArtifactReadable associatedArtifact, boolean bCopyTx) {
CreateBranchData createData = new CreateBranchData();
createData.setUuid(branch.getUuid());
createData.setName(branch.getName());
@@ -91,6 +96,9 @@ public class BranchDataFactory {
createData.setUserArtifact(author);
createData.setAssociatedArtifact(associatedArtifact);
createData.setTxCopyBranchType(bCopyTx);
+ if (parent != null) {
+ createData.setParentBranchUuid(parent.getGuid());
+ }
return createData;
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CommitBranchCallable.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CommitBranchCallable.java
index 0889013c90..843029d599 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CommitBranchCallable.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CommitBranchCallable.java
@@ -12,48 +12,48 @@ package org.eclipse.osee.orcs.core.internal.branch;
import java.util.concurrent.Callable;
import org.eclipse.osee.framework.core.data.IOseeBranch;
-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.jdk.core.util.Conditions;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsSession;
import org.eclipse.osee.orcs.core.ds.BranchDataStore;
import org.eclipse.osee.orcs.data.ArtifactReadable;
+import org.eclipse.osee.orcs.data.BranchReadable;
+import org.eclipse.osee.orcs.data.TransactionReadable;
+import org.eclipse.osee.orcs.search.QueryFactory;
-public class CommitBranchCallable extends AbstractBranchCallable<TransactionRecord> {
+public class CommitBranchCallable extends AbstractBranchCallable<TransactionReadable> {
- private final BranchCache branchCache;
private final ArtifactReadable committer;
private final IOseeBranch source;
private final IOseeBranch destination;
+ private final QueryFactory queryFactory;
- public CommitBranchCallable(Log logger, OrcsSession session, BranchDataStore branchStore, BranchCache branchCache, ArtifactReadable committer, IOseeBranch source, IOseeBranch destination) {
+ public CommitBranchCallable(Log logger, OrcsSession session, BranchDataStore branchStore, QueryFactory queryFactory, ArtifactReadable committer, IOseeBranch source, IOseeBranch destination) {
super(logger, session, branchStore);
- this.branchCache = branchCache;
this.committer = committer;
this.source = source;
this.destination = destination;
- }
-
- private BranchCache getBranchCache() {
- return branchCache;
+ this.queryFactory = queryFactory;
}
@Override
- protected TransactionRecord innerCall() throws Exception {
- Conditions.checkNotNull(branchCache, "branchCache");
+ protected TransactionReadable innerCall() throws Exception {
Conditions.checkNotNull(source, "sourceBranch");
Conditions.checkNotNull(destination, "destinationBranch");
- Branch sourceBranch = getBranchCache().get(source);
- Branch destinationBranch = getBranchCache().get(destination);
+ BranchReadable sourceBranch = queryFactory.branchQuery().andIds(source).getResults().getExactlyOne();
+ TransactionReadable sourceHead = queryFactory.transactionQuery().andIsHead(source).getResults().getExactlyOne();
+ BranchReadable destinationBranch = queryFactory.branchQuery().andIds(destination).getResults().getExactlyOne();
+ TransactionReadable destinationHead =
+ queryFactory.transactionQuery().andIsHead(destination).getResults().getExactlyOne();
Conditions.checkNotNull(sourceBranch, "sourceBranch");
Conditions.checkNotNull(destinationBranch, "destinationBranch");
- Callable<TransactionRecord> commitBranchCallable =
- getBranchStore().commitBranch(getSession(), committer, sourceBranch, destinationBranch);
- return callAndCheckForCancel(commitBranchCallable);
+ Callable<Integer> commitBranchCallable =
+ getBranchStore().commitBranch(getSession(), committer, sourceBranch, sourceHead, destinationBranch,
+ destinationHead);
+ Integer newTx = callAndCheckForCancel(commitBranchCallable);
+ return queryFactory.transactionQuery().andTxId(newTx).getResults().getExactlyOne();
}
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CompareBranchCallable.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CompareBranchCallable.java
index 045c34118f..b3439cb4c9 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CompareBranchCallable.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CompareBranchCallable.java
@@ -12,26 +12,22 @@ package org.eclipse.osee.orcs.core.internal.branch;
import java.util.List;
import java.util.concurrent.Callable;
-import org.eclipse.osee.framework.core.data.ITransaction;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsSession;
import org.eclipse.osee.orcs.core.ds.BranchDataStore;
+import org.eclipse.osee.orcs.data.TransactionReadable;
public class CompareBranchCallable extends AbstractBranchCallable<List<ChangeItem>> {
- private final ITransaction sourceTx;
- private final ITransaction destinationTx;
- private final BranchCache branchCache;
+ private final TransactionReadable sourceTx;
+ private final TransactionReadable destinationTx;
- public CompareBranchCallable(Log logger, OrcsSession session, BranchCache branchCache, BranchDataStore branchStore, ITransaction sourceTx, ITransaction destinationTx) {
+ public CompareBranchCallable(Log logger, OrcsSession session, BranchDataStore branchStore, TransactionReadable sourceTx, TransactionReadable destinationTx) {
super(logger, session, branchStore);
this.sourceTx = sourceTx;
this.destinationTx = destinationTx;
- this.branchCache = branchCache;
}
@Override
@@ -39,13 +35,7 @@ public class CompareBranchCallable extends AbstractBranchCallable<List<ChangeIte
Conditions.checkNotNull(sourceTx, "sourceTx");
Conditions.checkNotNull(destinationTx, "destinationTx");
- TransactionRecord source = branchCache.getOrLoad(sourceTx.getGuid());
- TransactionRecord destination = branchCache.getOrLoad(destinationTx.getGuid());
-
- Conditions.checkNotNull(source, "sourceTx");
- Conditions.checkNotNull(destination, "destinationTx");
-
- Callable<List<ChangeItem>> callable = getBranchStore().compareBranch(getSession(), source, destination);
+ Callable<List<ChangeItem>> callable = getBranchStore().compareBranch(getSession(), sourceTx, destinationTx);
return callAndCheckForCancel(callable);
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CreateBranchCallable.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CreateBranchCallable.java
index 0beff4daeb..e2041b5f1d 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CreateBranchCallable.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/branch/CreateBranchCallable.java
@@ -12,21 +12,23 @@ package org.eclipse.osee.orcs.core.internal.branch;
import java.util.concurrent.Callable;
import org.eclipse.osee.framework.core.data.ITransaction;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.BranchReadable;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsSession;
import org.eclipse.osee.orcs.core.ds.BranchDataStore;
+import org.eclipse.osee.orcs.data.BranchReadable;
import org.eclipse.osee.orcs.data.CreateBranchData;
+import org.eclipse.osee.orcs.search.QueryFactory;
public class CreateBranchCallable extends AbstractBranchCallable<BranchReadable> {
private final CreateBranchData branchData;
+ private final QueryFactory queryFactory;
- public CreateBranchCallable(Log logger, OrcsSession session, BranchDataStore branchStore, CreateBranchData branchData) {
+ public CreateBranchCallable(Log logger, OrcsSession session, BranchDataStore branchStore, CreateBranchData branchData, QueryFactory queryFactory) {
super(logger, session, branchStore);
this.branchData = branchData;
+ this.queryFactory = queryFactory;
}
@Override
@@ -40,13 +42,13 @@ public class CreateBranchCallable extends AbstractBranchCallable<BranchReadable>
ITransaction txData = branchData.getFromTransaction();
Conditions.checkNotNull(txData, "sourceTransaction");
- Callable<Branch> callable;
+ Callable<?> callable;
if (branchData.isTxCopyBranchType()) {
callable = getBranchStore().createBranchCopyTx(getSession(), branchData);
} else {
callable = getBranchStore().createBranch(getSession(), branchData);
}
-
- return callAndCheckForCancel(callable);
+ callAndCheckForCancel(callable);
+ return queryFactory.branchQuery().andUuids(branchData.getUuid()).getResults().getExactlyOne();
}
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/GraphData.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/GraphData.java
index c028d7bd6b..c7733c51ae 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/GraphData.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/GraphData.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.orcs.core.internal.graph;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.orcs.OrcsSession;
import org.eclipse.osee.orcs.data.HasBranch;
import org.eclipse.osee.orcs.data.HasLocalId;
import org.eclipse.osee.orcs.data.HasTransaction;
@@ -46,4 +47,6 @@ public interface GraphData extends HasBranch, HasTransaction {
<T extends GraphAdjacencies> T removeAdjacencies(Integer id);
+ OrcsSession getSession();
+
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/GraphFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/GraphFactory.java
index 594b194d79..bee52e3547 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/GraphFactory.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/GraphFactory.java
@@ -12,14 +12,13 @@ package org.eclipse.osee.orcs.core.internal.graph;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.orcs.OrcsSession;
/**
* @author Roberto E. Escobar
*/
public interface GraphFactory {
- GraphData createGraph(IOseeBranch branch, int transactionId) throws OseeCoreException;
-
- GraphData createGraphSetToHeadTx(IOseeBranch branch) throws OseeCoreException;
+ GraphData createGraph(OrcsSession session, IOseeBranch branch, int transactionId) throws OseeCoreException;
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphBuilderImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphBuilderImpl.java
index a532398758..7ddf4a97f6 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphBuilderImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphBuilderImpl.java
@@ -76,7 +76,7 @@ public class GraphBuilderImpl extends LoadDataHandlerAdapter implements GraphBui
GraphData graph = getGraph();
Artifact artifact = graph.getNode(data);
if (artifact == null) {
- artifact = artifactFactory.createArtifact(data);
+ artifact = artifactFactory.createArtifact(graph.getSession(), data);
graph.addNode(artifact);
RelationNodeAdjacencies adjacencies = relationFactory.createRelationContainer();
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphDataImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphDataImpl.java
index 2cf3dfd071..55c955dee8 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphDataImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphDataImpl.java
@@ -15,6 +15,7 @@ import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
+import org.eclipse.osee.orcs.OrcsSession;
import org.eclipse.osee.orcs.core.internal.graph.GraphAdjacencies;
import org.eclipse.osee.orcs.core.internal.graph.GraphData;
import org.eclipse.osee.orcs.core.internal.graph.GraphNode;
@@ -30,9 +31,11 @@ public class GraphDataImpl implements GraphData {
private final IOseeBranch branch;
private final int txId;
+ private final OrcsSession orcsSession;
- public GraphDataImpl(IOseeBranch branch, int txId) {
+ public GraphDataImpl(OrcsSession session, IOseeBranch branch, int txId) {
super();
+ this.orcsSession = session;
this.branch = branch;
this.txId = txId;
}
@@ -162,4 +165,9 @@ public class GraphDataImpl implements GraphData {
return true;
}
+ @Override
+ public OrcsSession getSession() {
+ return orcsSession;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphFactoryImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphFactoryImpl.java
index 7bf0904ace..25833bbb25 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphFactoryImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/graph/impl/GraphFactoryImpl.java
@@ -11,10 +11,7 @@
package org.eclipse.osee.orcs.core.internal.graph.impl;
import org.eclipse.osee.framework.core.data.IOseeBranch;
-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.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.orcs.OrcsSession;
import org.eclipse.osee.orcs.core.internal.graph.GraphData;
import org.eclipse.osee.orcs.core.internal.graph.GraphFactory;
@@ -23,23 +20,9 @@ import org.eclipse.osee.orcs.core.internal.graph.GraphFactory;
*/
public class GraphFactoryImpl implements GraphFactory {
- private final BranchCache branchCache;
-
- public GraphFactoryImpl(BranchCache branchCache) {
- super();
- this.branchCache = branchCache;
- }
-
- @Override
- public GraphData createGraph(IOseeBranch branch, int transactionId) {
- return new GraphDataImpl(branch, transactionId);
- }
-
@Override
- public GraphData createGraphSetToHeadTx(IOseeBranch branch) throws OseeCoreException {
- Branch fullBranch = branchCache.get(branch);
- TransactionRecord headTransaction = branchCache.getHeadTransaction(fullBranch);
- return createGraph(branch, headTransaction.getId());
+ public GraphData createGraph(OrcsSession session, IOseeBranch branch, int transactionId) {
+ return new GraphDataImpl(session, branch, transactionId);
}
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/Relation.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/Relation.java
index fbb97075e4..ad39c2689c 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/Relation.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/Relation.java
@@ -13,13 +13,10 @@ package org.eclipse.osee.orcs.core.internal.relation;
import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.enums.RelationSide;
-import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.core.ds.HasOrcsData;
-import org.eclipse.osee.orcs.core.ds.OrcsData;
import org.eclipse.osee.orcs.core.ds.RelationData;
import org.eclipse.osee.orcs.core.internal.util.OrcsWriteable;
-import org.eclipse.osee.orcs.core.internal.util.ValueProvider;
import org.eclipse.osee.orcs.data.RelationTypes;
/**
@@ -28,16 +25,14 @@ import org.eclipse.osee.orcs.data.RelationTypes;
public class Relation implements HasOrcsData<RelationData>, OrcsWriteable {
private final RelationTypes relationTypes;
- private final ValueProvider<Branch, OrcsData> branchProvider;
private RelationData relationData;
private boolean isDirty;
- public Relation(RelationTypes relationTypes, RelationData relationData, ValueProvider<Branch, OrcsData> branchProvider) {
+ public Relation(RelationTypes relationTypes, RelationData relationData) {
super();
this.relationTypes = relationTypes;
this.relationData = relationData;
- this.branchProvider = branchProvider;
}
@Override
@@ -48,7 +43,6 @@ public class Relation implements HasOrcsData<RelationData>, OrcsWriteable {
@Override
public void setOrcsData(RelationData data) {
this.relationData = data;
- branchProvider.setOrcsData(data);
}
public IRelationType getRelationType() throws OseeCoreException {
@@ -69,10 +63,6 @@ public class Relation implements HasOrcsData<RelationData>, OrcsWriteable {
markAsChanged(ModificationType.DELETED);
}
- public Branch getBranch() throws OseeCoreException {
- return branchProvider.get();
- }
-
@Override
public boolean isDirty() {
return isDirty;
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationFactory.java
index 47f64ce164..b0d7069b56 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationFactory.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/relation/RelationFactory.java
@@ -12,16 +12,12 @@ package org.eclipse.osee.orcs.core.internal.relation;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.IRelationType;
-import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.orcs.core.ds.OrcsData;
import org.eclipse.osee.orcs.core.ds.RelationData;
import org.eclipse.osee.orcs.core.ds.RelationDataFactory;
import org.eclipse.osee.orcs.core.internal.relation.impl.RelationNodeAdjacencies;
import org.eclipse.osee.orcs.core.internal.util.OrcsConditions;
-import org.eclipse.osee.orcs.core.internal.util.ValueProvider;
-import org.eclipse.osee.orcs.core.internal.util.ValueProviderFactory;
import org.eclipse.osee.orcs.data.RelationTypes;
/**
@@ -31,12 +27,10 @@ public class RelationFactory {
private final RelationTypes relationTypes;
private final RelationDataFactory relationDataFactory;
- private final ValueProviderFactory providerFactory;
- public RelationFactory(RelationTypes relationTypes, RelationDataFactory relationDataFactory, ValueProviderFactory providerFactory) {
+ public RelationFactory(RelationTypes relationTypes, RelationDataFactory relationDataFactory) {
this.relationTypes = relationTypes;
this.relationDataFactory = relationDataFactory;
- this.providerFactory = providerFactory;
}
public RelationNodeAdjacencies createRelationContainer() {
@@ -44,8 +38,7 @@ public class RelationFactory {
}
public Relation createRelation(RelationData data) {
- ValueProvider<Branch, OrcsData> branch = providerFactory.createBranchProvider(data);
- return new Relation(relationTypes, data, branch);
+ return new Relation(relationTypes, data);
}
public Relation createRelation(RelationNode aNode, IRelationType type, RelationNode bNode) throws OseeCoreException {
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java
index 4f4f8d1346..8747e06919 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java
@@ -23,13 +23,13 @@ import org.eclipse.osee.framework.core.data.IRelationType;
import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.core.internal.artifact.Artifact;
import org.eclipse.osee.orcs.core.internal.relation.RelationUtil;
import org.eclipse.osee.orcs.data.ArtifactId;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.AttributeId;
+import org.eclipse.osee.orcs.data.TransactionReadable;
import org.eclipse.osee.orcs.transaction.TransactionBuilder;
/**
@@ -291,10 +291,10 @@ public class TransactionBuilderImpl implements TransactionBuilder {
}
@Override
- public TransactionRecord commit() throws OseeCoreException {
- TransactionRecord tx = null;
+ public TransactionReadable commit() throws OseeCoreException {
+ TransactionReadable tx = null;
try {
- CancellableCallable<TransactionRecord> callable = txFactory.createTx(txData);
+ CancellableCallable<TransactionReadable> callable = txFactory.createTx(txData);
tx = callable.call();
} catch (Exception ex) {
OseeExceptions.wrapAndThrow(ex);
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxCallableFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxCallableFactory.java
index 99b513c7dd..17da473bfc 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxCallableFactory.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxCallableFactory.java
@@ -15,7 +15,6 @@ import java.util.concurrent.Callable;
import org.eclipse.osee.executor.admin.CancellableCallable;
import org.eclipse.osee.framework.core.data.ITransaction;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.logger.Log;
@@ -23,6 +22,7 @@ import org.eclipse.osee.orcs.OrcsSession;
import org.eclipse.osee.orcs.core.ds.TransactionData;
import org.eclipse.osee.orcs.core.ds.TransactionResult;
import org.eclipse.osee.orcs.core.ds.TxDataStore;
+import org.eclipse.osee.orcs.data.TransactionReadable;
/**
* @author Roberto E. Escobar
@@ -49,12 +49,12 @@ public class TxCallableFactory {
};
}
- public CancellableCallable<TransactionRecord> createTx(final TxData txData) {
- return new AbstractTxCallable<TransactionRecord>("CommitTransaction", txData.getSession()) {
+ public CancellableCallable<TransactionReadable> createTx(final TxData txData) {
+ return new AbstractTxCallable<TransactionReadable>("CommitTransaction", txData.getSession()) {
@Override
- protected TransactionRecord innerCall() throws Exception {
- TransactionRecord transaction = null;
+ protected TransactionReadable innerCall() throws Exception {
+ TransactionReadable transaction = null;
try {
txManager.startTx(txData);
TransactionResult result = doCommit();
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataLoaderImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataLoaderImpl.java
index 58346f7e9b..23da84ac90 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataLoaderImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataLoaderImpl.java
@@ -40,13 +40,19 @@ public class TxDataLoaderImpl implements TxDataLoader {
private final GraphFactory graphFactory;
private final GraphBuilderFactory graphBuilderFactory;
private final GraphProvider graphProvider;
+ private final TransactionProvider txProvider;
- public TxDataLoaderImpl(DataLoaderFactory dataLoaderFactory, GraphFactory graphFactory, GraphBuilderFactory graphBuilderFactory, GraphProvider graphProvider) {
+ public static interface TransactionProvider {
+ int getHeadTransaction(OrcsSession session, IOseeBranch branch);
+ }
+
+ public TxDataLoaderImpl(DataLoaderFactory dataLoaderFactory, GraphFactory graphFactory, GraphBuilderFactory graphBuilderFactory, GraphProvider graphProvider, TransactionProvider txProvider) {
super();
this.dataLoaderFactory = dataLoaderFactory;
this.graphProvider = graphProvider;
this.graphFactory = graphFactory;
this.graphBuilderFactory = graphBuilderFactory;
+ this.txProvider = txProvider;
}
private DataLoader createLoader(OrcsSession session, IOseeBranch branch, Collection<ArtifactId> artifactIds) throws OseeCoreException {
@@ -79,8 +85,9 @@ public class TxDataLoaderImpl implements TxDataLoader {
}
@Override
- public GraphData createGraph(IOseeBranch branch) throws OseeCoreException {
- return graphFactory.createGraphSetToHeadTx(branch);
+ public GraphData createGraph(OrcsSession session, IOseeBranch branch) throws OseeCoreException {
+ int headTransaction = txProvider.getHeadTransaction(session, branch);
+ return graphFactory.createGraph(session, branch, headTransaction);
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManager.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManager.java
index 120a251221..fdf4747382 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManager.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TxDataManager.java
@@ -51,7 +51,7 @@ public class TxDataManager {
public interface TxDataLoader {
- GraphData createGraph(IOseeBranch branch) throws OseeCoreException;
+ GraphData createGraph(OrcsSession session, IOseeBranch branch) throws OseeCoreException;
ResultSet<Artifact> loadArtifacts(OrcsSession session, IOseeBranch branch, Collection<ArtifactId> artifactIds) throws OseeCoreException;
@@ -72,7 +72,7 @@ public class TxDataManager {
}
public TxData createTxData(OrcsSession session, IOseeBranch branch) throws OseeCoreException {
- GraphData graphData = loader.createGraph(branch);
+ GraphData graphData = loader.createGraph(session, branch);
return new TxData(session, graphData);
}
@@ -180,7 +180,7 @@ public class TxDataManager {
}
private Artifact copyArtifactForWrite(TxData txData, Artifact source) throws OseeCoreException {
- Artifact artifact = artifactFactory.clone(source);
+ Artifact artifact = artifactFactory.clone(txData.getSession(), source);
txData.getGraph().addNode(artifact);
relationManager.cloneRelations(txData.getSession(), source, artifact);
return artifact;
@@ -240,7 +240,7 @@ public class TxDataManager {
public ArtifactReadable createArtifact(TxData txData, IArtifactType artifactType, String name, String guid) throws OseeCoreException {
checkChangesAllowed(txData);
- Artifact artifact = artifactFactory.createArtifact(txData.getBranch(), artifactType, guid);
+ Artifact artifact = artifactFactory.createArtifact(txData.getSession(), txData.getBranch(), artifactType, guid);
artifact.setName(name);
return asExternalArtifact(txData, artifact);
}
@@ -258,7 +258,8 @@ public class TxDataManager {
}
private ArtifactReadable copyArtifactHelper(TxData txData, Artifact source, Collection<? extends IAttributeType> attributesToDuplicate) throws OseeCoreException {
- Artifact copy = artifactFactory.copyArtifact(source, attributesToDuplicate, txData.getBranch());
+ Artifact copy =
+ artifactFactory.copyArtifact(txData.getSession(), source, attributesToDuplicate, txData.getBranch());
return asExternalArtifact(txData, copy);
}
@@ -266,7 +267,7 @@ public class TxDataManager {
checkChangesAllowed(txData);
checkAreOnDifferentBranches(txData, fromBranch);
Artifact source = getSourceArtifact(txData, fromBranch, artifactId);
- Artifact artifact = artifactFactory.introduceArtifact(source, txData.getBranch());
+ Artifact artifact = artifactFactory.introduceArtifact(txData.getSession(), source, txData.getBranch());
return asExternalArtifact(txData, artifact);
}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/util/ValueProviderFactory.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/util/ValueProviderFactory.java
deleted file mode 100644
index 58cd4c3590..0000000000
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/util/ValueProviderFactory.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 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.orcs.core.internal.util;
-
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
-import org.eclipse.osee.orcs.core.ds.OrcsData;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ValueProviderFactory {
-
- private final BranchCache branchCache;
-
- public ValueProviderFactory(BranchCache branchCache) {
- super();
- this.branchCache = branchCache;
- }
-
- public ValueProvider<Branch, OrcsData> createBranchProvider(OrcsData data) {
- return new BranchProvider(branchCache, data);
- }
-
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryTest.java
index fb0cfad8eb..72a84e1565 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryTest.java
@@ -15,15 +15,12 @@ import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
-
import org.eclipse.osee.executor.admin.HasCancellation;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.change.ArtifactChangeItem;
import org.eclipse.osee.framework.core.model.change.AttributeChangeItem;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
@@ -41,6 +38,7 @@ import org.eclipse.osee.orcs.core.ds.LoadDataHandler;
import org.eclipse.osee.orcs.core.ds.OrcsData;
import org.eclipse.osee.orcs.core.ds.RelationData;
import org.eclipse.osee.orcs.core.ds.VersionData;
+import org.eclipse.osee.orcs.data.TransactionReadable;
import org.eclipse.osee.orcs.db.internal.IdentityLocator;
import org.junit.Assert;
import org.junit.Before;
@@ -66,8 +64,8 @@ public class MissingChangeItemFactoryTest {
@Mock private DataLoader destDataLoader;
@Mock private Branch sourceBranch;
@Mock private Branch destBranch;
- @Mock private TransactionRecord sourceTx;
- @Mock private TransactionRecord destTx;
+ @Mock private TransactionReadable sourceTx;
+ @Mock private TransactionReadable destTx;
@Mock private OrcsSession session;
@Mock private HasCancellation cancellation;
// @formatter:on
@@ -110,8 +108,8 @@ public class MissingChangeItemFactoryTest {
sourceDataLoader);
when(dataLoaderFactory.newDataLoaderFromIds(any(OrcsSession.class), eq(destBranch), any(Collection.class))).thenReturn(
destDataLoader);
- when(sourceTx.getBranch()).thenReturn(sourceBranch);
- when(destTx.getBranch()).thenReturn(destBranch);
+ when(sourceTx.getBranchId()).thenReturn(sourceBranch.getGuid());
+ when(destTx.getBranchId()).thenReturn(destBranch.getGuid());
changeItemFactory = new MissingChangeItemFactoryImpl(identityService, dataLoaderFactory);
}
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriterTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriterTest.java
index cfe356c117..e5190abee1 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriterTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriterTest.java
@@ -22,8 +22,6 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.IOseeStatement;
import org.eclipse.osee.framework.database.core.IdJoinQuery;
@@ -31,6 +29,7 @@ import org.eclipse.osee.framework.database.core.OseeConnection;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.core.ds.OrcsChangeSet;
+import org.eclipse.osee.orcs.data.TransactionReadable;
import org.eclipse.osee.orcs.db.internal.transaction.TransactionWriter.SqlOrderEnum;
import org.junit.Assert;
import org.junit.Before;
@@ -69,8 +68,7 @@ public class TransactionWriterTest {
@Mock private TxSqlBuilder builder;
@Mock private OseeConnection connection;
- @Mock private TransactionRecord tx;
- @Mock private Branch branch;
+ @Mock private TransactionReadable tx;
@Mock private DaoToSql dao1;
@Mock private DaoToSql dao2;
@@ -100,8 +98,7 @@ public class TransactionWriterTest {
when(join1.getQueryId()).thenReturn(QUERY_ID_1);
when(join2.getQueryId()).thenReturn(QUERY_ID_2);
- when(tx.getBranch()).thenReturn(branch);
- when(branch.getUuid()).thenReturn(BRANCH_ID);
+ when(tx.getBranchId()).thenReturn(BRANCH_ID);
when(builder.getBinaryStores()).thenReturn(stores);
when(builder.getTxNotCurrents()).thenAnswer(new Answer<Set<Entry<SqlOrderEnum, IdJoinQuery>>>() {
@@ -165,7 +162,6 @@ public class TransactionWriterTest {
inOrder.verify(dbService).runBatchUpdate(eq(connection), eq(TransactionWriter.UPDATE_TXS_NOT_CURRENT),
paramCaptor.capture());
- inOrder.verify(tx).clearDirty();
inOrder.verify(builder).clear();
Iterator<Object[]> params = paramCaptor.getValue().iterator();
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilderTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilderTest.java
index bf6c8619a1..75881725c5 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilderTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilderTest.java
@@ -30,7 +30,6 @@ import java.util.Map.Entry;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
import org.eclipse.osee.framework.core.enums.TxChange;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.IdJoinQuery;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -42,6 +41,7 @@ import org.eclipse.osee.orcs.core.ds.OrcsChangeSet;
import org.eclipse.osee.orcs.core.ds.OrcsData;
import org.eclipse.osee.orcs.core.ds.RelationData;
import org.eclipse.osee.orcs.core.ds.VersionData;
+import org.eclipse.osee.orcs.data.TransactionReadable;
import org.eclipse.osee.orcs.db.internal.IdentityManager;
import org.eclipse.osee.orcs.db.internal.loader.data.ArtifactDataImpl;
import org.eclipse.osee.orcs.db.internal.loader.data.AttributeDataImpl;
@@ -93,7 +93,7 @@ public class TxSqlBuilderTest {
@Mock private IOseeDatabaseService dbService;
@Mock private IdentityManager idManager;
- @Mock private TransactionRecord tx;
+ @Mock private TransactionReadable tx;
@Mock private OrcsChangeSet txData;
@Mock private DataProxy dataProxy;
@@ -145,12 +145,12 @@ public class TxSqlBuilderTest {
relData.setArtIdB(B_ART_ID);
relData.setRationale(RATIONALE);
- when(tx.getId()).thenReturn(EXPECTED_TX_ID);
- when(tx.getAuthor()).thenReturn(EXPECTED_AUTHOR_ID);
+ when(tx.getGuid()).thenReturn(EXPECTED_TX_ID);
+ when(tx.getAuthorId()).thenReturn(EXPECTED_AUTHOR_ID);
when(tx.getBranchId()).thenReturn(EXPECTED_BRANCH_ID);
when(tx.getComment()).thenReturn(EXPECTED_COMMENT);
when(tx.getCommit()).thenReturn(EXPECTED_COMMIT_ID);
- when(tx.getTimeStamp()).thenReturn(EXPECTED_TX_TIME);
+ when(tx.getDate()).thenReturn(EXPECTED_TX_TIME);
when(tx.getTxType()).thenReturn(EXPECTED_TX_TYPE);
when(idManager.getNextGammaId()).thenReturn(NEXT_GAMMA_ID);
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchModule.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchModule.java
index 3a5d0293b4..84f186dbe5 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchModule.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/branch/BranchModule.java
@@ -17,8 +17,6 @@ import org.eclipse.osee.executor.admin.ExecutorAdmin;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.BranchState;
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.change.ChangeItem;
import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
import org.eclipse.osee.framework.core.services.TempCachingService;
@@ -35,6 +33,7 @@ import org.eclipse.osee.orcs.data.ArchiveOperation;
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.db.internal.IdentityLocator;
import org.eclipse.osee.orcs.db.internal.callable.AbstractDatastoreTxCallable;
import org.eclipse.osee.orcs.db.internal.callable.ArchiveUnarchiveBranchCallable;
@@ -85,21 +84,19 @@ public class BranchModule {
new MissingChangeItemFactoryImpl(identityService, dataLoaderFactory);
return new BranchDataStore() {
@Override
- public Callable<Branch> createBranch(OrcsSession session, CreateBranchData branchData) {
- return new CreateBranchDatabaseTxCallable(logger, session, dbService, cachingService.getBranchCache(),
- modelFactory.getBranchFactory(), modelFactory.getTransactionFactory(), branchData);
+ public Callable<Void> createBranch(OrcsSession session, CreateBranchData branchData) {
+ return new CreateBranchDatabaseTxCallable(logger, session, dbService, branchData);
}
@Override
- public Callable<Branch> createBranchCopyTx(OrcsSession session, CreateBranchData branchData) {
- return new BranchCopyTxCallable(logger, session, dbService, cachingService.getBranchCache(),
- modelFactory.getBranchFactory(), modelFactory.getTransactionFactory(), branchData);
+ public Callable<Void> createBranchCopyTx(OrcsSession session, CreateBranchData branchData) {
+ return new BranchCopyTxCallable(logger, session, dbService, branchData);
}
@Override
- public Callable<TransactionRecord> commitBranch(OrcsSession session, ArtifactReadable committer, Branch source, Branch destination) {
- return new CommitBranchDatabaseCallable(logger, session, dbService, cachingService.getBranchCache(),
- modelFactory.getTransactionFactory(), committer, source, destination, missingChangeItemFactory);
+ public Callable<Integer> commitBranch(OrcsSession session, ArtifactReadable committer, BranchReadable source, TransactionReadable sourceHead, BranchReadable destination, TransactionReadable destinationHead) {
+ return new CommitBranchDatabaseCallable(logger, session, dbService, committer, source, sourceHead,
+ destination, destinationHead, missingChangeItemFactory);
}
@Override
@@ -108,9 +105,9 @@ public class BranchModule {
}
@Override
- public Callable<List<ChangeItem>> compareBranch(OrcsSession session, TransactionRecord sourceTx, TransactionRecord destinationTx) {
- return new CompareDatabaseCallable(logger, session, dbService, cachingService.getBranchCache(), sourceTx,
- destinationTx, missingChangeItemFactory);
+ public Callable<List<ChangeItem>> compareBranch(OrcsSession session, TransactionReadable sourceTx, TransactionReadable destinationTx) {
+ return new CompareDatabaseCallable(logger, session, dbService, sourceTx, destinationTx,
+ missingChangeItemFactory);
}
@Override
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/BranchCopyTxCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/BranchCopyTxCallable.java
index 4bc50e3924..e89ad833f3 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/BranchCopyTxCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/BranchCopyTxCallable.java
@@ -16,15 +16,12 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.Callable;
+import org.eclipse.osee.framework.core.data.ITransaction;
+import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
import org.eclipse.osee.framework.core.enums.TxChange;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.BranchFactory;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.IOseeStatement;
import org.eclipse.osee.framework.database.core.OseeConnection;
@@ -35,20 +32,15 @@ import org.eclipse.osee.orcs.OrcsSession;
import org.eclipse.osee.orcs.data.CreateBranchData;
import org.eclipse.osee.orcs.db.internal.accessor.UpdatePreviousTxCurrent;
import org.eclipse.osee.orcs.db.internal.sql.RelationalConstants;
-import org.eclipse.osee.orcs.db.internal.util.IdUtil;
/**
* the behavior of this class - it needs to: have a branch
*
* @author David Miller
*/
-public final class BranchCopyTxCallable extends AbstractDatastoreTxCallable<Branch> {
+public final class BranchCopyTxCallable extends AbstractDatastoreTxCallable<Void> {
- private final BranchCache branchCache;
- private final BranchFactory branchFactory;
- private final TransactionRecordFactory txFactory;
private final CreateBranchData branchData;
- private Branch internalBranch;
private static final String INSERT_TX_DETAILS =
"INSERT INTO osee_tx_details (branch_id, transaction_id, osee_comment, time, author, tx_type) VALUES (?,?,?,?,?,?)";
@@ -59,77 +51,66 @@ public final class BranchCopyTxCallable extends AbstractDatastoreTxCallable<Bran
private static final String SELECT_ADDRESSING =
"SELECT gamma_id, mod_type FROM osee_txs txs WHERE txs.branch_id = ? AND txs.transaction_id = ?";
- public BranchCopyTxCallable(Log logger, OrcsSession session, IOseeDatabaseService databaseService, BranchCache branchCache, BranchFactory branchFactory, TransactionRecordFactory txFactory, CreateBranchData branchData) {
+ private static final String GET_PRIOR_TRANSACTION =
+ "select max(transaction_id) FROM osee_tx_details where branch_id = ? and transaction_id < ?";
+
+ public BranchCopyTxCallable(Log logger, OrcsSession session, IOseeDatabaseService databaseService, CreateBranchData branchData) {
super(logger, session, databaseService, String.format("Create Branch %s", branchData.getName()));
- this.branchCache = branchCache;
- this.branchFactory = branchFactory;
- this.txFactory = txFactory;
this.branchData = branchData;
//this.systemUserId = -1;
}
- private BranchCache getBranchCache() {
- return branchCache;
- }
-
@SuppressWarnings("unchecked")
@Override
- public Branch handleTxWork(OseeConnection connection) throws OseeCoreException {
+ public Void handleTxWork(OseeConnection connection) throws OseeCoreException {
// get the previous transaction, if there is one
- int sourceTx = IdUtil.getSourceTxId(branchData, branchCache);
- TransactionRecord savedTx = branchCache.getOrLoad(sourceTx);
+ int sourceTx = branchData.getFromTransaction().getGuid();
+
+ int priorTransactionId =
+ getDatabaseService().runPreparedQueryFetchObject(-1, GET_PRIOR_TRANSACTION, branchData.getUuid(), sourceTx);
- TransactionRecord priorTx = branchCache.getPriorTransaction(savedTx);
// copy the branch up to the prior transaction - the goal is to have the provided
// transaction available on the new branch for merging or comparison purposes
// first set aside the transaction
+ ITransaction priorTx = TokenFactory.createTransaction(priorTransactionId);
branchData.setFromTransaction(priorTx);
- Callable<Branch> callable =
- new CreateBranchDatabaseTxCallable(getLogger(), getSession(), getDatabaseService(), getBranchCache(),
- branchFactory, txFactory, branchData);
+ Callable<Void> callable =
+ new CreateBranchDatabaseTxCallable(getLogger(), getSession(), getDatabaseService(), branchData);
try {
- internalBranch = callable.call();
+ callable.call();
// TODO figure out if this call is "stackable", is the data passed in above
// still valid after the branch creation, or do I need to get it all from the new branch???
Timestamp timestamp = GlobalTime.GreenwichMeanTimestamp();
int nextTransactionId = getDatabaseService().getSequence().getNextTransactionId();
- String creationComment = branchData.getCreationComment() + " and copied transaction " + savedTx.getId();
-
- getDatabaseService().runPreparedUpdate(connection, INSERT_TX_DETAILS, internalBranch.getUuid(),
- nextTransactionId, creationComment, timestamp, branchData.getUserArtifactId(),
- TransactionDetailsType.NonBaselined.getId());
-
- TransactionRecord record =
- txFactory.create(nextTransactionId, internalBranch, creationComment, timestamp,
- branchData.getUserArtifactId(), RelationalConstants.ART_ID_SENTINEL, TransactionDetailsType.Baselined);
+ String creationComment = branchData.getCreationComment() + " and copied transaction " + sourceTx;
- branchCache.cache(record);
+ getDatabaseService().runPreparedUpdate(connection, INSERT_TX_DETAILS, branchData.getUuid(), nextTransactionId,
+ creationComment, timestamp, branchData.getUserArtifactId(), TransactionDetailsType.NonBaselined.getId());
- populateTransaction(0.30, connection, record.getId(), internalBranch, savedTx);
+ populateTransaction(0.30, connection, nextTransactionId, branchData.getParentBranchUuid(), sourceTx);
UpdatePreviousTxCurrent updater =
- new UpdatePreviousTxCurrent(getDatabaseService(), connection, internalBranch.getUuid());
- updater.updateTxNotCurrentsFromTx(record.getId());
+ new UpdatePreviousTxCurrent(getDatabaseService(), connection, branchData.getUuid());
+ updater.updateTxNotCurrentsFromTx(nextTransactionId);
} catch (Exception ex) {
OseeExceptions.wrapAndThrow(ex);
}
- return internalBranch;
+ return null;
}
- private void populateTransaction(double workAmount, OseeConnection connection, int intoTx, Branch branch, TransactionRecord copyTx) throws OseeCoreException {
+ private void populateTransaction(double workAmount, OseeConnection connection, int intoTx, Long parentBranch, int copyTxId) throws OseeCoreException {
List<Object[]> data = new ArrayList<Object[]>();
HashSet<Integer> gammas = new HashSet<Integer>(100000);
long parentBranchId = RelationalConstants.BRANCH_SENTINEL;
- if (branch.hasParentBranch()) {
- parentBranchId = branch.getParentBranch().getUuid();
+ if (parentBranch != null) {
+ parentBranchId = parentBranch;
}
- int copyTxId = copyTx.getId();
populateAddressingToCopy(connection, data, intoTx, gammas, SELECT_ADDRESSING, parentBranchId, copyTxId);
@@ -150,12 +131,7 @@ public final class BranchCopyTxCallable extends AbstractDatastoreTxCallable<Bran
if (!gammas.contains(gamma)) {
ModificationType modType = ModificationType.getMod(chStmt.getInt("mod_type"));
TxChange txCurrent = TxChange.getCurrent(modType);
- data.add(new Object[] {
- baseTxId,
- gamma,
- modType.getValue(),
- txCurrent.getValue(),
- internalBranch.getUuid()});
+ data.add(new Object[] {baseTxId, gamma, modType.getValue(), txCurrent.getValue(), branchData.getUuid()});
gammas.add(gamma);
}
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseCallable.java
index dfe2c25f2a..b09c077793 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseCallable.java
@@ -13,17 +13,13 @@ package org.eclipse.osee.orcs.db.internal.callable;
import java.util.List;
import java.util.concurrent.Callable;
import org.eclipse.osee.executor.admin.CancellableCallable;
-import org.eclipse.osee.framework.core.enums.TransactionVersion;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsSession;
import org.eclipse.osee.orcs.data.ArtifactReadable;
+import org.eclipse.osee.orcs.data.BranchReadable;
+import org.eclipse.osee.orcs.data.TransactionReadable;
import org.eclipse.osee.orcs.db.internal.change.ComputeNetChangeCallable;
import org.eclipse.osee.orcs.db.internal.change.LoadDeltasBetweenBranches;
import org.eclipse.osee.orcs.db.internal.change.MissingChangeItemFactory;
@@ -31,86 +27,66 @@ import org.eclipse.osee.orcs.db.internal.change.MissingChangeItemFactory;
/**
* @author Roberto E. Escobar
*/
-public class CommitBranchDatabaseCallable extends AbstractDatastoreCallable<TransactionRecord> {
+public class CommitBranchDatabaseCallable extends AbstractDatastoreCallable<Integer> {
- private final TransactionRecordFactory txFactory;
- private final BranchCache branchCache;
private final ArtifactReadable committer;
- private final Branch source;
- private final Branch destination;
+ private final TransactionReadable sourceHead;
+ private final BranchReadable source;
+ private final TransactionReadable destinationHead;
+ private final BranchReadable destination;
private final MissingChangeItemFactory missingChangeItemFactory;
- public CommitBranchDatabaseCallable(Log logger, OrcsSession session, IOseeDatabaseService service, BranchCache branchCache, TransactionRecordFactory txFactory, ArtifactReadable committer, Branch source, Branch destination, MissingChangeItemFactory missingChangeItemFactory) {
+ private static final String SELECT_MERGE_BRANCH_UUID =
+ "select merge_branch_id from osee_merge where source_branch_id = ? and dest_branch_id = ?";
+ private static final String SELECT_MERGE_BRANCH_HEAD_TX =
+ "select max(transaction_id) from osee_tx_details where branch_id = ?";
+
+ public CommitBranchDatabaseCallable(Log logger, OrcsSession session, IOseeDatabaseService service, ArtifactReadable committer, BranchReadable source, TransactionReadable sourceHead, BranchReadable destination, TransactionReadable destinationHead, MissingChangeItemFactory missingChangeItemFactory) {
super(logger, session, service);
- this.branchCache = branchCache;
- this.txFactory = txFactory;
this.committer = committer;
this.source = source;
+ this.sourceHead = sourceHead;
this.destination = destination;
+ this.destinationHead = destinationHead;
this.missingChangeItemFactory = missingChangeItemFactory;
}
- private BranchCache getBranchCache() {
- return branchCache;
- }
-
- private TransactionRecordFactory getTxFactory() {
- return txFactory;
- }
-
- private TransactionRecord getHeadTx(Branch branch) throws OseeCoreException {
- return getBranchCache().getTransaction(branch, TransactionVersion.HEAD);
- }
-
- private Branch getMergeBranch(Branch sourceBranch, Branch destinationBranch) throws OseeCoreException {
- return getBranchCache().findMergeBranch(sourceBranch, destinationBranch);
- }
-
- private TransactionRecord getMergeTx(Branch mergeBranch) throws OseeCoreException {
- return mergeBranch != null ? getBranchCache().getTransaction(mergeBranch, TransactionVersion.HEAD) : null;
- }
-
private int getUserArtId() {
return committer != null ? committer.getLocalId() : -1;
}
- private List<ChangeItem> callComputeChanges(Branch mergeBranch) throws Exception {
- TransactionRecord sourceTx = getHeadTx(source);
- TransactionRecord destinationTx = getHeadTx(destination);
-
- TransactionRecord mergeTx = getMergeTx(mergeBranch);
-
+ private List<ChangeItem> callComputeChanges(Long mergeBranch) throws Exception {
Long mergeBranchId = null;
Integer mergeTxId = null;
- if (mergeTx != null) {
- mergeBranchId = mergeTx.getBranchId();
- mergeTxId = mergeTx.getId();
+ if (mergeBranch != null && mergeBranch > 0) {
+ mergeBranchId = mergeBranch;
+ mergeTxId = getDatabaseService().runPreparedQueryFetchObject(-1, SELECT_MERGE_BRANCH_HEAD_TX, mergeBranchId);
}
Callable<List<ChangeItem>> loadChanges =
- new LoadDeltasBetweenBranches(getLogger(), getSession(), getDatabaseService(), source.getUuid(),
- destinationTx.getBranchId(), destinationTx.getId(), mergeBranchId, mergeTxId);
+ new LoadDeltasBetweenBranches(getLogger(), getSession(), getDatabaseService(), sourceHead.getBranchId(),
+ destinationHead.getBranchId(), destinationHead.getGuid(), mergeBranchId, mergeTxId);
List<ChangeItem> changes = callAndCheckForCancel(loadChanges);
- changes.addAll(missingChangeItemFactory.createMissingChanges(this, getSession(), changes, sourceTx, destinationTx));
+ changes.addAll(missingChangeItemFactory.createMissingChanges(this, getSession(), changes, sourceHead,
+ destinationHead));
Callable<List<ChangeItem>> computeChanges = new ComputeNetChangeCallable(changes);
return callAndCheckForCancel(computeChanges);
}
@Override
- public TransactionRecord call() throws Exception {
- Branch mergeBranch = getMergeBranch(source, destination);
- List<ChangeItem> changes = callComputeChanges(mergeBranch);
-
- CancellableCallable<TransactionRecord> commitCallable =
- new CommitBranchDatabaseTxCallable(getLogger(), getSession(), getDatabaseService(), getBranchCache(),
- getUserArtId(), source, destination, mergeBranch, changes, getTxFactory());
- TransactionRecord commitTransaction = callAndCheckForCancel(commitCallable);
-
- getBranchCache().cache(commitTransaction);
-
- return commitTransaction;
+ public Integer call() throws Exception {
+ Long mergeBranchUuid =
+ getDatabaseService().runPreparedQueryFetchObject(-1L, SELECT_MERGE_BRANCH_UUID, source.getGuid(),
+ destination.getGuid());
+ List<ChangeItem> changes = callComputeChanges(mergeBranchUuid);
+
+ CancellableCallable<Integer> commitCallable =
+ new CommitBranchDatabaseTxCallable(getLogger(), getSession(), getDatabaseService(), getUserArtId(), source,
+ destination, mergeBranchUuid, changes);
+ Integer newTx = callAndCheckForCancel(commitCallable);
+
+ return newTx;
}
-
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseTxCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseTxCallable.java
index 66c95ccfe4..b0b8df3b7d 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseTxCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CommitBranchDatabaseTxCallable.java
@@ -12,19 +12,12 @@ package org.eclipse.osee.orcs.db.internal.callable;
import java.sql.Timestamp;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
import org.eclipse.osee.framework.core.enums.BranchState;
import org.eclipse.osee.framework.core.enums.ConflictStatus;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
import org.eclipse.osee.framework.core.enums.TxChange;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.model.change.ArtifactChangeItem;
import org.eclipse.osee.framework.core.model.change.AttributeChangeItem;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
@@ -36,12 +29,13 @@ import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
import org.eclipse.osee.framework.jdk.core.util.time.GlobalTime;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsSession;
+import org.eclipse.osee.orcs.data.BranchReadable;
import org.eclipse.osee.orcs.db.internal.accessor.UpdatePreviousTxCurrent;
/**
* @author Ryan D. Brooks
*/
-public class CommitBranchDatabaseTxCallable extends AbstractDatastoreTxCallable<TransactionRecord> {
+public class CommitBranchDatabaseTxCallable extends AbstractDatastoreTxCallable<Integer> {
private static final String COMMIT_COMMENT = "Commit Branch ";
private static final String INSERT_COMMIT_TRANSACTION =
@@ -62,55 +56,45 @@ public class CommitBranchDatabaseTxCallable extends AbstractDatastoreTxCallable<
private static final String UPDATE_SOURCE_BRANCH_STATE = "update osee_branch set branch_state=? where branch_id=?";
private final int userArtId;
- private final BranchCache branchCache;
- private final Map<Branch, BranchState> savedBranchStates;
- private final Branch sourceBranch;
- private final Branch destinationBranch;
- private final Branch mergeBranch;
+ private final BranchReadable sourceBranch;
+ private final BranchReadable destinationBranch;
+ private final Long mergeBranchUuid;
private final List<ChangeItem> changes;
- private final TransactionRecordFactory txFactory;
- private OseeConnection connection;
- private boolean success;
-
- public CommitBranchDatabaseTxCallable(Log logger, OrcsSession session, IOseeDatabaseService databaseService, BranchCache branchCache, int userArtId, Branch sourceBranch, Branch destinationBranch, Branch mergeBranch, List<ChangeItem> changes, TransactionRecordFactory txFactory) {
+ public CommitBranchDatabaseTxCallable(Log logger, OrcsSession session, IOseeDatabaseService databaseService, int userArtId, BranchReadable sourceBranch, BranchReadable destinationBranch, Long mergeBranchUuid, List<ChangeItem> changes) {
super(logger, session, databaseService, "Commit branch");
- this.savedBranchStates = new HashMap<Branch, BranchState>();
- this.branchCache = branchCache;
this.userArtId = userArtId;
this.sourceBranch = sourceBranch;
this.destinationBranch = destinationBranch;
- this.mergeBranch = mergeBranch;
+ this.mergeBranchUuid = mergeBranchUuid;
this.changes = changes;
- this.txFactory = txFactory;
-
- this.success = true;
- savedBranchStates.put(sourceBranch, sourceBranch.getBranchState());
- savedBranchStates.put(destinationBranch, destinationBranch.getBranchState());
}
@Override
- protected TransactionRecord handleTxWork(OseeConnection connection) throws OseeCoreException {
+ protected Integer handleTxWork(OseeConnection connection) throws OseeCoreException {
BranchState storedBranchState;
- this.connection = connection;
if (changes.isEmpty()) {
throw new OseeStateException("A branch can not be committed without any changes made.");
}
storedBranchState = sourceBranch.getBranchState();
checkPreconditions();
- TransactionRecord newTx = null;
+ Integer newTx = null;
try {
- newTx = addCommitTransactionToDatabase(userArtId);
- updatePreviousCurrentsOnDestinationBranch();
- insertCommitAddressing(newTx);
+ newTx = addCommitTransactionToDatabase(userArtId, connection);
+ updatePreviousCurrentsOnDestinationBranch(connection);
+ insertCommitAddressing(newTx, connection);
- getDatabaseService().runPreparedUpdate(connection, UPDATE_MERGE_COMMIT_TX, newTx.getId(),
- sourceBranch.getUuid(), destinationBranch.getUuid());
+ getDatabaseService().runPreparedUpdate(connection, UPDATE_MERGE_COMMIT_TX, newTx, sourceBranch.getUuid(),
+ destinationBranch.getUuid());
manageBranchStates();
+ if (mergeBranchUuid != null && mergeBranchUuid > 0) {
+ getDatabaseService().runPreparedUpdate(UPDATE_CONFLICT_STATUS, ConflictStatus.COMMITTED.getValue(),
+ ConflictStatus.RESOLVED.getValue(), mergeBranchUuid);
+ }
} catch (OseeCoreException ex) {
- updateBranchState(storedBranchState);
+ updateBranchState(storedBranchState, sourceBranch.getUuid());
throw ex;
}
return newTx;
@@ -125,16 +109,15 @@ public class CommitBranchDatabaseTxCallable extends AbstractDatastoreTxCallable<
}
if (!sourceBranch.getBranchState().equals(BranchState.COMMITTED)) {
- updateBranchState(BranchState.COMMIT_IN_PROGRESS);
- sourceBranch.setBranchState(BranchState.COMMIT_IN_PROGRESS);
+ updateBranchState(BranchState.COMMIT_IN_PROGRESS, sourceBranch.getUuid());
}
}
- public void updateBranchState(BranchState state) throws OseeCoreException {
- getDatabaseService().runPreparedUpdate(UPDATE_SOURCE_BRANCH_STATE, state.getValue(), sourceBranch.getUuid());
+ public void updateBranchState(BranchState state, Long branchUuid) throws OseeCoreException {
+ getDatabaseService().runPreparedUpdate(UPDATE_SOURCE_BRANCH_STATE, state.getValue(), branchUuid);
}
- private void updatePreviousCurrentsOnDestinationBranch() throws OseeCoreException {
+ private void updatePreviousCurrentsOnDestinationBranch(OseeConnection connection) throws OseeCoreException {
UpdatePreviousTxCurrent updater =
new UpdatePreviousTxCurrent(getDatabaseService(), connection, destinationBranch.getUuid());
for (ChangeItem change : changes) {
@@ -152,7 +135,7 @@ public class CommitBranchDatabaseTxCallable extends AbstractDatastoreTxCallable<
}
@SuppressWarnings("unchecked")
- private TransactionRecord addCommitTransactionToDatabase(int userArtId) throws OseeCoreException {
+ private Integer addCommitTransactionToDatabase(int userArtId, OseeConnection connection) throws OseeCoreException {
int newTransactionNumber = getDatabaseService().getSequence().getNextTransactionId();
Timestamp timestamp = GlobalTime.GreenwichMeanTimestamp();
@@ -161,19 +144,15 @@ public class CommitBranchDatabaseTxCallable extends AbstractDatastoreTxCallable<
getDatabaseService().runPreparedUpdate(connection, INSERT_COMMIT_TRANSACTION,
TransactionDetailsType.NonBaselined.getId(), destinationBranch.getUuid(), newTransactionNumber, comment,
timestamp, userArtId, sourceBranch.getAssociatedArtifactId());
- TransactionRecord record =
- txFactory.create(newTransactionNumber, destinationBranch, comment, timestamp, userArtId,
- sourceBranch.getAssociatedArtifactId(), TransactionDetailsType.NonBaselined);
-
- return record;
+ return newTransactionNumber;
}
- private void insertCommitAddressing(TransactionRecord newTx) throws OseeCoreException {
+ private void insertCommitAddressing(Integer newTx, OseeConnection connection) throws OseeCoreException {
List<Object[]> insertData = new ArrayList<Object[]>();
for (ChangeItem change : changes) {
ModificationType modType = change.getNetChange().getModType();
insertData.add(new Object[] {
- newTx.getId(),
+ newTx,
destinationBranch.getUuid(),
change.getNetChange().getGammaId(),
modType.getValue(),
@@ -183,42 +162,14 @@ public class CommitBranchDatabaseTxCallable extends AbstractDatastoreTxCallable<
}
private void manageBranchStates() throws OseeCoreException {
- destinationBranch.setBranchState(BranchState.MODIFIED);
+ updateBranchState(BranchState.MODIFIED, destinationBranch.getUuid());
+
BranchState sourceBranchState = sourceBranch.getBranchState();
if (!sourceBranchState.isCreationInProgress() && !sourceBranchState.isRebaselined() && !sourceBranchState.isRebaselineInProgress() && !sourceBranchState.isCommitted()) {
- sourceBranch.setBranchState(BranchState.COMMITTED);
- }
- if (mergeBranch != null) {
- savedBranchStates.put(mergeBranch, mergeBranch.getBranchState());
- mergeBranch.setBranchState(BranchState.COMMITTED);
- branchCache.storeItems(mergeBranch, destinationBranch, sourceBranch);
- } else {
- branchCache.storeItems(destinationBranch, sourceBranch);
- }
- }
-
- @Override
- protected void handleTxException(Exception ex) {
- success = false;
- // Restore Original Branch States
- try {
- for (Entry<Branch, BranchState> entry : savedBranchStates.entrySet()) {
- entry.getKey().setBranchState(entry.getValue());
- }
- branchCache.storeItems(savedBranchStates.keySet());
- } catch (OseeCoreException ex1) {
- getLogger().error(ex1, "Error during branch commit of [%s] into [%s]", sourceBranch, destinationBranch);
+ updateBranchState(BranchState.COMMITTED, sourceBranch.getUuid());
}
- }
-
- @Override
- protected void handleTxFinally() throws OseeCoreException {
- if (success) {
- // update conflict status, if necessary
- if (mergeBranch != null) {
- getDatabaseService().runPreparedUpdate(UPDATE_CONFLICT_STATUS, ConflictStatus.COMMITTED.getValue(),
- ConflictStatus.RESOLVED.getValue(), mergeBranch.getUuid());
- }
+ if (mergeBranchUuid != null && mergeBranchUuid > 0) {
+ updateBranchState(BranchState.COMMITTED, mergeBranchUuid);
}
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CompareDatabaseCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CompareDatabaseCallable.java
index e85f1d16b6..d8cd2b22c1 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CompareDatabaseCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CompareDatabaseCallable.java
@@ -12,16 +12,12 @@ package org.eclipse.osee.orcs.db.internal.callable;
import java.util.List;
import java.util.concurrent.Callable;
-import org.eclipse.osee.framework.core.enums.TransactionVersion;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.TransactionDelta;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsSession;
+import org.eclipse.osee.orcs.data.TransactionReadable;
+import org.eclipse.osee.orcs.data.TransactionReadableDelta;
import org.eclipse.osee.orcs.db.internal.change.AddArtifactChangeDataCallable;
import org.eclipse.osee.orcs.db.internal.change.ComputeNetChangeCallable;
import org.eclipse.osee.orcs.db.internal.change.LoadDeltasBetweenBranches;
@@ -30,44 +26,47 @@ import org.eclipse.osee.orcs.db.internal.change.MissingChangeItemFactory;
public class CompareDatabaseCallable extends AbstractDatastoreCallable<List<ChangeItem>> {
- private final BranchCache branchCache;
- private final TransactionRecord sourceTx;
- private final TransactionRecord destinationTx;
+ private final TransactionReadable sourceTx;
+ private final TransactionReadable destinationTx;
private final MissingChangeItemFactory missingChangeItemFactory;
private static final String SELECT_BASE_TRANSACTION =
"select baseline_transaction_id from osee_branch where branch_id = ?";
- public CompareDatabaseCallable(Log logger, OrcsSession session, IOseeDatabaseService service, BranchCache branchCache, TransactionRecord sourceTx, TransactionRecord destinationTx, MissingChangeItemFactory missingChangeItemFactory) {
+ private static final String SELECT_MERGE_BRANCH_UUID =
+ "select merge_branch_id from osee_merge where source_branch_id = ? and dest_branch_id = ?";
+ private static final String SELECT_MERGE_BRANCH_HEAD_TX =
+ "select max(transaction_id) from osee_tx_details where branch_id = ?";
+
+ public CompareDatabaseCallable(Log logger, OrcsSession session, IOseeDatabaseService service, TransactionReadable sourceTx, TransactionReadable destinationTx, MissingChangeItemFactory missingChangeItemFactory) {
super(logger, session, service);
- this.branchCache = branchCache;
this.sourceTx = sourceTx;
this.destinationTx = destinationTx;
this.missingChangeItemFactory = missingChangeItemFactory;
}
- private BranchCache getBranchCache() {
- return branchCache;
- }
-
@Override
public List<ChangeItem> call() throws Exception {
- TransactionDelta txDelta = new TransactionDelta(sourceTx, destinationTx);
+ TransactionReadableDelta txDelta = new TransactionReadableDelta(sourceTx, destinationTx);
Callable<List<ChangeItem>> callable;
if (txDelta.areOnTheSameBranch()) {
callable = new LoadDeltasBetweenTxsOnTheSameBranch(getLogger(), getSession(), getDatabaseService(), txDelta);
} else {
- TransactionRecord mergeTx = getMergeTransaction(sourceTx, destinationTx);
- Long mergeBranchId = null;
+ Long mergeBranchId =
+ getDatabaseService().runPreparedQueryFetchObject(-1L, SELECT_MERGE_BRANCH_UUID, sourceTx.getBranchId(),
+ destinationTx.getBranchId());
+
Integer mergeTxId = null;
- if (mergeTx != null) {
- mergeBranchId = mergeTx.getBranchId();
- mergeTxId = mergeTx.getId();
+ if (mergeBranchId > 0) {
+ mergeTxId =
+ getDatabaseService().runPreparedQueryFetchObject(-1, SELECT_MERGE_BRANCH_HEAD_TX, mergeBranchId);
+ } else {
+ mergeBranchId = null;
}
callable =
new LoadDeltasBetweenBranches(getLogger(), getSession(), getDatabaseService(), sourceTx.getBranchId(),
- destinationTx.getBranchId(), destinationTx.getId(), mergeBranchId, mergeTxId);
+ destinationTx.getBranchId(), destinationTx.getGuid(), mergeBranchId, mergeTxId);
}
List<ChangeItem> changes = callAndCheckForCancel(callable);
@@ -79,9 +78,4 @@ public class CompareDatabaseCallable extends AbstractDatastoreCallable<List<Chan
return callAndCheckForCancel(addArtifactData);
}
- private TransactionRecord getMergeTransaction(TransactionRecord sourceTx, TransactionRecord destinationTx) throws OseeCoreException {
- Branch mergeBranch = getBranchCache().findMergeBranch(sourceTx.getBranch(), destinationTx.getBranch());
- return mergeBranch != null ? getBranchCache().getTransaction(mergeBranch, TransactionVersion.HEAD) : null;
- }
-
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseTxCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseTxCallable.java
index ad0eb07f31..4e98f213a7 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseTxCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/CreateBranchDatabaseTxCallable.java
@@ -15,38 +15,32 @@ import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
-import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.enums.BranchArchivedState;
import org.eclipse.osee.framework.core.enums.BranchState;
import org.eclipse.osee.framework.core.enums.BranchType;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.enums.PermissionEnum;
-import org.eclipse.osee.framework.core.enums.StorageState;
import org.eclipse.osee.framework.core.enums.SystemUser;
import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
import org.eclipse.osee.framework.core.enums.TxChange;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.BranchFactory;
-import org.eclipse.osee.framework.core.model.MergeBranch;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.IOseeStatement;
import org.eclipse.osee.framework.database.core.OseeConnection;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.jdk.core.util.time.GlobalTime;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsSession;
import org.eclipse.osee.orcs.data.CreateBranchData;
-import org.eclipse.osee.orcs.db.internal.util.IdUtil;
+import org.eclipse.osee.orcs.db.internal.sql.RelationalConstants;
/**
* @author Roberto E. Escobar
*/
-public class CreateBranchDatabaseTxCallable extends AbstractDatastoreTxCallable<Branch> {
+public class CreateBranchDatabaseTxCallable extends AbstractDatastoreTxCallable<Void> {
private static final String INSERT_TX_DETAILS =
"INSERT INTO osee_tx_details (branch_id, transaction_id, osee_comment, time, author, tx_type) VALUES (?,?,?,?,?,?)";
@@ -89,23 +83,21 @@ public class CreateBranchDatabaseTxCallable extends AbstractDatastoreTxCallable<
private final String GET_BRANCH_ACCESS_CONTROL_LIST =
"SELECT permission_id, privilege_entity_id FROM osee_branch_acl WHERE branch_id= ?";
- private boolean passedPreConditions;
- private boolean wasSuccessful;
+ private static final String INSERT_BRANCH_WITH_GUID =
+ "INSERT INTO osee_branch (branch_id, branch_guid, branch_name, parent_branch_id, parent_transaction_id, archived, associated_art_id, branch_type, branch_state, baseline_transaction_id, inherit_access_control) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
+ private static final String INSERT_BRANCH =
+ "INSERT INTO osee_branch (branch_id, branch_name, parent_branch_id, parent_transaction_id, archived, associated_art_id, branch_type, branch_state, baseline_transaction_id, inherit_access_control) VALUES (?,?,?,?,?,?,?,?,?,?)";
+ protected static final int NULL_PARENT_BRANCH_ID = -1;
+ private static final String SELECT_INHERIT_ACCESS_CONTROL =
+ "SELECT inherit_access_control from osee_branch where branch_id = ?";
+
private int systemUserId;
- private final BranchCache branchCache;
- private final BranchFactory branchFactory;
- private final TransactionRecordFactory txFactory;
private final CreateBranchData newBranchData;
- private Branch branch;
- public CreateBranchDatabaseTxCallable(Log logger, OrcsSession session, IOseeDatabaseService databaseService, BranchCache branchCache, BranchFactory branchFactory, TransactionRecordFactory txFactory, CreateBranchData branchData) {
+ public CreateBranchDatabaseTxCallable(Log logger, OrcsSession session, IOseeDatabaseService databaseService, CreateBranchData branchData) {
super(logger, session, databaseService, String.format("Create Branch %s", branchData.getName()));
- this.branchCache = branchCache;
- this.branchFactory = branchFactory;
- this.txFactory = txFactory;
this.newBranchData = branchData;
- this.wasSuccessful = false;
this.systemUserId = -1;
}
@@ -121,12 +113,12 @@ public class CreateBranchDatabaseTxCallable extends AbstractDatastoreTxCallable<
return systemUserId;
}
- public void checkPreconditions(IOseeBranch parentBranch, IOseeBranch destinationBranch) throws OseeCoreException {
+ public void checkPreconditions(Long parentBranch, Long destinationBranch) throws OseeCoreException {
if (newBranchData.getBranchType().isMergeBranch()) {
- if (getDatabaseService().runPreparedQueryFetchObject(0, TEST_MERGE_BRANCH_EXISTENCE, parentBranch.getUuid(),
- destinationBranch.getUuid()) > 0) {
- throw new OseeStateException("Existing merge branch detected for [%s] and [%s]", parentBranch.getName(),
- destinationBranch.getName());
+ if (getDatabaseService().runPreparedQueryFetchObject(0, TEST_MERGE_BRANCH_EXISTENCE, parentBranch,
+ destinationBranch) > 0) {
+ throw new OseeStateException("Existing merge branch detected for [%d] and [%d]", parentBranch,
+ destinationBranch);
}
} else if (!newBranchData.getBranchType().isSystemRootBranch()) {
int associatedArtifactId = newBranchData.getAssociatedArtifactId();
@@ -165,117 +157,116 @@ public class CreateBranchDatabaseTxCallable extends AbstractDatastoreTxCallable<
@SuppressWarnings("unchecked")
@Override
- protected Branch handleTxWork(OseeConnection connection) throws OseeCoreException {
- Branch parentBranch = branchCache.getByUuid(IdUtil.getParentBranchId(newBranchData, branchCache));
- Branch destinationBranch = branchCache.getByUuid(newBranchData.getMergeDestinationBranchId());
+ protected Void handleTxWork(OseeConnection connection) throws OseeCoreException {
+ Long parentBranchUuid = newBranchData.getParentBranchUuid();
+ Long destinationBranchUuid = newBranchData.getMergeDestinationBranchId();
- passedPreConditions = false;
- checkPreconditions(parentBranch, destinationBranch);
- passedPreConditions = true;
+ checkPreconditions(parentBranchUuid, destinationBranchUuid);
long uuid = newBranchData.getUuid();
final String truncatedName = Strings.truncate(newBranchData.getName(), 195, true);
- boolean inheritAccessControl = parentBranch == null ? false : parentBranch.isInheritAccessControl();
- branch =
- branchFactory.create(uuid, truncatedName, newBranchData.getBranchType(), BranchState.CREATION_IN_PROGRESS,
- false, inheritAccessControl);
-
- branch.setParentBranch(parentBranch);
- branch.setAssociatedArtifactId(newBranchData.getAssociatedArtifactId());
Timestamp timestamp = GlobalTime.GreenwichMeanTimestamp();
int nextTransactionId = getDatabaseService().getSequence().getNextTransactionId();
- if (branch.getBranchType().isSystemRootBranch()) {
- TransactionRecord systemTx =
- txFactory.create(nextTransactionId, branch, newBranchData.getCreationComment(), timestamp,
- newBranchData.getUserArtifactId(), -1, TransactionDetailsType.Baselined);
- branch.setSourceTransaction(systemTx);
+ int sourceTx;
+ if (newBranchData.getBranchType().isSystemRootBranch()) {
+ sourceTx = nextTransactionId;
} else {
- int srcTx = IdUtil.getSourceTxId(newBranchData, branchCache);
+ sourceTx = RelationalConstants.TRANSACTION_SENTINEL;
- branch.setSourceTransaction(branchCache.getOrLoad(srcTx));
+ if (BranchType.SYSTEM_ROOT != newBranchData.getBranchType()) {
+ sourceTx = newBranchData.getFromTransaction().getGuid();
+ }
}
- if (branch.getBranchType().isMergeBranch()) {
- ((MergeBranch) branch).setSourceBranch(parentBranch);
- ((MergeBranch) branch).setDestinationBranch(destinationBranch);
+ int inheritAccessControl = 0;
+ if (parentBranchUuid != null) {
+ inheritAccessControl =
+ getDatabaseService().runPreparedQueryFetchObject(connection, 0, SELECT_INHERIT_ACCESS_CONTROL,
+ parentBranchUuid);
}
- branchCache.cache(branch);
- branchCache.storeItems(branch);
+ //write to branch table
+ boolean insertBranchGuid = isBranchGuidNeeded(connection);
+ long parentBranchId = parentBranchUuid != null ? parentBranchUuid : NULL_PARENT_BRANCH_ID;
+ Object[] toInsert;
+ if (insertBranchGuid) {
+ toInsert =
+ new Object[] {
+ uuid,
+ GUID.create(),
+ truncatedName,
+ parentBranchId,
+ sourceTx,
+ BranchArchivedState.UNARCHIVED.getValue(),
+ newBranchData.getAssociatedArtifactId(),
+ newBranchData.getBranchType().getValue(),
+ BranchState.CREATED.getValue(),
+ nextTransactionId,
+ inheritAccessControl};
+ } else {
+ toInsert =
+ new Object[] {
+ uuid,
+ truncatedName,
+ parentBranchId,
+ sourceTx,
+ BranchArchivedState.UNARCHIVED.getValue(),
+ newBranchData.getAssociatedArtifactId(),
+ newBranchData.getBranchType().getValue(),
+ BranchState.CREATED.getValue(),
+ nextTransactionId,
+ inheritAccessControl};
+ }
- if (parentBranch != null && inheritAccessControl) {
- copyAccessRules(connection, newBranchData.getUserArtifactId(), parentBranch, branch);
+ String insertBranch = insertBranchGuid ? INSERT_BRANCH_WITH_GUID : INSERT_BRANCH;
+ getDatabaseService().runPreparedUpdate(connection, insertBranch, toInsert);
+
+ if (inheritAccessControl != 0) {
+ copyAccessRules(connection, newBranchData.getUserArtifactId(), parentBranchUuid, uuid);
}
- getDatabaseService().runPreparedUpdate(connection, INSERT_TX_DETAILS, branch.getUuid(), nextTransactionId,
+ getDatabaseService().runPreparedUpdate(connection, INSERT_TX_DETAILS, uuid, nextTransactionId,
newBranchData.getCreationComment(), timestamp, newBranchData.getUserArtifactId(),
TransactionDetailsType.Baselined.getId());
- TransactionRecord record =
- txFactory.create(nextTransactionId, branch, newBranchData.getCreationComment(), timestamp,
- newBranchData.getUserArtifactId(), -1, TransactionDetailsType.Baselined);
-
- if (branch.getBranchType().isSystemRootBranch()) {
- branch.setSourceTransaction(record);
- }
- branch.setBaseTransaction(record);
- branchCache.cache(record);
- populateBaseTransaction(0.30, connection, branch, newBranchData.getMergeAddressingQueryId());
+ populateBaseTransaction(0.30, connection, nextTransactionId, sourceTx);
- addMergeBranchEntry(0.20, connection, branch, newBranchData.getMergeDestinationBranchId());
- wasSuccessful = true;
- return branch;
+ addMergeBranchEntry(0.20, connection);
+ return null;
}
- @Override
- protected void handleTxException(Exception ex) {
- if (passedPreConditions) {
- try {
- branch.setStorageState(StorageState.PURGED);
- branchCache.storeItems(branch);
- } catch (OseeCoreException ex1) {
- getLogger().error(ex1, "Error during create branch [%s]", branch);
- }
- }
- }
-
- @Override
- protected void handleTxFinally() throws OseeCoreException {
- if (wasSuccessful) {
- branch.setBranchState(BranchState.CREATED);
- branchCache.storeItems(branch);
- }
+ private boolean isBranchGuidNeeded(OseeConnection connection) {
+ return getDatabaseService().runPreparedQueryFetchObject(connection, false,
+ "select osee_value from osee_info where osee_key = ?", "osee.insert.branch.guid.on.create");
}
- private void addMergeBranchEntry(double workAmount, OseeConnection connection, Branch branch, long destinationBranchId) throws OseeCoreException {
- if (branch.getBranchType().isMergeBranch()) {
- long parentBranchId = branch.hasParentBranch() ? branch.getParentBranch().getUuid() : -1;
+ private void addMergeBranchEntry(double workAmount, OseeConnection connection) {
+ if (newBranchData.getBranchType().isMergeBranch()) {
+ long parentBranchId = newBranchData.getParentBranchUuid() != null ? newBranchData.getParentBranchUuid() : -1;
getDatabaseService().runPreparedUpdate(connection, MERGE_BRANCH_INSERT, parentBranchId,
- newBranchData.getMergeDestinationBranchId(), branch.getUuid(), 0);
+ newBranchData.getMergeDestinationBranchId(), newBranchData.getUuid(), 0);
}
checkForCancelled();
}
- private void populateBaseTransaction(double workAmount, OseeConnection connection, Branch branch, int mergeAddressingQueryId) throws OseeCoreException {
- if (branch.getBranchType() != BranchType.SYSTEM_ROOT) {
+ private void populateBaseTransaction(double workAmount, OseeConnection connection, int baseTxId, int sourceTxId) throws OseeCoreException {
+ if (newBranchData.getBranchType() != BranchType.SYSTEM_ROOT) {
List<Object[]> data = new ArrayList<Object[]>();
HashSet<Integer> gammas = new HashSet<Integer>(100000);
long parentBranchId = -1;
- if (branch.hasParentBranch()) {
- parentBranchId = branch.getParentBranch().getUuid();
+ if (newBranchData.getParentBranchUuid() != null) {
+ parentBranchId = newBranchData.getParentBranchUuid();
}
- int baseTxId = branch.getBaseTransaction().getId();
- if (branch.getBranchType().isMergeBranch()) {
+ if (newBranchData.getBranchType().isMergeBranch()) {
populateAddressingToCopy(connection, data, baseTxId, gammas, SELECT_ATTRIBUTE_ADDRESSING_FROM_JOIN,
- parentBranchId, TxChange.NOT_CURRENT.getValue(), mergeAddressingQueryId);
+ parentBranchId, TxChange.NOT_CURRENT.getValue(), newBranchData.getMergeAddressingQueryId());
populateAddressingToCopy(connection, data, baseTxId, gammas, SELECT_ARTIFACT_ADDRESSING_FROM_JOIN,
- parentBranchId, TxChange.NOT_CURRENT.getValue(), mergeAddressingQueryId);
+ parentBranchId, TxChange.NOT_CURRENT.getValue(), newBranchData.getMergeAddressingQueryId());
} else {
- populateAddressingToCopy(connection, data, baseTxId, gammas, SELECT_ADDRESSING, parentBranchId,
- branch.getSourceTransaction().getId());
+ populateAddressingToCopy(connection, data, baseTxId, gammas, SELECT_ADDRESSING, parentBranchId, sourceTxId);
}
if (!data.isEmpty()) {
getDatabaseService().runBatchUpdate(connection, INSERT_ADDRESSING, data);
@@ -294,7 +285,12 @@ public class CreateBranchDatabaseTxCallable extends AbstractDatastoreTxCallable<
if (!gammas.contains(gamma)) {
ModificationType modType = ModificationType.getMod(chStmt.getInt("mod_type"));
TxChange txCurrent = TxChange.getCurrent(modType);
- data.add(new Object[] {baseTxId, gamma, modType.getValue(), txCurrent.getValue(), branch.getUuid()});
+ data.add(new Object[] {
+ baseTxId,
+ gamma,
+ modType.getValue(),
+ txCurrent.getValue(),
+ newBranchData.getUuid()});
gammas.add(gamma);
}
}
@@ -303,15 +299,14 @@ public class CreateBranchDatabaseTxCallable extends AbstractDatastoreTxCallable<
}
}
- private void copyAccessRules(OseeConnection connection, int userArtId, IOseeBranch parentBranch, Branch destinationBranch) {
- Long branchUuid = destinationBranch.getUuid();
+ private void copyAccessRules(OseeConnection connection, int userArtId, Long parentBranch, Long branchUuid) {
int owner = PermissionEnum.OWNER.getPermId();
int deny = PermissionEnum.DENY.getPermId();
List<Object[]> data = new ArrayList<Object[]>();
IOseeStatement chStmt = getDatabaseService().getStatement(connection);
try {
- chStmt.runPreparedQuery(MAX_FETCH, GET_BRANCH_ACCESS_CONTROL_LIST, parentBranch.getUuid());
+ chStmt.runPreparedQuery(MAX_FETCH, GET_BRANCH_ACCESS_CONTROL_LIST, parentBranch);
while (chStmt.next()) {
int permissionId = chStmt.getInt("permission_id");
int priviledgeId = chStmt.getInt("privilege_entity_id");
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/InitializeDatastoreCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/InitializeDatastoreCallable.java
index c941e330d5..4a5f0d5f26 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/InitializeDatastoreCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/InitializeDatastoreCallable.java
@@ -21,7 +21,6 @@ import org.eclipse.osee.framework.core.enums.BranchType;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.PermissionEnum;
import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
@@ -86,10 +85,8 @@ public class InitializeDatastoreCallable extends AbstractDatastoreCallable<DataS
CreateBranchData systemRootData = getSystemRootData();
// TODO tie in the session information
- Callable<Branch> createSystemRoot = branchStore.createBranch(getSession(), systemRootData);
- Branch systemRoot = callAndCheckForCancel(createSystemRoot);
-
- Conditions.checkNotNull(systemRoot, "System Root Branch");
+ Callable<Void> createSystemRoot = branchStore.createBranch(getSession(), systemRootData);
+ callAndCheckForCancel(createSystemRoot);
Callable<DataStoreInfo> fetchCallable =
new FetchDatastoreInfoCallable(getLogger(), getSession(), getDatabaseService(), schemaProvider, preferences);
@@ -112,7 +109,6 @@ public class InitializeDatastoreCallable extends AbstractDatastoreCallable<DataS
data.setFromTransaction(null);
data.setMergeAddressingQueryId(RelationalConstants.JOIN_QUERY_ID_SENTINEL);
- data.setMergeDestinationBranchId(RelationalConstants.BRANCH_SENTINEL);
return data;
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenTxsOnTheSameBranch.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenTxsOnTheSameBranch.java
index 1a92eb0980..8ecfa31507 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenTxsOnTheSameBranch.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenTxsOnTheSameBranch.java
@@ -16,8 +16,6 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.osee.framework.core.enums.ModificationType;
-import org.eclipse.osee.framework.core.model.TransactionDelta;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.IOseeStatement;
@@ -28,6 +26,8 @@ import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsSession;
+import org.eclipse.osee.orcs.data.TransactionReadable;
+import org.eclipse.osee.orcs.data.TransactionReadableDelta;
import org.eclipse.osee.orcs.db.internal.callable.AbstractDatastoreCallable;
import org.eclipse.osee.orcs.db.internal.change.ChangeItemLoader.ChangeItemFactory;
@@ -44,10 +44,10 @@ public class LoadDeltasBetweenTxsOnTheSameBranch extends AbstractDatastoreCallab
private final HashMap<Long, ModificationType> changeByGammaId = new HashMap<Long, ModificationType>();
- private final TransactionDelta txDelta;
+ private final TransactionReadableDelta txDelta;
private final ChangeItemLoader changeItemLoader;
- public LoadDeltasBetweenTxsOnTheSameBranch(Log logger, OrcsSession session, IOseeDatabaseService dbService, TransactionDelta txDelta) {
+ public LoadDeltasBetweenTxsOnTheSameBranch(Log logger, OrcsSession session, IOseeDatabaseService dbService, TransactionReadableDelta txDelta) {
super(logger, session, dbService);
this.txDelta = txDelta;
this.changeItemLoader = new ChangeItemLoader(dbService, changeByGammaId);
@@ -57,11 +57,11 @@ public class LoadDeltasBetweenTxsOnTheSameBranch extends AbstractDatastoreCallab
return getEndTx().getBranchId();
}
- private TransactionRecord getEndTx() {
+ private TransactionReadable getEndTx() {
return txDelta.getEndTx();
}
- private TransactionRecord getStartTx() {
+ private TransactionReadable getStartTx() {
return txDelta.getStartTx();
}
@@ -94,8 +94,8 @@ public class LoadDeltasBetweenTxsOnTheSameBranch extends AbstractDatastoreCallab
private void loadChangesAtEndTx(TransactionJoinQuery txJoin) throws OseeCoreException {
IOseeStatement chStmt = getDatabaseService().getStatement();
try {
- chStmt.runPreparedQuery(MAX_FETCH, SELECT_CHANGES_BETWEEN_TRANSACTIONS, getBranchId(), getStartTx().getId(),
- getEndTx().getId());
+ chStmt.runPreparedQuery(MAX_FETCH, SELECT_CHANGES_BETWEEN_TRANSACTIONS, getBranchId(), getStartTx().getGuid(),
+ getEndTx().getGuid());
while (chStmt.next()) {
checkForCancelled();
Long gammaId = chStmt.getLong("gamma_id");
@@ -127,14 +127,14 @@ public class LoadDeltasBetweenTxsOnTheSameBranch extends AbstractDatastoreCallab
changeData.addAll(changesByItemId.values());
}
- private void loadCurrentData(String tableName, String columnName, int queryId, HashMap<Integer, ChangeItem> changesByItemId, TransactionRecord transactionLimit) throws OseeCoreException {
+ private void loadCurrentData(String tableName, String columnName, int queryId, HashMap<Integer, ChangeItem> changesByItemId, TransactionReadable transactionLimit) throws OseeCoreException {
IOseeStatement chStmt = getDatabaseService().getStatement();
try {
String query = "select txs.gamma_id, txs.mod_type, item." + columnName + " from osee_join_id idj, " //
+ tableName + " item, osee_txs txs where idj.query_id = ? and idj.id = item." + columnName + //
" and item.gamma_id = txs.gamma_id and txs.branch_id = ? and txs.transaction_id <= ?";
- chStmt.runPreparedQuery(MAX_FETCH, query, queryId, transactionLimit.getBranchId(), transactionLimit.getId());
+ chStmt.runPreparedQuery(MAX_FETCH, query, queryId, transactionLimit.getBranchId(), transactionLimit.getGuid());
while (chStmt.next()) {
checkForCancelled();
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactory.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactory.java
index fd1c827338..055766edbb 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactory.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactory.java
@@ -13,16 +13,16 @@ package org.eclipse.osee.orcs.db.internal.change;
import java.util.Collection;
import java.util.List;
import org.eclipse.osee.executor.admin.HasCancellation;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.OrcsSession;
+import org.eclipse.osee.orcs.data.TransactionReadable;
/**
* @author John Misinco
*/
public interface MissingChangeItemFactory {
- Collection<ChangeItem> createMissingChanges(HasCancellation cancellation, OrcsSession session, List<ChangeItem> changes, TransactionRecord sourceTx, TransactionRecord destTx) throws OseeCoreException;
+ Collection<ChangeItem> createMissingChanges(HasCancellation cancellation, OrcsSession session, List<ChangeItem> changes, TransactionReadable sourceTx, TransactionReadable destTx) throws OseeCoreException;
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryImpl.java
index 56bae834be..9696b5b99a 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryImpl.java
@@ -17,9 +17,10 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.osee.executor.admin.HasCancellation;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.enums.LoadLevel;
import org.eclipse.osee.framework.core.enums.ModificationType;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.change.ArtifactChangeItem;
import org.eclipse.osee.framework.core.model.change.AttributeChangeItem;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
@@ -33,6 +34,7 @@ import org.eclipse.osee.orcs.core.ds.DataLoaderFactory;
import org.eclipse.osee.orcs.core.ds.LoadDataHandlerAdapter;
import org.eclipse.osee.orcs.core.ds.OrcsData;
import org.eclipse.osee.orcs.core.ds.RelationData;
+import org.eclipse.osee.orcs.data.TransactionReadable;
import org.eclipse.osee.orcs.db.internal.IdentityLocator;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
@@ -52,7 +54,7 @@ public class MissingChangeItemFactoryImpl implements MissingChangeItemFactory {
}
@Override
- public Collection<ChangeItem> createMissingChanges(HasCancellation cancellation, OrcsSession session, List<ChangeItem> changes, TransactionRecord sourceTx, TransactionRecord destTx) throws OseeCoreException {
+ public Collection<ChangeItem> createMissingChanges(HasCancellation cancellation, OrcsSession session, List<ChangeItem> changes, TransactionReadable sourceTx, TransactionReadable destTx) throws OseeCoreException {
if (changes != null && !changes.isEmpty()) {
Set<Integer> modifiedArtIds = new HashSet<Integer>();
Multimap<Integer, Integer> modifiedAttrIds = LinkedListMultimap.create();
@@ -85,11 +87,11 @@ public class MissingChangeItemFactoryImpl implements MissingChangeItemFactory {
return Collections.emptyList();
}
- private Set<Integer> determineWhichArtifactsNotOnDestination(HasCancellation cancellation, OrcsSession session, Set<Integer> artIds, TransactionRecord destTx) throws OseeCoreException {
- DataLoader loader = dataLoaderFactory.newDataLoaderFromIds(session, destTx.getBranch(), artIds);
+ private Set<Integer> determineWhichArtifactsNotOnDestination(HasCancellation cancellation, OrcsSession session, Set<Integer> artIds, TransactionReadable destTx) throws OseeCoreException {
+ DataLoader loader = dataLoaderFactory.newDataLoaderFromIds(session, getBranch(destTx), artIds);
final Set<Integer> missingArtIds = new LinkedHashSet<Integer>(artIds);
loader.includeDeletedArtifacts();
- loader.fromTransaction(destTx.getId());
+ loader.fromTransaction(destTx.getGuid());
loader.load(cancellation, new LoadDataHandlerAdapter() {
@@ -101,14 +103,14 @@ public class MissingChangeItemFactoryImpl implements MissingChangeItemFactory {
return missingArtIds;
}
- private Collection<ChangeItem> createMissingChangeItems(HasCancellation cancellation, OrcsSession session, TransactionRecord sourceTx, TransactionRecord destTx, final Set<Integer> modifiedArtIds, final Multimap<Integer, Integer> modifiedAttrIds, final Multimap<Integer, Integer> modifiedRels, final Set<Integer> missingArtIds, final Set<Integer> allArtIds) throws OseeCoreException {
+ private Collection<ChangeItem> createMissingChangeItems(HasCancellation cancellation, OrcsSession session, TransactionReadable sourceTx, TransactionReadable destTx, final Set<Integer> modifiedArtIds, final Multimap<Integer, Integer> modifiedAttrIds, final Multimap<Integer, Integer> modifiedRels, final Set<Integer> missingArtIds, final Set<Integer> allArtIds) throws OseeCoreException {
final Set<ChangeItem> toReturn = new LinkedHashSet<ChangeItem>();
final Set<RelationData> relations = new LinkedHashSet<RelationData>();
- DataLoader loader = dataLoaderFactory.newDataLoaderFromIds(session, sourceTx.getBranch(), missingArtIds);
+ DataLoader loader = dataLoaderFactory.newDataLoaderFromIds(session, getBranch(sourceTx), missingArtIds);
loader.withLoadLevel(LoadLevel.ALL);
loader.includeDeletedArtifacts();
- loader.fromTransaction(sourceTx.getId());
+ loader.fromTransaction(sourceTx.getGuid());
loader.load(cancellation, new LoadDataHandlerAdapter() {
@@ -159,12 +161,16 @@ public class MissingChangeItemFactoryImpl implements MissingChangeItemFactory {
return toReturn;
}
- private Set<RelationChangeItem> createExistingRelations(HasCancellation cancellation, OrcsSession session, TransactionRecord destTx, final Multimap<Integer, RelationData> relationChangesToAdd) throws OseeCoreException {
+ private IOseeBranch getBranch(TransactionReadable tx) {
+ return TokenFactory.createBranch(tx.getBranchId(), "Missing Change Items");
+ }
+
+ private Set<RelationChangeItem> createExistingRelations(HasCancellation cancellation, OrcsSession session, TransactionReadable destTx, final Multimap<Integer, RelationData> relationChangesToAdd) throws OseeCoreException {
final Set<RelationChangeItem> toReturn = new LinkedHashSet<RelationChangeItem>();
DataLoader loader =
- dataLoaderFactory.newDataLoaderFromIds(session, destTx.getBranch(), relationChangesToAdd.keySet());
- loader.fromTransaction(destTx.getId());
+ dataLoaderFactory.newDataLoaderFromIds(session, getBranch(destTx), relationChangesToAdd.keySet());
+ loader.fromTransaction(destTx.getGuid());
loader.load(cancellation, new LoadDataHandlerAdapter() {
@Override
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/CommitTransactionDatabaseTxCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/CommitTransactionDatabaseTxCallable.java
index 8cbc12f967..1595f4687f 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/CommitTransactionDatabaseTxCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/CommitTransactionDatabaseTxCallable.java
@@ -11,13 +11,10 @@
package org.eclipse.osee.orcs.db.internal.transaction;
import java.util.Date;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.BranchState;
import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
-import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
-import org.eclipse.osee.framework.core.model.cache.BranchCache;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.OseeConnection;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -29,7 +26,9 @@ import org.eclipse.osee.orcs.core.ds.OrcsChangeSet;
import org.eclipse.osee.orcs.core.ds.TransactionData;
import org.eclipse.osee.orcs.core.ds.TransactionResult;
import org.eclipse.osee.orcs.data.ArtifactReadable;
+import org.eclipse.osee.orcs.data.TransactionReadable;
import org.eclipse.osee.orcs.db.internal.callable.AbstractDatastoreTxCallable;
+import org.eclipse.osee.orcs.db.internal.loader.data.TransactionDataImpl;
import org.eclipse.osee.orcs.db.internal.sql.RelationalConstants;
/**
@@ -39,18 +38,16 @@ import org.eclipse.osee.orcs.db.internal.sql.RelationalConstants;
*/
public final class CommitTransactionDatabaseTxCallable extends AbstractDatastoreTxCallable<TransactionResult> {
- private final BranchCache branchCache;
- private final TransactionRecordFactory factory;
private final TransactionData transactionData;
private final TransactionProcessorProvider provider;
private final TransactionWriter writer;
+ private static final String UPDATE_BRANCH_STATE =
+ "UPDATE osee_branch SET branch_state = ? WHERE branch_id = ? and branch_state = ?";
- public CommitTransactionDatabaseTxCallable(Log logger, OrcsSession session, IOseeDatabaseService dbService, BranchCache branchCache, TransactionRecordFactory factory, TransactionProcessorProvider provider, TransactionWriter writer, TransactionData transactionData) {
+ public CommitTransactionDatabaseTxCallable(Log logger, OrcsSession session, IOseeDatabaseService dbService, TransactionProcessorProvider provider, TransactionWriter writer, TransactionData transactionData) {
super(logger, session, dbService, String.format("Committing Transaction: [%s] for branch [%s]",
transactionData.getComment(), transactionData.getBranch()));
- this.branchCache = branchCache;
- this.factory = factory;
this.provider = provider;
this.writer = writer;
@@ -74,7 +71,7 @@ public final class CommitTransactionDatabaseTxCallable extends AbstractDatastore
// TODO:
// 1. Make this whole method a critical region on a per branch basis - can only write to a branch on one thread at time
String comment = transactionData.getComment();
- Branch branch = branchCache.get(transactionData.getBranch());
+ IOseeBranch branch = transactionData.getBranch();
ArtifactReadable author = transactionData.getAuthor();
OrcsChangeSet changeSet = transactionData.getChangeSet();
@@ -85,14 +82,13 @@ public final class CommitTransactionDatabaseTxCallable extends AbstractDatastore
process(TxWritePhaseEnum.BEFORE_TX_WRITE);
- TransactionRecord txRecord = createTransactionRecord(branch, author, comment, getNextTransactionId());
+ TransactionReadable txRecord = createTransactionRecord(branch, author, comment, getNextTransactionId());
writer.write(connection, txRecord, changeSet);
- if (branch.getBranchState() == BranchState.CREATED) {
- branch.setBranchState(BranchState.MODIFIED);
- branchCache.storeItems(branch);
- }
- branchCache.cache(txRecord);
+ Object[] params =
+ new Object[] {BranchState.MODIFIED.getValue(), branch.getUuid(), BranchState.CREATED.getValue()};
+ getDatabaseService().runPreparedUpdate(connection, UPDATE_BRANCH_STATE, params);
+
return new TransactionResultImpl(txRecord, changeSet);
}
@@ -108,28 +104,36 @@ public final class CommitTransactionDatabaseTxCallable extends AbstractDatastore
process(TxWritePhaseEnum.AFTER_TX_WRITE);
}
- private TransactionRecord createTransactionRecord(Branch branch, ArtifactReadable author, String comment, int transactionNumber) throws OseeCoreException {
+ private TransactionReadable createTransactionRecord(IOseeBranch branch, ArtifactReadable author, String comment, int transactionNumber) throws OseeCoreException {
int authorArtId = author.getLocalId();
TransactionDetailsType txType = TransactionDetailsType.NonBaselined;
Date transactionTime = GlobalTime.GreenwichMeanTimestamp();
- return factory.create(transactionNumber, branch, comment, transactionTime, authorArtId,
- RelationalConstants.ART_ID_SENTINEL, txType);
+ TransactionDataImpl created = new TransactionDataImpl();
+ created.setAuthorId(authorArtId);
+ created.setBranchId(branch.getUuid());
+ created.setComment(comment);
+ created.setCommit(RelationalConstants.ART_ID_SENTINEL);
+ created.setDate(transactionTime);
+ created.setLocalId(transactionNumber);
+ created.setTxType(txType);
+
+ return created;
}
private static final class TransactionResultImpl implements TransactionResult {
- private final TransactionRecord tx;
+ private final TransactionReadable tx;
private final OrcsChangeSet data;
- public TransactionResultImpl(TransactionRecord tx, OrcsChangeSet data) {
+ public TransactionResultImpl(TransactionReadable tx, OrcsChangeSet data) {
super();
this.tx = tx;
this.data = data;
}
@Override
- public TransactionRecord getTransaction() {
+ public TransactionReadable getTransaction() {
return tx;
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriter.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriter.java
index 2d75fdb242..4e69e32478 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriter.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriter.java
@@ -14,7 +14,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
import org.eclipse.osee.framework.core.enums.TxChange;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.AbstractJoinQuery;
import org.eclipse.osee.framework.database.core.IOseeStatement;
@@ -22,6 +21,7 @@ import org.eclipse.osee.framework.database.core.OseeConnection;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.core.ds.OrcsChangeSet;
+import org.eclipse.osee.orcs.data.TransactionReadable;
/**
* @author Roberto E. Escobar
@@ -115,7 +115,7 @@ public class TransactionWriter {
}
}
- public void write(OseeConnection connection, TransactionRecord tx, OrcsChangeSet txData) throws OseeCoreException {
+ public void write(OseeConnection connection, TransactionReadable tx, OrcsChangeSet txData) throws OseeCoreException {
sqlBuilder.accept(tx, txData);
try {
binaryStores = sqlBuilder.getBinaryStores();
@@ -124,7 +124,7 @@ public class TransactionWriter {
}
sqlBuilder.updateAfterBinaryStorePersist();
- long branchUuid = tx.getBranch().getUuid();
+ long branchUuid = tx.getBranchId();
List<Object[]> txNotCurrentData = new ArrayList<Object[]>();
for (Entry<SqlOrderEnum, ? extends AbstractJoinQuery> entry : sqlBuilder.getTxNotCurrents()) {
fetchTxNotCurrent(connection, branchUuid, txNotCurrentData, entry.getKey().getTxsNotCurrentQuery(),
@@ -139,7 +139,6 @@ public class TransactionWriter {
}
}
dbService.runBatchUpdate(connection, UPDATE_TXS_NOT_CURRENT, txNotCurrentData);
- tx.clearDirty();
} finally {
sqlBuilder.clear();
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxModule.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxModule.java
index 2cffb7c03a..0f0bd3ea0b 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxModule.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxModule.java
@@ -58,8 +58,7 @@ public class TxModule {
public Callable<TransactionResult> commitTransaction(OrcsSession session, TransactionData data) {
TxSqlBuilderImpl builder = new TxSqlBuilderImpl(dbService, idManager);
TransactionWriter writer = new TransactionWriter(logger, dbService, builder);
- return new CommitTransactionDatabaseTxCallable(logger, session, dbService, cachingService.getBranchCache(),
- modelFactory.getTransactionFactory(), processors, writer, data);
+ return new CommitTransactionDatabaseTxCallable(logger, session, dbService, processors, writer, data);
}
@Override
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilder.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilder.java
index 8a4d36e424..e6ba86d5b6 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilder.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilder.java
@@ -13,10 +13,10 @@ package org.eclipse.osee.orcs.db.internal.transaction;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.database.core.IdJoinQuery;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.core.ds.OrcsChangeSet;
+import org.eclipse.osee.orcs.data.TransactionReadable;
import org.eclipse.osee.orcs.db.internal.transaction.TransactionWriter.SqlOrderEnum;
/**
@@ -26,7 +26,7 @@ public interface TxSqlBuilder {
void clear();
- void accept(TransactionRecord tx, OrcsChangeSet txData) throws OseeCoreException;
+ void accept(TransactionReadable tx, OrcsChangeSet txData) throws OseeCoreException;
Set<Entry<SqlOrderEnum, IdJoinQuery>> getTxNotCurrents();
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilderImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilderImpl.java
index ec52464237..f58554d406 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilderImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/TxSqlBuilderImpl.java
@@ -19,7 +19,6 @@ import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.enums.TxChange;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.database.core.IdJoinQuery;
import org.eclipse.osee.framework.database.core.JoinUtility;
@@ -33,6 +32,7 @@ import org.eclipse.osee.orcs.core.ds.OrcsData;
import org.eclipse.osee.orcs.core.ds.OrcsVisitor;
import org.eclipse.osee.orcs.core.ds.RelationData;
import org.eclipse.osee.orcs.core.ds.VersionData;
+import org.eclipse.osee.orcs.data.TransactionReadable;
import org.eclipse.osee.orcs.db.internal.IdentityManager;
import org.eclipse.osee.orcs.db.internal.sql.RelationalConstants;
import org.eclipse.osee.orcs.db.internal.transaction.TransactionWriter.SqlOrderEnum;
@@ -85,13 +85,13 @@ public class TxSqlBuilderImpl implements OrcsVisitor, TxSqlBuilder {
}
@Override
- public void accept(TransactionRecord tx, OrcsChangeSet changeSet) throws OseeCoreException {
- txId = tx.getId();
+ public void accept(TransactionReadable tx, OrcsChangeSet changeSet) throws OseeCoreException {
+ txId = tx.getGuid();
binaryStores = new ArrayList<DaoToSql>();
dataItemInserts = new HashCollection<SqlOrderEnum, Object[]>();
txNotCurrentsJoin = new HashMap<SqlOrderEnum, IdJoinQuery>();
- addRow(SqlOrderEnum.TXS_DETAIL, txId, tx.getComment(), tx.getTimeStamp(), tx.getAuthor(), tx.getBranchId(),
+ addRow(SqlOrderEnum.TXS_DETAIL, txId, tx.getComment(), tx.getDate(), tx.getAuthorId(), tx.getBranchId(),
tx.getTxType().getId());
changeSet.accept(this);
}
diff --git a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsBranchTest.java b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsBranchTest.java
index ef85f6fa25..955ab45189 100644
--- a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsBranchTest.java
+++ b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsBranchTest.java
@@ -25,7 +25,6 @@ import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.enums.SystemUser;
-import org.eclipse.osee.framework.core.model.BranchReadable;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.ApplicationContext;
@@ -33,6 +32,8 @@ import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.OrcsBranch;
import org.eclipse.osee.orcs.data.ArtifactId;
import org.eclipse.osee.orcs.data.ArtifactReadable;
+import org.eclipse.osee.orcs.data.BranchReadable;
+import org.eclipse.osee.orcs.data.TransactionReadable;
import org.eclipse.osee.orcs.db.mock.OsgiService;
import org.eclipse.osee.orcs.search.QueryFactory;
import org.eclipse.osee.orcs.transaction.TransactionBuilder;
@@ -119,9 +120,9 @@ public class OrcsBranchTest {
int SOURCE_TX_ID = 16;
// get the list of changes from the original branch
- Callable<List<ChangeItem>> callable =
- branchInterface.compareBranch(TokenFactory.createTransaction(PRIOR_TX_ID),
- TokenFactory.createTransaction(SOURCE_TX_ID));
+ TransactionReadable priorTx = query.transactionQuery().andTxId(PRIOR_TX_ID).getResults().getExactlyOne();
+ TransactionReadable sourceTx = query.transactionQuery().andTxId(SOURCE_TX_ID).getResults().getExactlyOne();
+ Callable<List<ChangeItem>> callable = branchInterface.compareBranch(priorTx, sourceTx);
List<ChangeItem> priorItems = callable.call();
// create the branch with the copied transaction
diff --git a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsPortingTest.java b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsPortingTest.java
index 53c5948ef4..a9db836f0f 100644
--- a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsPortingTest.java
+++ b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsPortingTest.java
@@ -20,7 +20,6 @@ import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.SystemUser;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.framework.jdk.core.util.GUID;
@@ -29,6 +28,7 @@ import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.OrcsBranch;
import org.eclipse.osee.orcs.data.ArtifactId;
import org.eclipse.osee.orcs.data.ArtifactReadable;
+import org.eclipse.osee.orcs.data.TransactionReadable;
import org.eclipse.osee.orcs.db.mock.OsgiService;
import org.eclipse.osee.orcs.search.QueryFactory;
import org.eclipse.osee.orcs.transaction.TransactionBuilder;
@@ -78,18 +78,19 @@ public class OrcsPortingTest {
String assocArtifactGuid = GUID.create();
setupAssociatedArtifact(assocArtifactGuid);
- TransactionRecord mainBranchTx = createBaselineBranchAndArtifacts(artifactGuid);
- TransactionRecord transactionToCopy = createWorkingBranchChanges(mainBranchTx.getBranch(), artifactGuid);
+ TransactionReadable mainBranchTx = createBaselineBranchAndArtifacts(artifactGuid);
+ IOseeBranch branch = TokenFactory.createBranch(mainBranchTx.getBranchId(), "MainFromBranch");
+ TransactionReadable transactionToCopy = createWorkingBranchChanges(branch, artifactGuid);
IOseeBranch copyTxBranch = createCopyFromTransactionBranch(transactionToCopy, assocArtifactGuid);
- TransactionRecord finalTx = commitToDestinationBranch(copyTxBranch);
+ TransactionReadable finalTx = commitToDestinationBranch(copyTxBranch);
// now check to make sure everything is as expected
// we should have a SoftwareRequirement named "SecondRequirement" with an attribute named "test changed" (changed on child branch to this)
// the attribute for the SecondRequirement should not be named "test changed again" (on the branch after the copy from)
// we should have a folder named "childBranch folder", but no folder named "folder after transaction"
ResultSet<ArtifactReadable> artifacts =
- query.fromBranch(finalTx.getBranch()).andTypeEquals(CoreArtifactTypes.Artifact).getResults();
+ query.fromBranch(finalTx.getBranchId()).andTypeEquals(CoreArtifactTypes.Artifact).getResults();
for (ArtifactReadable art : artifacts) {
if (art.isOfType(CoreArtifactTypes.SoftwareRequirement)) {
assertEquals(2, art.getAttributes().size());
@@ -118,8 +119,8 @@ public class OrcsPortingTest {
String assocArtifactGuid = GUID.create();
setupAssociatedArtifact(assocArtifactGuid);
- TransactionRecord mainBranchTx = createBaselineBranchAndArtifacts(artifactGuid);
- TransactionRecord differentBranchTx = createBaselineBranchAndArtifacts(differentGuid);
+ TransactionReadable mainBranchTx = createBaselineBranchAndArtifacts(artifactGuid);
+ TransactionReadable differentBranchTx = createBaselineBranchAndArtifacts(differentGuid);
IOseeBranch copyTxBranch = createCopyFromTransactionBranch(mainBranchTx, assocArtifactGuid);
assertNotNull(copyTxBranch);
@@ -131,7 +132,7 @@ public class OrcsPortingTest {
fail(); // should never get here due to thrown exception
}
- private TransactionRecord createBaselineBranchAndArtifacts(String artifactGuid) throws Exception {
+ private TransactionReadable createBaselineBranchAndArtifacts(String artifactGuid) throws Exception {
// set up the main branch
IOseeBranch branch = TokenFactory.createBranch("MainFromBranch");
branchApi.createTopLevelBranch(branch, author).call();
@@ -157,10 +158,10 @@ public class OrcsPortingTest {
tx.commit();
}
- private TransactionRecord createWorkingBranchChanges(IOseeBranch parentBranch, String artifactToModifyGuid) throws Exception {
+ private TransactionReadable createWorkingBranchChanges(IOseeBranch parentBranch, String artifactToModifyGuid) throws Exception {
// set up the child branch to copy to
- IOseeBranch childBranch = TokenFactory.createBranch( "childBranch");
+ IOseeBranch childBranch = TokenFactory.createBranch("childBranch");
branchApi.createWorkingBranch(childBranch, author, parentBranch, null).call();
TransactionBuilder tx3 = txFactory.createTransaction(childBranch, author, "update second requirement");
@@ -174,7 +175,7 @@ public class OrcsPortingTest {
tx3.createArtifact(CoreArtifactTypes.Folder, "childBranch folder");
// set this aside to use in the copy from transaction for the branch
- TransactionRecord transactionToCopy = tx3.commit();
+ TransactionReadable transactionToCopy = tx3.commit();
// make an additional transaction to make sure it doesn't get copied also
TransactionBuilder tx4 = txFactory.createTransaction(childBranch, author, "after second requirement");
@@ -191,7 +192,7 @@ public class OrcsPortingTest {
return transactionToCopy;
}
- private IOseeBranch createCopyFromTransactionBranch(TransactionRecord transactionToCopy, String assocArtifactGuid) throws Exception {
+ private IOseeBranch createCopyFromTransactionBranch(TransactionReadable transactionToCopy, String assocArtifactGuid) throws Exception {
// create the branch with the copied transaction
IOseeBranch branch = TokenFactory.createBranch(branchString);
@@ -205,7 +206,7 @@ public class OrcsPortingTest {
return branchApi.createPortBranch(branch, author, transactionToCopy, readableReq).call();
}
- private TransactionRecord commitToDestinationBranch(IOseeBranch copyTxBranch) throws Exception {
+ private TransactionReadable commitToDestinationBranch(IOseeBranch copyTxBranch) throws Exception {
IOseeBranch destinationBranch = TokenFactory.createBranch("IndepToBranch");
branchApi.createTopLevelBranch(destinationBranch, author).call();
return branchApi.commitBranch(author, copyTxBranch, destinationBranch).call();
diff --git a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsQueryTest.java b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsQueryTest.java
index c8c9ec6e23..d7405be68d 100644
--- a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsQueryTest.java
+++ b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsQueryTest.java
@@ -27,7 +27,6 @@ import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.core.enums.SystemUser;
-import org.eclipse.osee.framework.core.model.BranchReadable;
import org.eclipse.osee.framework.jdk.core.type.MatchLocation;
import org.eclipse.osee.framework.jdk.core.type.Named;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -37,6 +36,7 @@ import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.OrcsBranch;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.AttributeReadable;
+import org.eclipse.osee.orcs.data.BranchReadable;
import org.eclipse.osee.orcs.data.HasLocalId;
import org.eclipse.osee.orcs.db.mock.OsgiService;
import org.eclipse.osee.orcs.search.Match;
diff --git a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTransactionTest.java b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTransactionTest.java
index ce92959db5..496d4014fb 100644
--- a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTransactionTest.java
+++ b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTransactionTest.java
@@ -37,8 +37,6 @@ import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
import org.eclipse.osee.framework.core.enums.DeletionFlag;
import org.eclipse.osee.framework.core.enums.SystemUser;
import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
-import org.eclipse.osee.framework.core.model.BranchReadable;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
@@ -49,6 +47,7 @@ import org.eclipse.osee.orcs.OrcsBranch;
import org.eclipse.osee.orcs.data.ArtifactId;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.AttributeReadable;
+import org.eclipse.osee.orcs.data.BranchReadable;
import org.eclipse.osee.orcs.data.TransactionReadable;
import org.eclipse.osee.orcs.db.mock.OsgiService;
import org.eclipse.osee.orcs.search.BranchQuery;
@@ -150,14 +149,14 @@ public class OrcsTransactionTest {
tx.setAttributesFromStrings(artifactId, CoreAttributeTypes.Annotation, expectedAnnotation);
assertEquals(expectedName, artifactId.getName());
- TransactionRecord newTx = tx.commit();
+ TransactionReadable newTx = tx.commit();
assertFalse(tx.isCommitInProgress());
TransactionReadable newHeadTx = transactionQuery.andIsHead(branchReadable).getResults().getExactlyOne();
- assertEquals(newTx.getId(), newHeadTx.getLocalId().intValue());
+ assertEquals(newTx.getGuid().intValue(), newHeadTx.getLocalId().intValue());
- TransactionReadable newTxReadable = transactionQuery.andTxId(newTx.getId()).getResults().getExactlyOne();
+ TransactionReadable newTxReadable = transactionQuery.andTxId(newTx.getGuid()).getResults().getExactlyOne();
checkTransaction(previousTx, newTxReadable, branchReadable, comment, userArtifact);
ResultSet<ArtifactReadable> result = query.fromBranch(CoreBranches.COMMON).andIds(artifactId).getResults();
@@ -192,7 +191,7 @@ public class OrcsTransactionTest {
tx.setAttributesFromStrings(artifactId, CoreAttributeTypes.QualificationMethod, expectedQualifaction);
assertEquals(expectedName, artifactId.getName());
- TransactionRecord newTx = tx.commit();
+ TransactionReadable newTx = tx.commit();
ArtifactReadable artifactReadable =
query.fromBranch(CoreBranches.COMMON).andIds(artifactId).getResults().getExactlyOne();
@@ -347,13 +346,13 @@ public class OrcsTransactionTest {
ArtifactId artifact2 = tx.createArtifact(CoreArtifactTypes.Folder, "deleteThisFolder");
tx.createAttribute(artifact2, CoreAttributeTypes.Annotation, "annotation");
tx.relate(artifact2, Default_Hierarchical__Parent, artifact1);
- TransactionRecord tx1 = tx.commit();
+ TransactionReadable tx1 = tx.commit();
artifacts[0] = artifact1;
artifacts[1] = artifact2;
tx = createTx();
tx.deleteAttributes(artifact1, CoreAttributeTypes.GeneralStringData);
- TransactionRecord tx2 = tx.commit();
+ TransactionReadable tx2 = tx.commit();
ArtifactReadable toDelete = query.fromBranch(CoreBranches.COMMON).andIds(artifact1).getResults().getExactlyOne();
@@ -361,19 +360,19 @@ public class OrcsTransactionTest {
tx.deleteArtifact(toDelete);
tx.deleteAttributes(artifact2, CoreAttributeTypes.Annotation);
tx.unrelate(artifact2, Default_Hierarchical__Parent, artifact1);
- TransactionRecord tx3 = tx.commit();
+ TransactionReadable tx3 = tx.commit();
toDelete = query.fromBranch(CoreBranches.COMMON).andIds(artifact2).getResults().getExactlyOne();
tx = createTx();
tx.deleteArtifact(toDelete);
- TransactionRecord tx4 = tx.commit();
+ TransactionReadable tx4 = tx.commit();
toDelete =
query.fromBranch(CoreBranches.COMMON).andIds(artifact1).includeDeletedArtifacts().getResults().getOneOrNull();
assertNotNull(toDelete);
assertTrue(toDelete.isDeleted());
- int[] toReturn = {tx1.getId(), tx2.getId(), tx3.getGuid(), tx4.getId()};
+ int[] toReturn = {tx1.getGuid(), tx2.getGuid(), tx3.getGuid(), tx4.getGuid()};
return toReturn;
}
@@ -632,14 +631,14 @@ public class OrcsTransactionTest {
TransactionBuilder tx = createTx();
String guid = tx.createArtifact(CoreArtifactTypes.Component, "A component").getGuid();
- int startingTx = tx.commit().getId();
+ int startingTx = tx.commit().getGuid();
ArtifactReadable artifact = query.fromBranch(CoreBranches.COMMON).andGuid(guid).getResults().getExactlyOne();
assertEquals(startingTx, artifact.getTransaction());
TransactionBuilder tx2 = createTx();
tx2.setName(artifact, "Modified - component");
- int lastTx = tx2.commit().getId();
+ int lastTx = tx2.commit().getGuid();
assertTrue(startingTx != lastTx);
@@ -683,7 +682,7 @@ public class OrcsTransactionTest {
ArtifactId art2 = tx1.createArtifact(CoreArtifactTypes.Component, "B component");
ArtifactId art3 = tx1.createArtifact(CoreArtifactTypes.Component, "C component");
tx1.addChildren(art1, art2, art3);
- int tx1Id = tx1.commit().getId();
+ int tx1Id = tx1.commit().getGuid();
QueryBuilder art1Query = query.fromBranch(CoreBranches.COMMON).andIds(art1);
@@ -701,7 +700,7 @@ public class OrcsTransactionTest {
TransactionBuilder tx2 = createTx();
ArtifactId art4 = tx2.createArtifact(Component, "D component");
tx2.relate(art1, Default_Hierarchical__Child, art4, LEXICOGRAPHICAL_DESC);
- int tx2Id = tx2.commit().getId();
+ int tx2Id = tx2.commit().getGuid();
ArtifactReadable artifact21 = art1Query.getResults().getExactlyOne();
assertEquals("A component", artifact21.getName());
@@ -922,7 +921,7 @@ public class OrcsTransactionTest {
tx = createTx();
tx.setSoleAttributeFromString(art1, CoreAttributeTypes.Annotation, "write5");
- TransactionRecord lastTx = tx.commit();
+ TransactionReadable lastTx = tx.commit();
ArtifactReadable art = query.fromBranch(COMMON).andIds(art1).getResults().getExactlyOne();
ResultSet<? extends AttributeReadable<Object>> attributes = art.getAttributes(CoreAttributeTypes.Annotation);
@@ -930,7 +929,7 @@ public class OrcsTransactionTest {
assertEquals(1, attributes.size());
assertEquals("write5", attributes.getExactlyOne().getValue());
- QueryBuilder builder = query.fromBranch(COMMON).fromTransaction(lastTx.getId()).andIds(art1);
+ QueryBuilder builder = query.fromBranch(COMMON).fromTransaction(lastTx.getGuid()).andIds(art1);
ResultSet<ArtifactReadable> results = builder.getResults();
art = results.getExactlyOne();
attributes = art.getAttributes(CoreAttributeTypes.Annotation);
@@ -960,7 +959,7 @@ public class OrcsTransactionTest {
tx = createTx();
tx.setRationale(art1, CoreRelationTypes.Users_User, art2, "rationale5");
- TransactionRecord lastTx = tx.commit();
+ TransactionReadable lastTx = tx.commit();
ArtifactReadable art = query.fromBranch(COMMON).andIds(art1).getResults().getExactlyOne();
ResultSet<ArtifactReadable> related = art.getRelated(CoreRelationTypes.Users_User);
@@ -970,7 +969,7 @@ public class OrcsTransactionTest {
assertEquals("rationale5", rationale);
- art = query.fromBranch(COMMON).fromTransaction(lastTx.getId()).andIds(art1).getResults().getExactlyOne();
+ art = query.fromBranch(COMMON).fromTransaction(lastTx.getGuid()).andIds(art1).getResults().getExactlyOne();
related = art.getRelated(CoreRelationTypes.Users_User);
assertEquals(1, related.size());
other = related.getExactlyOne();
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsBranch.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsBranch.java
index b05b4e8ddf..d48fb162e7 100644
--- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsBranch.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/OrcsBranch.java
@@ -17,14 +17,14 @@ import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.ITransaction;
import org.eclipse.osee.framework.core.enums.BranchState;
import org.eclipse.osee.framework.core.enums.BranchType;
-import org.eclipse.osee.framework.core.model.BranchReadable;
-import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.orcs.data.ArchiveOperation;
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;
/**
* @author Roberto E. Escobar
@@ -72,9 +72,9 @@ public interface OrcsBranch {
Callable<List<IOseeBranch>> purgeBranch(IOseeBranch branch, boolean recurse);
- Callable<TransactionRecord> commitBranch(ArtifactReadable committer, IOseeBranch source, IOseeBranch destination);
+ Callable<TransactionReadable> commitBranch(ArtifactReadable committer, IOseeBranch source, IOseeBranch destination);
- Callable<List<ChangeItem>> compareBranch(ITransaction sourceTx, ITransaction destinationTx);
+ Callable<List<ChangeItem>> compareBranch(TransactionReadable sourceTx, TransactionReadable destinationTx);
Callable<List<ChangeItem>> compareBranch(IOseeBranch branch) throws OseeCoreException;
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/CreateBranchData.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/CreateBranchData.java
index 9bc7eda984..df4b60720f 100644
--- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/CreateBranchData.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/CreateBranchData.java
@@ -39,6 +39,7 @@ public class CreateBranchData implements Identifiable<Long> {
private long mergeDestinationBranchId = MERGE_DESTINATION_BRANCH_ID;
private boolean txCopyBranchType = false;
+ private Long parentBranchUuid;
public CreateBranchData() {
this(Lib.generateUuid());
@@ -181,4 +182,12 @@ public class CreateBranchData implements Identifiable<Long> {
this.branchUuid = uuid;
}
+ public void setParentBranchUuid(Long uuid) {
+ this.parentBranchUuid = uuid;
+ }
+
+ public Long getParentBranchUuid() {
+ return parentBranchUuid;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/TransactionReadableDelta.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/TransactionReadableDelta.java
new file mode 100644
index 0000000000..02268a26b4
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/TransactionReadableDelta.java
@@ -0,0 +1,63 @@
+package org.eclipse.osee.orcs.data;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class TransactionReadableDelta {
+ private final TransactionReadable startTx;
+ private final TransactionReadable endTx;
+
+ public TransactionReadableDelta(TransactionReadable startTx, TransactionReadable endTx) {
+ super();
+ this.startTx = startTx;
+ this.endTx = endTx;
+ }
+
+ public TransactionReadable getStartTx() {
+ return startTx;
+ }
+
+ public TransactionReadable getEndTx() {
+ return endTx;
+ }
+
+ public boolean areOnTheSameBranch() {
+ return startTx.getBranchId().equals(endTx.getBranchId());
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ boolean result = false;
+ if (obj instanceof TransactionReadableDelta) {
+ TransactionReadableDelta other = (TransactionReadableDelta) obj;
+ boolean left = startTx == null ? other.startTx == null : startTx.equals(other.startTx);
+ boolean right = endTx == null ? other.endTx == null : endTx.equals(other.endTx);
+ result = left && right;
+ }
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 37;
+ int result = 17;
+ if (startTx != null) {
+ result = prime * result + startTx.hashCode();
+ } else {
+ result = prime * result;
+ }
+ if (endTx != null) {
+ result = prime * result + endTx.hashCode();
+ } else {
+ result = prime * result;
+ }
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ String firstString = String.valueOf(getStartTx());
+ String secondString = String.valueOf(getEndTx());
+ return String.format("[start:%s, end:%s]", firstString, secondString);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionBuilder.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionBuilder.java
index d13fe32a4b..040be46fb4 100644
--- a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionBuilder.java
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/transaction/TransactionBuilder.java
@@ -19,12 +19,12 @@ 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.model.TransactionRecord;
import org.eclipse.osee.framework.jdk.core.type.Identifiable;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.data.ArtifactId;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.AttributeId;
+import org.eclipse.osee.orcs.data.TransactionReadable;
/**
* @author Roberto E. Escobar
@@ -39,7 +39,7 @@ public interface TransactionBuilder {
void setComment(String comment) throws OseeCoreException;
- TransactionRecord commit() throws OseeCoreException;
+ TransactionReadable commit() throws OseeCoreException;
boolean isCommitInProgress();

Back to the top