diff options
Diffstat (limited to 'plugins/org.eclipse.osee.orcs.rest/src/org')
3 files changed, 12 insertions, 22 deletions
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchEndpointImpl.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchEndpointImpl.java index c445bd265a2..e56c21bf681 100644 --- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchEndpointImpl.java +++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/BranchEndpointImpl.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.osee.orcs.rest.internal; -import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON_ID; import static org.eclipse.osee.framework.jdk.core.util.Compare.isDifferent; import static org.eclipse.osee.orcs.rest.internal.OrcsRestUtil.asBranch; import static org.eclipse.osee.orcs.rest.internal.OrcsRestUtil.asBranches; @@ -37,6 +36,7 @@ import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriInfo; import org.eclipse.osee.activity.api.Activity; import org.eclipse.osee.activity.api.ActivityLog; +import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.core.data.TokenFactory; @@ -138,14 +138,6 @@ public class BranchEndpointImpl implements BranchEndpoint { return orcsApi.getBranchOps(); } - private ArtifactReadable getArtifactById(Long branchId, int id) { - ArtifactReadable artifact = null; - if (id > 0) { - artifact = newQuery().fromBranch(branchId).andUuid(id).getResults().getExactlyOne(); - } - return artifact; - } - private BranchReadable getBranchById(long branchUuid) { ResultSet<BranchReadable> results = newBranchQuery().andUuids(branchUuid)// .includeArchived()// @@ -299,8 +291,8 @@ public class BranchEndpointImpl implements BranchEndpoint { createData.setBranchType(data.getBranchType()); createData.setCreationComment(data.getCreationComment()); - createData.setUserArtifact(getArtifactById(COMMON_ID, data.getAuthorId())); - createData.setAssociatedArtifact(getArtifactById(COMMON_ID, data.getAssociatedArtifactId())); + createData.setAuthor(data.getAuthor()); + createData.setAssociatedArtifact(data.getAssociatedArtifact()); createData.setFromTransaction(data.getSourceTransaction()); createData.setParentBranch(data.getParentBranch()); @@ -358,8 +350,7 @@ public class BranchEndpointImpl implements BranchEndpoint { BranchReadable srcBranch = getBranchById(branchUuid); BranchReadable destBranch = getBranchById(destinationBranchUuid); - ArtifactReadable committer = getArtifactById(COMMON_ID, options.getCommitterId()); - Callable<TransactionToken> op = getBranchOps().commitBranch(committer, srcBranch, destBranch); + Callable<TransactionToken> op = getBranchOps().commitBranch(options.getCommitter(), srcBranch, destBranch); TransactionToken tx = executeCallable(op); if (options.isArchive()) { @@ -650,20 +641,19 @@ public class BranchEndpointImpl implements BranchEndpoint { } @Override - public Response associateBranchToArtifact(long branchUuid, int artifactId) { + public Response associateBranchToArtifact(long branchUuid, ArtifactId artifact) { BranchReadable branch = getBranchById(branchUuid); boolean modified = false; - if (isDifferent(branch.getAssociatedArtifactId(), artifactId)) { + if (isDifferent(branch.getAssociatedArtifact(), artifact)) { try { activityLog.createEntry(Activity.BRANCH_OPERATION, ActivityLog.INITIAL_STATUS, String.format( "Branch Operation Associate Branch to Artifact {branchUUID: %s prevArt: %s newArt: %s accountId: %s serverId: %s clientId: %s}", - branchUuid, branch.getAssociatedArtifactId(), artifactId, RestUtil.getAccountId(httpHeaders), + branchUuid, branch.getAssociatedArtifact(), artifact, RestUtil.getAccountId(httpHeaders), RestUtil.getServerId(httpHeaders), RestUtil.getClientId(httpHeaders))); } catch (OseeCoreException ex) { OseeLog.log(ActivityLog.class, OseeLevel.SEVERE_POPUP, ex); } - ArtifactReadable artifact = newQuery().fromBranch(COMMON_ID).andUuid(artifactId).getResults().getExactlyOne(); Callable<?> op = getBranchOps().associateBranchToArtifact(branch, artifact); executeCallable(op); modified = true; @@ -745,7 +735,7 @@ public class BranchEndpointImpl implements BranchEndpoint { public Response unassociateBranch(long branchUuid) { BranchReadable branch = getBranchById(branchUuid); boolean modified = false; - if (branch.getAssociatedArtifactId() != -1) { + if (branch.getAssociatedArtifact().isValid()) { Callable<?> op = getBranchOps().unassociateBranch(branch); executeCallable(op); modified = true; diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/HtmlWriter.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/HtmlWriter.java index 5787b23eb4e..fa9409209fc 100644 --- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/HtmlWriter.java +++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/HtmlWriter.java @@ -158,7 +158,7 @@ public class HtmlWriter { data.put("TxType", txRecord.getTxType()); data.put("Date", txRecord.getDate()); data.put("Comment", txRecord.getComment()); - data.put("Author", txRecord.getAuthorId()); + data.put("Author", txRecord.getAuthor()); IOseeBranch branch = getBranchFromId(txRecord.getBranch()); URI uri; diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsRestUtil.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsRestUtil.java index 797073da4bb..d7fe5ea1d2b 100644 --- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsRestUtil.java +++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsRestUtil.java @@ -70,7 +70,7 @@ public final class OrcsRestUtil { public static Branch asBranch(BranchReadable src) { Branch data = new Branch(); data.setArchiveState(src.getArchiveState()); - data.setAssociatedArtifactId(src.getAssociatedArtifactId()); + data.setAssociatedArtifact(src.getAssociatedArtifact()); data.setBaseTransactionId(src.getBaseTransaction()); data.setBranchState(src.getBranchState()); data.setBranchType(src.getBranchType()); @@ -85,10 +85,10 @@ public final class OrcsRestUtil { public static Transaction asTransaction(TransactionReadable tx) { Transaction data = new Transaction(); data.setTxId(tx); - data.setAuthorId(tx.getAuthorId()); + data.setAuthor(tx.getAuthor()); data.setBranchUuid(tx.getBranchId()); data.setComment(tx.getComment()); - data.setCommitArtId(tx.getCommit()); + data.setCommitArt(tx.getCommitArt()); data.setTimeStamp(tx.getDate()); data.setTxType(tx.getTxType()); return data; |