Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormegumi.telles2018-03-26 16:43:44 +0000
committermegumi.telles2018-03-26 18:06:10 +0000
commitfa57a96e5dd4f04970d798d27fb45c6f1f6b7a5e (patch)
tree7c0fa4e42e6590d5dddcd3152edbbf7ffda98c7e
parentb0c708f89b431c3a98a84b4ca475520f9a40931e (diff)
downloadorg.eclipse.osee-fa57a96e5dd4f04970d798d27fb45c6f1f6b7a5e.tar.gz
org.eclipse.osee-fa57a96e5dd4f04970d798d27fb45c6f1f6b7a5e.tar.xz
org.eclipse.osee-fa57a96e5dd4f04970d798d27fb45c6f1f6b7a5e.zip
refinement: Adjust CI rest calls to include branchId
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApi.java4
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoApiImpl.java12
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoQuery.java4
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java52
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/ContinuousIntegrationResource.java38
5 files changed, 64 insertions, 46 deletions
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 e93b3dc54a0..3251f781ecc 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
@@ -90,9 +90,9 @@ public interface DispoApi {
DispoApiConfiguration getConfig();
// CI
- HashMap<ArtifactReadable, BranchId> getCiSet(String ciSet);
+ HashMap<ArtifactReadable, BranchId> getCiSet(String branchId, String ciSet);
String getDispoItemId(BranchId branch, String setId, String item);
- BranchId getCiSetConfigured(String ciSet);
+ HashMap<String, String> 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 772c0352dbc..f0b0aa0373f 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
@@ -678,8 +678,8 @@ public class DispoApiImpl implements DispoApi {
}
@Override
- public HashMap<ArtifactReadable, BranchId> getCiSet(String ciSet) {
- return getQuery().getCiSet(ciSet);
+ public HashMap<ArtifactReadable, BranchId> getCiSet(String branchId, String ciSet) {
+ return getQuery().getCiSet(branchId, ciSet);
}
@Override
@@ -688,12 +688,8 @@ public class DispoApiImpl implements DispoApi {
}
@Override
- public BranchId getCiSetConfigured(String ciSet) {
- HashMap<ArtifactReadable, BranchId> set = getCiSet(ciSet);
- if (!set.isEmpty()) {
- return set.values().iterator().next();
- }
- return BranchId.SENTINEL;
+ public HashMap<String, String> 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 1293ebddd4e..82194962e2c 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
@@ -56,7 +56,9 @@ public interface DispoQuery {
Long getDispoItemParentSet(BranchId branch, String itemId);
- HashMap<ArtifactReadable, BranchId> getCiSet(String ciSet);
+ HashMap<ArtifactReadable, BranchId> getCiSet(String branchId, String ciSet);
+
+ HashMap<String, String> 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 49e953631af..bfc6dc4188f 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
@@ -598,27 +598,16 @@ public class OrcsStorageImpl implements Storage {
}
@Override
- public HashMap<ArtifactReadable, BranchId> getCiSet(String ciSet) {
+ public HashMap<ArtifactReadable, BranchId> getCiSet(String branchId, String ciSet) {
HashMap<ArtifactReadable, BranchId> set = new HashMap<>();
- List<BranchReadable> dispoBranches = findDispoBranches();
- QueryFactory query = getQuery();
- for (BranchReadable branch : dispoBranches) {
- List<ArtifactReadable> arts =
- query.fromBranch(branch).andIsOfType(DispoConstants.DispoSet).and(DispoConstants.DispoCiSet,
- Arrays.asList(ciSet)).getResults().getList();
- for (ArtifactReadable art : arts) {
- set.put(art, branch);
- }
+ BranchId branch = BranchId.valueOf(branchId);
+ List<ArtifactReadable> arts = findDispoSet(ciSet, branch);
+ for (ArtifactReadable art : arts) {
+ set.put(art, branch);
}
return set;
}
- private List<BranchReadable> findDispoBranches() {
- BranchReadable dispoParent = getQuery().branchQuery().andNameEquals("Dispo Parent").getResults().getOneOrNull();
- return getQuery().branchQuery().andIsChildOf(
- dispoParent).excludeArchived().excludeDeleted().getResults().getList();
- }
-
@Override
public String getDispoItemId(BranchId branch, String setId, String item) {
ArtifactReadable DispoSet =
@@ -631,4 +620,35 @@ public class OrcsStorageImpl implements Storage {
return "";
}
+ @Override
+ public HashMap<String, String> getAllCiSets() {
+ HashMap<String, String> set = new HashMap<>();
+ 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());
+ }
+ }
+ }
+ return set;
+ }
+
+ 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<BranchReadable> findDispoBranches() {
+ BranchReadable dispoParent = getQuery().branchQuery().andNameEquals("Dispo Parent").getResults().getOneOrNull();
+ return getQuery().branchQuery().andIsChildOf(
+ dispoParent).excludeArchived().excludeDeleted().getResults().getList();
+ }
+
+ private List<ArtifactReadable> findAllCiSets(BranchId branch) {
+ return getQuery().fromBranch(branch).andIsOfType(DispoConstants.DispoSet).andExists(
+ DispoConstants.DispoCiSet).getResults().getList();
+ }
+
}
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 bb679648cfc..fb82876c41f 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
@@ -40,10 +40,10 @@ public class ContinuousIntegrationResource {
}
@GET
- @Path("{ciSet}/annotations")
+ @Path("branchId/{branchId}/ciSet/{ciSet}/annotations")
@Produces(MediaType.APPLICATION_JSON)
- public HashMap<String, List<DispoAnnotationData>> getAllDispoAnnotations(@PathParam("ciSet") String ciSet) {
- HashMap<ArtifactReadable, BranchId> set = dispoApi.getCiSet(ciSet);
+ public HashMap<String, List<DispoAnnotationData>> getAllDispoAnnotations(@PathParam("branchId") String branchId, @PathParam("ciSet") String ciSet) {
+ HashMap<ArtifactReadable, BranchId> set = dispoApi.getCiSet(branchId, ciSet);
HashMap<String, List<DispoAnnotationData>> allDispoAnnotations = new HashMap<>();
if (set != null && !set.isEmpty()) {
ArtifactReadable dispoSet = set.keySet().iterator().next();
@@ -56,38 +56,38 @@ public class ContinuousIntegrationResource {
}
@GET
- @Path("{ciSet}/item/{item}/annotation")
+ @Path("branchId/{branchId}/ciSet/{ciSet}/item/{item}/annotation")
@Produces(MediaType.APPLICATION_JSON)
- public List<DispoAnnotationData> getAllDispoAnnotationsPerItem(@PathParam("ciSet") String ciSet, @PathParam("item") String item) {
- HashMap<ArtifactReadable, BranchId> set = dispoApi.getCiSet(ciSet);
+ 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 branchId = set.get(dispoSet);
- String itemId = dispoApi.getDispoItemId(branchId, dispoSet.getIdString(), item);
- return dispoApi.getDispoAnnotations(branchId, itemId);
+ BranchId branch = set.get(dispoSet);
+ String itemId = dispoApi.getDispoItemId(branch, dispoSet.getIdString(), item);
+ return dispoApi.getDispoAnnotations(branch, itemId);
}
return null;
}
@GET
- @Path("{ciSet}/configured")
+ @Path("sets")
@Produces(MediaType.APPLICATION_JSON)
- public BranchId getCiSetConfigured(@PathParam("ciSet") String ciSet) {
- return dispoApi.getCiSetConfigured(ciSet);
+ public HashMap<String, String> getAllCiSets() {
+ return dispoApi.getAllCiSets();
}
- @Path("annotate")
+ @Path("{branchId}/annotate")
@POST
@Consumes(MediaType.APPLICATION_JSON)
- public Response createDispoAnnotation(CiItemData data, @QueryParam("userName") String userName) {
+ public Response createDispoAnnotation(@PathParam("branchId") String branchId, CiItemData data, @QueryParam("userName") String userName) {
Response response = null;
- HashMap<ArtifactReadable, BranchId> set = dispoApi.getCiSet(data.getCiSet());
+ HashMap<ArtifactReadable, BranchId> set = dispoApi.getCiSet(branchId, data.getCiSet());
if (set != null && !set.isEmpty()) {
ArtifactReadable dispoSet = set.keySet().iterator().next();
- BranchId branchId = set.get(dispoSet);
- String itemId = dispoApi.getDispoItemId(branchId, dispoSet.getIdString(), data.getScriptName());
- dispoApi.deleteAllDispoAnnotation(branchId, itemId, userName, true);
- response = createAndUpdateAnnotation(data, userName, response, branchId, itemId);
+ 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);
} else {
response = Response.status(Response.Status.BAD_REQUEST).build();
}

Back to the top