diff options
author | donald.g.dunne | 2015-09-08 23:31:03 +0000 |
---|---|---|
committer | Ryan T. Baldwin | 2015-09-08 23:31:03 +0000 |
commit | 5e862db0e69afbd037025d9d157480dbdfe19f1b (patch) | |
tree | 8b5a7b59cd96405bc0bc89890068b0f047cf65a4 /plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/CommitTransactionDatabaseTxCallable.java | |
parent | 24b80e4cb9ed5005890cdf6da8e5e8378b6c2356 (diff) | |
download | org.eclipse.osee-5e862db0e69afbd037025d9d157480dbdfe19f1b.tar.gz org.eclipse.osee-5e862db0e69afbd037025d9d157480dbdfe19f1b.tar.xz org.eclipse.osee-5e862db0e69afbd037025d9d157480dbdfe19f1b.zip |
refinement: Change server transaction.commit to not exception if empty
Change-Id: Ieb02b4fa145bdcb1c000977ea873a06c94a0e386
Diffstat (limited to 'plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/CommitTransactionDatabaseTxCallable.java')
-rw-r--r-- | plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/transaction/CommitTransactionDatabaseTxCallable.java | 26 |
1 files changed, 17 insertions, 9 deletions
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 29a7b49d517..774711ab9cb 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 @@ -64,9 +64,14 @@ public final class CommitTransactionDatabaseTxCallable extends AbstractDatastore } } + /** + * Persist changes to database. + * + * @return TransactionResult or null if no data was modified + */ @Override protected TransactionResult handleTxWork(JdbcConnection connection) throws OseeCoreException { - ///// + ///// // 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(); @@ -77,18 +82,21 @@ public final class CommitTransactionDatabaseTxCallable extends AbstractDatastore Conditions.checkNotNull(branch, "branch"); Conditions.checkNotNull(author, "transaction author"); Conditions.checkNotNullOrEmpty(comment, "transaction comment"); - Conditions.checkExpressionFailOnTrue(changeSet.isEmpty(), "No data was modified"); + TransactionResult result = null; + if (!changeSet.isEmpty()) { - process(TxWritePhaseEnum.BEFORE_TX_WRITE); + process(TxWritePhaseEnum.BEFORE_TX_WRITE); - TransactionReadable txRecord = createTransactionRecord(branch, author, comment, getNextTransactionId()); - writer.write(connection, txRecord, changeSet); + TransactionReadable txRecord = createTransactionRecord(branch, author, comment, getNextTransactionId()); + writer.write(connection, txRecord, changeSet); - Object[] params = - new Object[] {BranchState.MODIFIED.getValue(), branch.getUuid(), BranchState.CREATED.getValue()}; - getJdbcClient().runPreparedUpdate(connection, UPDATE_BRANCH_STATE, params); + Object[] params = + new Object[] {BranchState.MODIFIED.getValue(), branch.getUuid(), BranchState.CREATED.getValue()}; + getJdbcClient().runPreparedUpdate(connection, UPDATE_BRANCH_STATE, params); - return new TransactionResultImpl(txRecord, changeSet); + result = new TransactionResultImpl(txRecord, changeSet); + } + return result; } @Override |