Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormegumi.telles2018-03-26 21:11:16 +0000
committermegumi.telles2018-03-27 13:28:52 +0000
commitb95b1ff6aa17a817deb166779cca8ce762c06dbd (patch)
treee053290913d854ab764df7cfaa47912886f7ace1
parentfa57a96e5dd4f04970d798d27fb45c6f1f6b7a5e (diff)
downloadorg.eclipse.osee-b95b1ff6aa17a817deb166779cca8ce762c06dbd.tar.gz
org.eclipse.osee-b95b1ff6aa17a817deb166779cca8ce762c06dbd.tar.xz
org.eclipse.osee-b95b1ff6aa17a817deb166779cca8ce762c06dbd.zip
refinement: Tune CI rest calls
-rw-r--r--plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/CiItemData.java23
-rw-r--r--plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/CiSetData.java46
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApi.java5
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoApiImpl.java7
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoQuery.java5
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java25
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/ContinuousIntegrationResource.java57
7 files changed, 113 insertions, 55 deletions
diff --git a/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/CiItemData.java b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/CiItemData.java
index b4e558a2e38..8346a28a7b2 100644
--- a/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/CiItemData.java
+++ b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/CiItemData.java
@@ -1,8 +1,13 @@
-/*
- * Created on Mar 22, 2018
+/*******************************************************************************
+ * Copyright (c) 2018 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
*
- * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
- */
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
package org.eclipse.osee.disposition.model;
import java.util.List;
@@ -12,8 +17,8 @@ import org.eclipse.osee.framework.jdk.core.type.Identifiable;
@XmlRootElement(name = "CiItemData")
public class CiItemData implements Identifiable<String> {
+ private CiSetData setData;
private String scriptName;
- private String ciSet;
private CiTestPoint testPoints;
private List<DispoAnnotationData> annotations;
@@ -46,12 +51,12 @@ public class CiItemData implements Identifiable<String> {
this.annotations = annotations;
}
- public String getCiSet() {
- return ciSet;
+ public CiSetData getSetData() {
+ return setData;
}
- public void setCiSet(String ciSet) {
- this.ciSet = ciSet;
+ public void setSetData(CiSetData setData) {
+ this.setData = setData;
}
}
diff --git a/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/CiSetData.java b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/CiSetData.java
new file mode 100644
index 00000000000..1acf4a247f5
--- /dev/null
+++ b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/CiSetData.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2018 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.disposition.model;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "CiSetData")
+public class CiSetData {
+
+ private String ciSetName;
+ private String dispoSetId;
+ private String branchId;
+
+ public String getCiSetName() {
+ return ciSetName;
+ }
+
+ public void setCiSetName(String setName) {
+ this.ciSetName = setName;
+ }
+
+ public String getDispoSetId() {
+ return dispoSetId;
+ }
+
+ public void setDispoSetId(String dispoSetId) {
+ this.dispoSetId = dispoSetId;
+ }
+
+ public String getBranchId() {
+ return branchId;
+ }
+
+ public void setBranchId(String branchId) {
+ this.branchId = branchId;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApi.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApi.java
index 3251f781ecc..f1095bcb89e 100644
--- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApi.java
+++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApi.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.disposition.rest;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
+import org.eclipse.osee.disposition.model.CiSetData;
import org.eclipse.osee.disposition.model.CopySetParams;
import org.eclipse.osee.disposition.model.DispoAnnotationData;
import org.eclipse.osee.disposition.model.DispoConfig;
@@ -90,9 +91,9 @@ public interface DispoApi {
DispoApiConfiguration getConfig();
// CI
- HashMap<ArtifactReadable, BranchId> getCiSet(String branchId, String ciSet);
+ HashMap<ArtifactReadable, BranchId> getCiSet(CiSetData setData);
String getDispoItemId(BranchId branch, String setId, String item);
- HashMap<String, String> getAllCiSets();
+ List<CiSetData> getAllCiSets();
}
diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoApiImpl.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoApiImpl.java
index f0b0aa0373f..a259e35a591 100644
--- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoApiImpl.java
+++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoApiImpl.java
@@ -21,6 +21,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import org.eclipse.osee.disposition.model.CiSetData;
import org.eclipse.osee.disposition.model.CopySetParams;
import org.eclipse.osee.disposition.model.Discrepancy;
import org.eclipse.osee.disposition.model.DispoAnnotationData;
@@ -678,8 +679,8 @@ public class DispoApiImpl implements DispoApi {
}
@Override
- public HashMap<ArtifactReadable, BranchId> getCiSet(String branchId, String ciSet) {
- return getQuery().getCiSet(branchId, ciSet);
+ public HashMap<ArtifactReadable, BranchId> getCiSet(CiSetData setData) {
+ return getQuery().getCiSet(setData);
}
@Override
@@ -688,7 +689,7 @@ public class DispoApiImpl implements DispoApi {
}
@Override
- public HashMap<String, String> getAllCiSets() {
+ public List<CiSetData> getAllCiSets() {
return getQuery().getAllCiSets();
}
diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoQuery.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoQuery.java
index 82194962e2c..e74290a9a46 100644
--- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoQuery.java
+++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoQuery.java
@@ -14,6 +14,7 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.eclipse.osee.disposition.model.CiSetData;
import org.eclipse.osee.disposition.model.DispoConfig;
import org.eclipse.osee.disposition.model.DispoItem;
import org.eclipse.osee.disposition.model.DispoSet;
@@ -56,9 +57,9 @@ public interface DispoQuery {
Long getDispoItemParentSet(BranchId branch, String itemId);
- HashMap<ArtifactReadable, BranchId> getCiSet(String branchId, String ciSet);
+ HashMap<ArtifactReadable, BranchId> getCiSet(CiSetData setData);
- HashMap<String, String> getAllCiSets();
+ List<CiSetData> getAllCiSets();
String getDispoItemId(BranchId branch, String setId, String item);
diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java
index bfc6dc4188f..f5099213fd5 100644
--- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java
+++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java
@@ -15,7 +15,6 @@ import static org.eclipse.osee.framework.core.enums.CoreAttributeTypes.UriGenera
import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON;
import java.io.InputStream;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
@@ -23,6 +22,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.eclipse.osee.disposition.model.CiSetData;
import org.eclipse.osee.disposition.model.DispoConfig;
import org.eclipse.osee.disposition.model.DispoItem;
import org.eclipse.osee.disposition.model.DispoSet;
@@ -598,10 +598,10 @@ public class OrcsStorageImpl implements Storage {
}
@Override
- public HashMap<ArtifactReadable, BranchId> getCiSet(String branchId, String ciSet) {
+ public HashMap<ArtifactReadable, BranchId> getCiSet(CiSetData setData) {
HashMap<ArtifactReadable, BranchId> set = new HashMap<>();
- BranchId branch = BranchId.valueOf(branchId);
- List<ArtifactReadable> arts = findDispoSet(ciSet, branch);
+ BranchId branch = BranchId.valueOf(setData.getBranchId());
+ List<ArtifactReadable> arts = findDispoSet(branch, ArtifactId.valueOf(setData.getDispoSetId()));
for (ArtifactReadable art : arts) {
set.put(art, branch);
}
@@ -621,23 +621,26 @@ public class OrcsStorageImpl implements Storage {
}
@Override
- public HashMap<String, String> getAllCiSets() {
- HashMap<String, String> set = new HashMap<>();
+ public List<CiSetData> getAllCiSets() {
+ List<CiSetData> setData = new ArrayList<>();
List<BranchReadable> dispoBranches = findDispoBranches();
for (BranchReadable branch : dispoBranches) {
for (ArtifactReadable dispoSet : findAllCiSets(branch)) {
String ciSet = dispoSet.getSoleAttributeValue(DispoConstants.DispoCiSet, "");
if (!ciSet.isEmpty()) {
- set.put(ciSet, branch.getIdString());
+ CiSetData set = new CiSetData();
+ set.setBranchId(branch.getIdString());
+ set.setDispoSetId(dispoSet.getIdString());
+ set.setCiSetName(ciSet);
+ setData.add(set);
}
}
}
- return set;
+ return setData;
}
- private List<ArtifactReadable> findDispoSet(String ciSet, BranchId branch) {
- return getQuery().fromBranch(branch).andIsOfType(DispoConstants.DispoSet).and(DispoConstants.DispoCiSet,
- Arrays.asList(ciSet)).getResults().getList();
+ private List<ArtifactReadable> findDispoSet(BranchId branch, ArtifactId setId) {
+ return getQuery().fromBranch(branch).andId(setId).getResults().getList();
}
private List<BranchReadable> findDispoBranches() {
diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/ContinuousIntegrationResource.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/ContinuousIntegrationResource.java
index fb82876c41f..ac7d74cdc03 100644
--- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/ContinuousIntegrationResource.java
+++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/ContinuousIntegrationResource.java
@@ -22,11 +22,11 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.eclipse.osee.disposition.model.CiItemData;
+import org.eclipse.osee.disposition.model.CiSetData;
import org.eclipse.osee.disposition.model.DispoAnnotationData;
import org.eclipse.osee.disposition.model.DispoItem;
import org.eclipse.osee.disposition.rest.DispoApi;
import org.eclipse.osee.framework.core.data.BranchId;
-import org.eclipse.osee.orcs.data.ArtifactReadable;
/**
* @author Megumi Telles
@@ -39,15 +39,15 @@ public class ContinuousIntegrationResource {
this.dispoApi = dispoApi;
}
- @GET
- @Path("branchId/{branchId}/ciSet/{ciSet}/annotations")
+ @Path("annotations")
+ @POST
+ @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- public HashMap<String, List<DispoAnnotationData>> getAllDispoAnnotations(@PathParam("branchId") String branchId, @PathParam("ciSet") String ciSet) {
- HashMap<ArtifactReadable, BranchId> set = dispoApi.getCiSet(branchId, ciSet);
+ public HashMap<String, List<DispoAnnotationData>> getAllDispoAnnotations(CiSetData setData) {
HashMap<String, List<DispoAnnotationData>> allDispoAnnotations = new HashMap<>();
- if (set != null && !set.isEmpty()) {
- ArtifactReadable dispoSet = set.keySet().iterator().next();
- List<DispoItem> dispoItems = dispoApi.getDispoItems(set.get(dispoSet), dispoSet.getIdString(), false);
+ if (setData != null) {
+ List<DispoItem> dispoItems =
+ dispoApi.getDispoItems(BranchId.valueOf(setData.getBranchId()), setData.getDispoSetId(), false);
for (DispoItem item : dispoItems) {
allDispoAnnotations.put(item.getName(), item.getAnnotationsList());
}
@@ -55,16 +55,17 @@ public class ContinuousIntegrationResource {
return allDispoAnnotations;
}
- @GET
- @Path("branchId/{branchId}/ciSet/{ciSet}/item/{item}/annotation")
+ @Path("{item}/annotation")
+ @POST
+ @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- public List<DispoAnnotationData> getAllDispoAnnotationsPerItem(@PathParam("branchId") String branchId, @PathParam("ciSet") String ciSet, @PathParam("item") String item) {
- HashMap<ArtifactReadable, BranchId> set = dispoApi.getCiSet(branchId, ciSet);
- if (set != null && !set.isEmpty()) {
- ArtifactReadable dispoSet = set.keySet().iterator().next();
- BranchId branch = set.get(dispoSet);
- String itemId = dispoApi.getDispoItemId(branch, dispoSet.getIdString(), item);
- return dispoApi.getDispoAnnotations(branch, itemId);
+ public List<DispoAnnotationData> getAllDispoAnnotationsPerItem(CiSetData setData, @PathParam("item") String item) {
+ if (setData != null) {
+ BranchId branch = BranchId.valueOf(setData.getBranchId());
+ String itemId = dispoApi.getDispoItemId(branch, setData.getDispoSetId(), item);
+ if (itemId != null && !itemId.isEmpty()) {
+ return dispoApi.getDispoAnnotations(branch, itemId);
+ }
}
return null;
}
@@ -72,22 +73,22 @@ public class ContinuousIntegrationResource {
@GET
@Path("sets")
@Produces(MediaType.APPLICATION_JSON)
- public HashMap<String, String> getAllCiSets() {
+ public List<CiSetData> getAllCiSets() {
return dispoApi.getAllCiSets();
}
- @Path("{branchId}/annotate")
+ @Path("annotate")
@POST
@Consumes(MediaType.APPLICATION_JSON)
- public Response createDispoAnnotation(@PathParam("branchId") String branchId, CiItemData data, @QueryParam("userName") String userName) {
- Response response = null;
- HashMap<ArtifactReadable, BranchId> set = dispoApi.getCiSet(branchId, data.getCiSet());
- if (set != null && !set.isEmpty()) {
- ArtifactReadable dispoSet = set.keySet().iterator().next();
- BranchId branch = set.get(dispoSet);
- String itemId = dispoApi.getDispoItemId(branch, dispoSet.getIdString(), data.getScriptName());
- dispoApi.deleteAllDispoAnnotation(branch, itemId, userName, true);
- response = createAndUpdateAnnotation(data, userName, response, branch, itemId);
+ public Response createDispoAnnotation(CiItemData data, @QueryParam("userName") String userName) {
+ Response response = Response.status(Response.Status.NOT_FOUND).build();
+ if (data != null) {
+ BranchId branch = BranchId.valueOf(data.getSetData().getBranchId());
+ String itemId = dispoApi.getDispoItemId(branch, data.getSetData().getDispoSetId(), data.getScriptName());
+ if (itemId != null && !itemId.isEmpty()) {
+ dispoApi.deleteAllDispoAnnotation(branch, itemId, userName, true);
+ response = createAndUpdateAnnotation(data, userName, response, branch, itemId);
+ }
} else {
response = Response.status(Response.Status.BAD_REQUEST).build();
}

Back to the top