diff options
Diffstat (limited to 'plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/CreateBranchData.java')
-rw-r--r-- | plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/CreateBranchData.java | 44 |
1 files changed, 44 insertions, 0 deletions
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 abac3237b72..5975d2ad060 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 @@ -14,12 +14,19 @@ import org.eclipse.osee.framework.core.data.ITransaction; import org.eclipse.osee.framework.core.data.Identifiable; import org.eclipse.osee.framework.core.data.Identity; import org.eclipse.osee.framework.core.enums.BranchType; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.model.TransactionRecord; +import org.eclipse.osee.framework.core.model.cache.TransactionCache; /** * @author Roberto E. Escobar */ public class CreateBranchData implements Identifiable { + private static final int NULL_PARENT_BRANCH_ID = -1; + private static final int NULL_SOURCE_TRANSACTION_ID = -1; + private static final int NULL_ARTIFACT_ID = -1; + private String branchUuid; private String branchName; private BranchType branchType; @@ -37,6 +44,23 @@ public class CreateBranchData implements Identifiable { return branchUuid; } + public int getAssociatedArtifactId() { + + int result = NULL_ARTIFACT_ID; + if (associatedArtifact != null) { + result = associatedArtifact.getId(); + } + return result; + } + + public int getUserArtifactId() { + int result = NULL_ARTIFACT_ID; + if (userArtifact != null) { + result = userArtifact.getId(); + } + return result; + } + public void setGuid(String branchUuid) { this.branchUuid = branchUuid; } @@ -106,6 +130,26 @@ public class CreateBranchData implements Identifiable { this.mergeDestinationBranchId = destinationBranchId; } + public int getParentBranchId(TransactionCache txCache) throws OseeCoreException { + + int parentBranchId = NULL_PARENT_BRANCH_ID; + + if (BranchType.SYSTEM_ROOT != branchType) { + TransactionRecord sourceTx = txCache.getOrLoad(fromTransaction.getGuid()); + parentBranchId = sourceTx.getBranchId(); + } + return parentBranchId; + } + + public int getSourceTransactionId(TransactionCache txCache) throws OseeCoreException { + int sourceTransactionId = NULL_SOURCE_TRANSACTION_ID; + + if (BranchType.SYSTEM_ROOT != branchType) { + TransactionRecord sourceTx = txCache.getOrLoad(fromTransaction.getGuid()); + sourceTransactionId = sourceTx.getId(); + } + return sourceTransactionId; + } @Override public int hashCode() { |