Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngel Avila2015-03-19 21:35:45 +0000
committerAngel Avila2015-03-19 21:35:45 +0000
commit31e9dfa097245373b0d094666c99eeb3e2f2a1e5 (patch)
tree997ec938fb350c2eefd1424b4476eeaf703f2201 /plugins/org.eclipse.osee.orcs.rest.model
parent16d6f7ef8479b053a3df4b0f66411306e86d5f7e (diff)
downloadorg.eclipse.osee-31e9dfa097245373b0d094666c99eeb3e2f2a1e5.tar.gz
org.eclipse.osee-31e9dfa097245373b0d094666c99eeb3e2f2a1e5.tar.xz
org.eclipse.osee-31e9dfa097245373b0d094666c99eeb3e2f2a1e5.zip
feature[ats_4LWQB]: Implement ORCS Branch JAX-RS API
Change-Id: Ibf2953218199d48bd5dd31931af73eaad221eee0 Signed-off-by: Angel Avila <angel.avila2@boeing.com>
Diffstat (limited to 'plugins/org.eclipse.osee.orcs.rest.model')
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/META-INF/MANIFEST.MF7
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/Branch.java130
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/BranchCommitOptions.java42
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/BranchEndpoint.java117
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/CompareResults.java39
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/NewBranch.java123
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/Transaction.java42
7 files changed, 469 insertions, 31 deletions
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.rest.model/META-INF/MANIFEST.MF
index a4c7e6d6184..bb1613a7fec 100644
--- a/plugins/org.eclipse.osee.orcs.rest.model/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs.rest.model/META-INF/MANIFEST.MF
@@ -8,9 +8,14 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.eclipse.osee.orcs.rest.model,
org.eclipse.osee.orcs.rest.model.search.artifact,
org.eclipse.osee.orcs.rest.model.search.branch
-Import-Package: javax.xml.bind.annotation,
+Import-Package: javax.annotation.security;version="1.2.0",
+ javax.ws.rs;version="2.0.0",
+ javax.ws.rs.core;version="2.0.0",
+ javax.xml.bind.annotation,
+ org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.exception,
+ org.eclipse.osee.framework.core.model.change,
org.eclipse.osee.framework.core.util,
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.framework.jdk.core.util
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/Branch.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/Branch.java
index 92ab72b0861..a1fe15534a6 100644
--- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/Branch.java
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/Branch.java
@@ -21,40 +21,138 @@ import org.eclipse.osee.framework.core.enums.BranchType;
@XmlRootElement
public class Branch {
- private String uuid;
+ private static final int DEFAULT_INT = -1;
+
+ private long branchUuid;
private String name;
- private BranchType branchType;
- private BranchState branchState;
- private BranchArchivedState branchArchivedState;
- private Transaction baseTransaction;
- private Transaction sourceTransaction;
+ private long parentBranchUuid;
+
+ private int associatedArtifactId = DEFAULT_INT;
+ private int baseTransaction = DEFAULT_INT;
+ private int sourceTransaction = DEFAULT_INT;
+
+ private BranchArchivedState archiveState = BranchArchivedState.UNARCHIVED;
+ private BranchState branchState = BranchState.CREATED;
+ private BranchType branchType = BranchType.WORKING;
+ private boolean inheritAccessControl = false;
+
+ public Branch() {
+ super();
+ }
+
+ public long getBranchUuid() {
+ return branchUuid;
+ }
- public String getId() {
- return uuid;
+ public void setBranchUuid(long branchUuid) {
+ this.branchUuid = branchUuid;
}
public String getName() {
return name;
}
- public BranchType getBranchType() {
- return branchType;
+ public void setName(String name) {
+ this.name = name;
}
- public BranchState getBranchState() {
- return branchState;
+ public int getAssociatedArtifactId() {
+ return associatedArtifactId;
}
- public BranchArchivedState getArchiveState() {
- return branchArchivedState;
+ public void setAssociatedArtifactId(int artId) {
+ associatedArtifactId = artId;
}
- public Transaction getBaseTransaction() {
+ public int getBaseTransactionId() {
return baseTransaction;
}
- public Transaction getSourceTransaction() {
+ public void setBaseTransactionId(int baseTx) {
+ baseTransaction = baseTx;
+ }
+
+ public int getSourceTransactionId() {
return sourceTransaction;
}
+ public void setSourceTransactionId(int sourceTx) {
+ sourceTransaction = sourceTx;
+ }
+
+ public long getParentBranchUuid() {
+ return parentBranchUuid;
+ }
+
+ public void setParentBranchUuid(long parentBranchUuid) {
+ this.parentBranchUuid = parentBranchUuid;
+ }
+
+ public boolean hasParentBranchUuid() {
+ return getParentBranchUuid() > 0;
+ }
+
+ public BranchArchivedState getArchiveState() {
+ return archiveState;
+ }
+
+ public void setArchiveState(BranchArchivedState state) {
+ this.archiveState = state;
+ }
+
+ public BranchState getBranchState() {
+ return branchState;
+ }
+
+ public void setBranchState(BranchState state) {
+ this.branchState = state;
+ }
+
+ public BranchType getBranchType() {
+ return branchType;
+ }
+
+ public void setBranchType(BranchType type) {
+ branchType = type;
+ }
+
+ public boolean isInheritAccessControl() {
+ return inheritAccessControl;
+ }
+
+ public void setInheritAccessControl(boolean inheritAccessControl) {
+ this.inheritAccessControl = inheritAccessControl;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (branchUuid ^ (branchUuid >>> 32));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Branch other = (Branch) obj;
+ if (branchUuid != other.branchUuid) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "Branch [branchUuid=" + getBranchUuid() + ", name=" + name + ", parentBranchUuid=" + getParentBranchUuid() + ", associatedArtifactId=" + associatedArtifactId + ", baseTransaction=" + baseTransaction + ", sourceTransaction=" + sourceTransaction + ", archiveState=" + archiveState + ", branchState=" + branchState + ", branchType=" + branchType + ", inheritAccessControl=" + inheritAccessControl + "]";
+ }
+
}
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/BranchCommitOptions.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/BranchCommitOptions.java
new file mode 100644
index 00000000000..e52653ec648
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/BranchCommitOptions.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.orcs.rest.model;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author Roberto E. Escobar
+ */
+@XmlRootElement
+public class BranchCommitOptions {
+
+ private static final int DEFAULT_COMMITTER_ID = -1;
+
+ private int committerId = DEFAULT_COMMITTER_ID;
+ private boolean archive;
+
+ public int getCommitterId() {
+ return committerId;
+ }
+
+ public void setCommitterId(int committerId) {
+ this.committerId = committerId;
+ }
+
+ public boolean isArchive() {
+ return archive;
+ }
+
+ public void setArchive(boolean archive) {
+ this.archive = archive;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/BranchEndpoint.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/BranchEndpoint.java
new file mode 100644
index 00000000000..a48e3a4fbb0
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/BranchEndpoint.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.orcs.rest.model;
+
+import java.util.List;
+import javax.annotation.security.RolesAllowed;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.eclipse.osee.framework.core.enums.BranchState;
+import org.eclipse.osee.framework.core.enums.BranchType;
+import org.eclipse.osee.framework.jdk.core.type.SystemRoles;
+
+/**
+ * @author Roberto E. Escobar
+ */
+@Path("branches")
+@RolesAllowed(SystemRoles.ROLES_AUTHENTICATED)
+public interface BranchEndpoint {
+
+ @GET
+ @Produces({MediaType.APPLICATION_JSON})
+ List<Branch> getBranches();
+
+ @GET
+ @Path("baseline")
+ @Produces(MediaType.APPLICATION_JSON)
+ List<Branch> getBaselineBranches();
+
+ @GET
+ @Path("working")
+ @Produces(MediaType.APPLICATION_JSON)
+ List<Branch> getWorkingBranches();
+
+ @GET
+ @Path("{branch-uuid}")
+ @Produces({MediaType.APPLICATION_JSON})
+ Branch getBranch(@PathParam("branch-uuid") long branchUuid);
+
+ @GET
+ @Path("{branch-uuid}/diff/{branch-uuid2}")
+ @Produces({MediaType.APPLICATION_JSON})
+ CompareResults compareBranches(@PathParam("branch-uuid") long branchUuid, @PathParam("branch-uuid2") long branchUuid2);
+
+ @POST
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ Response createBranch(NewBranch data);
+
+ @POST
+ @Path("{branch-uuid}")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ Response createBranchWithId(@PathParam("branch-uuid") long branchUuid, NewBranch data);
+
+ @POST
+ @Path("{branch-uuid}/commit/{destination-branch-uuid}")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ Response commitBranch(@PathParam("branch-uuid") long branchUuid, @PathParam("destination-branch-uuid") long destinationBranchUuid, BranchCommitOptions options);
+
+ @POST
+ @Path("{branch-uuid}/archive")
+ Response archiveBranch(@PathParam("branch-uuid") long branchUuid);
+
+ @PUT
+ @Path("{branch-uuid}/name/{branch-name}")
+ Response setBranchName(@PathParam("branch-uuid") long branchUuid, @PathParam("branch-name") String newName);
+
+ @PUT
+ @Path("{branch-uuid}/type/{branch-type}")
+ Response setBranchType(@PathParam("branch-uuid") long branchUuid, @PathParam("branch-type") BranchType newType);
+
+ @PUT
+ @Path("{branch-uuid}/state/{branch-state}")
+ Response setBranchState(@PathParam("branch-uuid") long branchUuid, @PathParam("branch-state") BranchState newState);
+
+ @PUT
+ @Path("{branch-uuid}/associated-artifact/{art-id}")
+ Response associateBranchToArtifact(@PathParam("branch-uuid") long branchUuid, @PathParam("art-id") int artifactId);
+
+ @DELETE
+ @Path("{branch-uuid}")
+ Response purgeBranch(@PathParam("branch-uuid") long branchUuid, @DefaultValue("false") @QueryParam("recurse") boolean recurse);
+
+ @DELETE
+ @Path("{branch-uuid}/associated-artifact")
+ Response unassociateBranch(@PathParam("branch-uuid") long branchUuid);
+
+ @DELETE
+ @Path("{branch-uuid}/commit/{destination-branch-uuid}")
+ @Produces({MediaType.APPLICATION_JSON})
+ Response unCommitBranch(@PathParam("branch-uuid") long branchUuid, @PathParam("destination-branch-uuid") long destinationBranchUuid);
+
+ @DELETE
+ @Path("{branch-uuid}/archive")
+ @Produces({MediaType.APPLICATION_JSON})
+ Response unarchiveBranch(@PathParam("branch-uuid") long branchUuid);
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/CompareResults.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/CompareResults.java
new file mode 100644
index 00000000000..35cf58e6494
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/CompareResults.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.orcs.rest.model;
+
+import java.util.Collections;
+import java.util.List;
+import javax.xml.bind.annotation.XmlRootElement;
+import org.eclipse.osee.framework.core.model.change.ChangeItem;
+
+/**
+ * @author Roberto E. Escobar
+ */
+@XmlRootElement
+public class CompareResults {
+
+ private List<ChangeItem> changes;
+
+ public List<ChangeItem> getChanges() {
+ return changes != null ? changes : Collections.<ChangeItem> emptyList();
+ }
+
+ public void setChanges(List<ChangeItem> changes) {
+ this.changes = changes;
+ }
+
+ @Override
+ public String toString() {
+ return "CompareResults [changes=" + changes + "]";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/NewBranch.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/NewBranch.java
new file mode 100644
index 00000000000..321b4a9978d
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/NewBranch.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.orcs.rest.model;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import org.eclipse.osee.framework.core.enums.BranchType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+@XmlRootElement
+public class NewBranch {
+
+ private String branchName;
+ private long parentBranchId;
+ private int associatedArtifactId;
+ private BranchType branchType;
+
+ private int authorId;
+ private int sourceTransactionId;
+ private String creationComment;
+ private int mergeAddressingQueryId;
+ private long mergeDestinationBranchId;
+ private boolean txCopyBranchType;
+
+ public NewBranch() {
+ super();
+ }
+
+ public String getBranchName() {
+ return branchName;
+ }
+
+ public long getParentBranchId() {
+ return parentBranchId;
+ }
+
+ public int getAssociatedArtifactId() {
+ return associatedArtifactId;
+ }
+
+ public BranchType getBranchType() {
+ return branchType;
+ }
+
+ public int getAuthorId() {
+ return authorId;
+ }
+
+ public int getSourceTransactionId() {
+ return sourceTransactionId;
+ }
+
+ public String getCreationComment() {
+ return creationComment;
+ }
+
+ public int getMergeAddressingQueryId() {
+ return mergeAddressingQueryId;
+ }
+
+ public long getMergeDestinationBranchId() {
+ return mergeDestinationBranchId;
+ }
+
+ public boolean isTxCopyBranchType() {
+ return txCopyBranchType;
+ }
+
+ public void setBranchName(String branchName) {
+ this.branchName = branchName;
+ }
+
+ public void setParentBranchId(long parentBranchId) {
+ this.parentBranchId = parentBranchId;
+ }
+
+ public void setAssociatedArtifactId(int associatedArtifactId) {
+ this.associatedArtifactId = associatedArtifactId;
+ }
+
+ public void setBranchType(BranchType branchType) {
+ this.branchType = branchType;
+ }
+
+ public void setAuthorId(int authorId) {
+ this.authorId = authorId;
+ }
+
+ public void setSourceTransactionId(int sourceTransactionId) {
+ this.sourceTransactionId = sourceTransactionId;
+ }
+
+ public void setCreationComment(String creationComment) {
+ this.creationComment = creationComment;
+ }
+
+ public void setMergeAddressingQueryId(int mergeAddressingQueryId) {
+ this.mergeAddressingQueryId = mergeAddressingQueryId;
+ }
+
+ public void setMergeDestinationBranchId(long mergeDestinationBranchId) {
+ this.mergeDestinationBranchId = mergeDestinationBranchId;
+ }
+
+ public void setTxCopyBranchType(boolean txCopyBranchType) {
+ this.txCopyBranchType = txCopyBranchType;
+ }
+
+ @Override
+ public String toString() {
+ return "NewBranch [branchName=" + branchName + ", parentBranchId=" + parentBranchId + ", associatedArtifactId=" + associatedArtifactId + ", branchType=" + branchType + ", authorId=" + authorId + ", sourceTransactionId=" + sourceTransactionId + ", creationComment=" + creationComment + ", mergeAddressingQueryId=" + mergeAddressingQueryId + ", mergeDestinationBranchId=" + mergeDestinationBranchId + ", txCopyBranchType=" + txCopyBranchType + "]";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/Transaction.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/Transaction.java
index 7ddae90abe6..2a26a9822cf 100644
--- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/Transaction.java
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/Transaction.java
@@ -20,13 +20,22 @@ import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
@XmlRootElement
public class Transaction {
- private String branchUuid;
+ private int txId = -1;
+ private long branchUuid;
private TransactionDetailsType txType;
private String comment;
- private Date time;
- private int authorArtId;
+ private Date timestamp;
+ private int authorId;
private int commitArtId;
+ public int getTxId() {
+ return txId;
+ }
+
+ public void setTxId(int txId) {
+ this.txId = txId;
+ }
+
public TransactionDetailsType getTxType() {
return txType;
}
@@ -35,11 +44,11 @@ public class Transaction {
this.txType = txType;
}
- public String getBranchId() {
+ public long getBranchUuid() {
return branchUuid;
}
- public void setBranchId(String branchUuid) {
+ public void setBranchUuid(long branchUuid) {
this.branchUuid = branchUuid;
}
@@ -52,27 +61,32 @@ public class Transaction {
}
public Date getTimeStamp() {
- return time;
+ return timestamp;
}
- public void setTimeStamp(Date time) {
- this.time = time;
+ public void setTimeStamp(Date timestamp) {
+ this.timestamp = timestamp;
}
- public int getAuthor() {
- return authorArtId;
+ public int getAuthorId() {
+ return authorId;
}
- public void setAuthor(int authorArtId) {
- this.authorArtId = authorArtId;
+ public void setAuthorId(int authorId) {
+ this.authorId = authorId;
}
- public int getCommit() {
+ public int getCommitArtId() {
return commitArtId;
}
- public void setCommit(int commitArtId) {
+ public void setCommitArtId(int commitArtId) {
this.commitArtId = commitArtId;
}
+ @Override
+ public String toString() {
+ return "Transaction [txId=" + getTxId() + ", branchUuid=" + branchUuid + ", txType=" + txType + ", comment=" + comment + ", timestamp=" + timestamp + ", authorArtId=" + authorId + ", commitArtId=" + commitArtId + "]";
+ }
+
}

Back to the top