diff options
author | David W. Miller | 2012-05-17 15:31:37 +0000 |
---|---|---|
committer | Roberto E. Escobar | 2012-05-17 15:31:37 +0000 |
commit | ad438e8b6fc798b0e21c4a770d3c46257739676a (patch) | |
tree | 2f21aa3f0a75f6ff8d7ba76a26ae3159c00689b6 /plugins | |
parent | bab28cec762a90c075a17f07ba00ae1b7b730b07 (diff) | |
download | org.eclipse.osee-ad438e8b6fc798b0e21c4a770d3c46257739676a.tar.gz org.eclipse.osee-ad438e8b6fc798b0e21c4a770d3c46257739676a.tar.xz org.eclipse.osee-ad438e8b6fc798b0e21c4a770d3c46257739676a.zip |
feature[ats_MCQKT]: Add branch copy with transaction client side
Diffstat (limited to 'plugins')
10 files changed, 82 insertions, 17 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCreationRequest.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCreationRequest.java index 8bad7d5b42c..aed5c5ca718 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCreationRequest.java +++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCreationRequest.java @@ -29,6 +29,7 @@ public class BranchCreationRequest { private final String creationComment; private final int mergeAddressingQueryId; private final int mergeDestinationBranchId; + private boolean isTxCopyBranchType; public BranchCreationRequest(BranchType branchType, int sourceTransactionId, int parentBranchId, String branchGuid, String branchName, int associatedArtifactId, int authorId, String creationComment, int mergeAddressingQueryId, int destinationBranchId) { this.parentBranchId = parentBranchId; @@ -41,6 +42,7 @@ public class BranchCreationRequest { this.creationComment = creationComment; this.mergeAddressingQueryId = mergeAddressingQueryId; this.mergeDestinationBranchId = destinationBranchId; + this.isTxCopyBranchType = false; } public String getBranchName() { @@ -83,6 +85,14 @@ public class BranchCreationRequest { return mergeDestinationBranchId; } + public boolean txIsCopied() { + return isTxCopyBranchType; + } + + public void setTxIsCopied(boolean value) { + isTxCopyBranchType = value; + } + @Override public String toString() { return "Branch [associatedArtifactId=" + associatedArtifactId + ", branchGuid=" + branchGuid + ", branchType=" + branchType + ", name=" + branchName + ", parentBranchId=" + parentBranchId + ", parentTransactionId=" + sourceTransactionId + "]"; diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCreationRequestTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCreationRequestTranslator.java index 9949cf04971..b974f3f8b5b 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCreationRequestTranslator.java +++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/BranchCreationRequestTranslator.java @@ -33,7 +33,8 @@ public class BranchCreationRequestTranslator implements ITranslator<BranchCreati CREATION_COMMENT, MERGE_ADDRESSING_QUERY_ID, - MERGE_DESTINATION_BRANCH_ID; + MERGE_DESTINATION_BRANCH_ID, + TX_COPY_BRANCH_TYPE; } @Override @@ -50,11 +51,18 @@ public class BranchCreationRequestTranslator implements ITranslator<BranchCreati String creationComment = store.get(Fields.CREATION_COMMENT.name()); + boolean isTxCopy = store.getBoolean(Fields.TX_COPY_BRANCH_TYPE.name()); + int mergeAddressingQueryId = store.getInt(Fields.MERGE_ADDRESSING_QUERY_ID.name()); int destinationBranchId = store.getInt(Fields.MERGE_DESTINATION_BRANCH_ID.name()); - return new BranchCreationRequest(branchType, sourceTransactionId, parentBranchId, branchGuid, branchName, - associatedArtifactId, authorId, creationComment, mergeAddressingQueryId, destinationBranchId); + BranchCreationRequest branchCreationRequest = + new BranchCreationRequest(branchType, sourceTransactionId, parentBranchId, branchGuid, branchName, + associatedArtifactId, authorId, creationComment, mergeAddressingQueryId, destinationBranchId); + + branchCreationRequest.setTxIsCopied(isTxCopy); + + return branchCreationRequest; } @Override @@ -71,6 +79,7 @@ public class BranchCreationRequestTranslator implements ITranslator<BranchCreati store.put(Fields.MERGE_ADDRESSING_QUERY_ID.name(), object.getMergeAddressingQueryId()); store.put(Fields.MERGE_DESTINATION_BRANCH_ID.name(), object.getMergeDestinationBranchId()); + store.put(Fields.TX_COPY_BRANCH_TYPE.name(), object.txIsCopied()); return store; } 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 29b3d9809cd..93a9a0ace31 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 @@ -53,8 +53,11 @@ public class CreateBranchCallable extends AbstractBranchCallable<BranchCreationR createData.setMergeDestinationBranchId(request.getMergeDestinationBranchId()); createData.setMergeAddressingQueryId(request.getMergeAddressingQueryId()); + createData.setTxCopyBranchType(request.txIsCopied()); + Callable<ReadableBranch> callable; + + callable = getBranchOps().createBranch(createData); - Callable<ReadableBranch> callable = getBranchOps().createBranch(createData); ReadableBranch newBranch = callAndCheckForCancel(callable); BranchCreationResponse creationResponse = new BranchCreationResponse(-1); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java index 2edf30470c7..da867c3b28c 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/BranchManager.java @@ -366,6 +366,21 @@ public class BranchManager { /** * Creates a new Branch based on the most recent transaction on the parent branch. */ + public static Branch createWorkingBranchFromTx(TransactionRecord parentTransactionId, String childBranchName) throws OseeCoreException { + String creationComment = + String.format("New Branch created by copying prior tx and %s (%s)", parentTransactionId.getBranch().getName(), + parentTransactionId.getId()); + + final String truncatedName = Strings.truncate(childBranchName, 195, true); + + CreateBranchHttpRequestOperation operation = + new CreateBranchHttpRequestOperation(BranchType.WORKING, parentTransactionId, truncatedName, null, null, + creationComment, -1, -1); + operation.setTxCopyBranchType(true); + Operations.executeWorkAndCheckStatus(operation); + return operation.getNewBranch(); + } + public static Branch createWorkingBranch(IOseeBranch parentBranch, String childBranchName) throws OseeCoreException { return createWorkingBranch(parentBranch, childBranchName, UserManager.getUser(SystemUser.OseeSystem)); } diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/CreateBranchHttpRequestOperation.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/CreateBranchHttpRequestOperation.java index d424915a954..b23fc186a76 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/CreateBranchHttpRequestOperation.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/httpRequests/CreateBranchHttpRequestOperation.java @@ -48,6 +48,7 @@ public final class CreateBranchHttpRequestOperation extends AbstractOperation { private final int mergeAddressingQueryId; private final int destinationBranchId; private Branch newBranch; + private boolean txCopyBranchType; public CreateBranchHttpRequestOperation(BranchType branchType, TransactionRecord parentTransaction, String branchName, String branchGuid, Artifact associatedArtifact, String creationComment, int mergeAddressingQueryId, int destinationBranchId) { super("Create branch " + branchName, Activator.PLUGIN_ID); @@ -59,6 +60,7 @@ public final class CreateBranchHttpRequestOperation extends AbstractOperation { this.creationComment = creationComment; this.mergeAddressingQueryId = mergeAddressingQueryId; this.destinationBranchId = destinationBranchId; + this.txCopyBranchType = false; } @Override @@ -71,6 +73,8 @@ public final class CreateBranchHttpRequestOperation extends AbstractOperation { branchName, getAssociatedArtifactId(associatedArtifact), getAuthorId(), creationComment, mergeAddressingQueryId, destinationBranchId); + request.setTxIsCopied(isTxCopyBranchType()); + BranchCreationResponse response = HttpClientMessage.send(OseeServerContext.BRANCH_CONTEXT, parameters, CoreTranslatorId.BRANCH_CREATION_REQUEST, request, CoreTranslatorId.BRANCH_CREATION_RESPONSE); @@ -98,4 +102,12 @@ public final class CreateBranchHttpRequestOperation extends AbstractOperation { public Branch getNewBranch() { return newBranch; } + + public boolean isTxCopyBranchType() { + return txCopyBranchType; + } + + public void setTxCopyBranchType(boolean value) { + txCopyBranchType = value; + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/BranchCreationHandler.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/BranchCreationHandler.java index 4dc4c0ee441..0456c77f924 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/BranchCreationHandler.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/commandHandlers/branch/BranchCreationHandler.java @@ -31,7 +31,7 @@ import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; import org.eclipse.osee.framework.ui.plugin.util.AWorkbench; import org.eclipse.osee.framework.ui.plugin.util.CommandHandler; import org.eclipse.osee.framework.ui.skynet.internal.Activator; -import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryDialog; +import org.eclipse.osee.framework.ui.skynet.widgets.dialog.EntryCheckDialog; import org.eclipse.osee.framework.ui.swt.Displays; /** @@ -56,9 +56,11 @@ public class BranchCreationHandler extends CommandHandler { } else { throw new OseeStateException("Backing data for the jobbed node in the branchview was not of the expected type"); } - final EntryDialog dialog = - new EntryDialog(Displays.getActiveShell(), "Branch", null, "Enter the name of the new Branch:", - MessageDialog.INFORMATION, new String[] {"OK", "Cancel"}, 0); + final EntryCheckDialog dialog = + new EntryCheckDialog(Displays.getActiveShell(), "Branch", null, "Enter the name of the new branch:", + "Include a copy of the chosen transaction on the new branch", MessageDialog.INFORMATION, new String[] { + "OK", + "Cancel"}, 0); int result = dialog.open(); if (result == 0 && dialog.getEntry() != null) { @@ -70,7 +72,12 @@ public class BranchCreationHandler extends CommandHandler { if (branch.equals(CoreBranches.SYSTEM_ROOT)) { BranchManager.createTopLevelBranch(dialog.getEntry()); } else { - BranchManager.createWorkingBranch(parentTransactionId, dialog.getEntry(), null, null); + if (dialog.isChecked()) { + BranchManager.createWorkingBranchFromTx(parentTransactionId, dialog.getEntry()); + } else { + BranchManager.createWorkingBranch(parentTransactionId, dialog.getEntry(), null, null); + } + } return Status.OK_STATUS; } 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 3bf2af91e11..958026ec5c3 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 @@ -65,11 +65,6 @@ public class OrcsBranchImpl implements OrcsBranch { } @Override - public Callable<ReadableBranch> createBranchFromTx(CreateBranchData newBranchData) { - return new CreateBranchCallable(logger, sessionContext, branchStore, newBranchData); - } - - @Override public Callable<ReadableBranch> archiveUnarchiveBranch(IOseeBranch branch, ArchiveOperation archiveOp) { return new ArchiveUnarchiveBranchCallable(logger, sessionContext, branchStore, branchCache, branch, archiveOp); } 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 3c2276d9669..375407a69d2 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 @@ -40,7 +40,13 @@ public class CreateBranchCallable extends AbstractBranchCallable<ReadableBranch> ITransaction txData = branchData.getFromTransaction(); Conditions.checkNotNull(txData, "sourceTransaction"); - Callable<Branch> callable = getBranchStore().createBranch(getSessionContext().getSessionId(), branchData); + Callable<Branch> callable; + if (branchData.isTxCopyBranchType()) { + callable = getBranchStore().createBranchCopyTx(getSessionContext().getSessionId(), branchData); + } else { + callable = getBranchStore().createBranch(getSessionContext().getSessionId(), branchData); + } + return callAndCheckForCancel(callable); } } 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 c211d647bed..99adb29ac65 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 @@ -33,8 +33,6 @@ public interface OrcsBranch { Callable<ReadableBranch> createBranch(CreateBranchData branchData); - Callable<ReadableBranch> createBranchFromTx(CreateBranchData branchData); - Callable<ReadableBranch> archiveUnarchiveBranch(IOseeBranch branch, ArchiveOperation archiveOp); Callable<ReadableBranch> deleteBranch(IOseeBranch branch); 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 5975d2ad060..205310bdd19 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,8 @@ public class CreateBranchData implements Identifiable { private int mergeAddressingQueryId; private int mergeDestinationBranchId; + private boolean txCopyBranchType; + @Override public String getGuid() { return branchUuid; @@ -174,6 +176,14 @@ public class CreateBranchData implements Identifiable { return false; } + public boolean isTxCopyBranchType() { + return txCopyBranchType; + } + + public void setTxCopyBranchType(boolean value) { + txCopyBranchType = value; + } + @Override public String toString() { return "CreateBranchData [branchUuid=" + branchUuid + ", branchName=" + branchName + ", branchType=" + branchType + ", creationComment=" + creationComment + ", fromTransaction=" + fromTransaction + ", associatedArtifact=" + associatedArtifact + ", userArtifact=" + userArtifact + ", mergeAddressingQueryId=" + mergeAddressingQueryId + ", destinationBranchId=" + mergeDestinationBranchId + "]"; |