Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjphillips2009-12-15 17:47:25 +0000
committerjphillips2009-12-15 17:47:25 +0000
commit45e24ce6164e2bedb46b2a50dd7e263113dcfab6 (patch)
tree8eda7cbbe7caf14ed94a30475e9585f9ddbce028 /org.eclipse.osee.framework.branch.management
parent0938a1f22efd996158ca3caf8a0cda21a7ec2392 (diff)
downloadorg.eclipse.osee-45e24ce6164e2bedb46b2a50dd7e263113dcfab6.tar.gz
org.eclipse.osee-45e24ce6164e2bedb46b2a50dd7e263113dcfab6.tar.xz
org.eclipse.osee-45e24ce6164e2bedb46b2a50dd7e263113dcfab6.zip
Diffstat (limited to 'org.eclipse.osee.framework.branch.management')
-rw-r--r--org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/commit/CommitDbOperation.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/commit/CommitDbOperation.java b/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/commit/CommitDbOperation.java
index 61885938ca7..a46148aaf81 100644
--- a/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/commit/CommitDbOperation.java
+++ b/org.eclipse.osee.framework.branch.management/src/org/eclipse/osee/framework/branch/management/commit/CommitDbOperation.java
@@ -17,6 +17,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Level;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.branch.management.internal.Activator;
import org.eclipse.osee.framework.core.cache.BranchCache;
@@ -102,11 +103,8 @@ public class CommitDbOperation extends AbstractDbTxOperation {
if (changes.isEmpty()) {
throw new OseeStateException(" A branch can not be commited without any changes made.");
}
- checkPreconditions();
storedBranchState = sourceBranch.getBranchState();
- if (!sourceBranch.getBranchState().equals(BranchState.COMMITTED)) {
- updateBranchState(BranchState.COMMIT_IN_PROGRESS);
- }
+ checkPreconditions();
try {
txHolder.setTransaction(addCommitTransactionToDatabase(userArtId));
@@ -125,12 +123,17 @@ public class CommitDbOperation extends AbstractDbTxOperation {
sourceBranch.getId(), destinationBranch.getId());
}
- public void checkPreconditions() throws OseeCoreException {
+ public synchronized void checkPreconditions() throws OseeCoreException {
int count =
getDatabaseService().runPreparedQueryFetchObject(0, SELECT_SOURCE_BRANCH_STATE, sourceBranch.getId(),
BranchState.COMMIT_IN_PROGRESS.getValue());
- if (count > 0) {
- throw new OseeStateException(String.format("Commit already in progress for [%s]", sourceBranch));
+ if (sourceBranch.getBranchState().equals(BranchState.COMMIT_IN_PROGRESS) || sourceBranch.getArchiveState().isArchived() || count > 0) {
+ throw new OseeStateException(String.format("Commit completed or in progress for [%s]", sourceBranch));
+ }
+
+ if (!sourceBranch.getBranchState().equals(BranchState.COMMITTED)) {
+ updateBranchState(BranchState.COMMIT_IN_PROGRESS);
+ sourceBranch.setBranchState(BranchState.COMMIT_IN_PROGRESS);
}
}

Back to the top