Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormegumi.telles2018-03-22 16:30:48 +0000
committermegumi.telles2018-03-26 13:39:00 +0000
commit6138da0210844b90176405090fa468549ff324e0 (patch)
treeb8f2001a7150adf0a1348406eac585ee01781c85
parent44a3a8eb409a1cef927f71f1f198f3c60995107e (diff)
downloadorg.eclipse.osee-6138da0210844b90176405090fa468549ff324e0.tar.gz
org.eclipse.osee-6138da0210844b90176405090fa468549ff324e0.tar.xz
org.eclipse.osee-6138da0210844b90176405090fa468549ff324e0.zip
feature: Add annotation rest call for CI
-rw-r--r--plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/CiItemData.java57
-rw-r--r--plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/CiTestPoint.java32
-rw-r--r--plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoAnnotationData.java2
-rw-r--r--plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/internal/DispoApiTest.java22
-rw-r--r--plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/resources/AnnotationResourceTest.java17
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApi.java10
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoApiImpl.java32
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/AnnotationResource.java6
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/ContinuousIntegrationResource.java66
9 files changed, 175 insertions, 69 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
new file mode 100644
index 0000000000..b4e558a2e3
--- /dev/null
+++ b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/CiItemData.java
@@ -0,0 +1,57 @@
+/*
+ * Created on Mar 22, 2018
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.disposition.model;
+
+import java.util.List;
+import javax.xml.bind.annotation.XmlRootElement;
+import org.eclipse.osee.framework.jdk.core.type.Identifiable;
+
+@XmlRootElement(name = "CiItemData")
+public class CiItemData implements Identifiable<String> {
+
+ private String scriptName;
+ private String ciSet;
+ private CiTestPoint testPoints;
+ private List<DispoAnnotationData> annotations;
+
+ @Override
+ public String getGuid() {
+ return null;
+ }
+
+ public String getScriptName() {
+ return scriptName;
+ }
+
+ public void setScriptName(String scriptName) {
+ this.scriptName = scriptName;
+ }
+
+ public CiTestPoint getTestPoints() {
+ return testPoints;
+ }
+
+ public void setTestPoints(CiTestPoint testPoints) {
+ this.testPoints = testPoints;
+ }
+
+ public List<DispoAnnotationData> getAnnotations() {
+ return annotations;
+ }
+
+ public void setAnnotations(List<DispoAnnotationData> annotations) {
+ this.annotations = annotations;
+ }
+
+ public String getCiSet() {
+ return ciSet;
+ }
+
+ public void setCiSet(String ciSet) {
+ this.ciSet = ciSet;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/CiTestPoint.java b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/CiTestPoint.java
new file mode 100644
index 0000000000..fb7a963853
--- /dev/null
+++ b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/CiTestPoint.java
@@ -0,0 +1,32 @@
+/*
+ * Created on Mar 22, 2018
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.disposition.model;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "CiTestPoint")
+public class CiTestPoint {
+
+ private String passing;
+ private String failing;
+
+ public String getPassing() {
+ return passing;
+ }
+
+ public void setPassing(String passing) {
+ this.passing = passing;
+ }
+
+ public String getFailing() {
+ return failing;
+ }
+
+ public void setFailing(String failing) {
+ this.failing = failing;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoAnnotationData.java b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoAnnotationData.java
index fd2c9fa336..626a91d617 100644
--- a/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoAnnotationData.java
+++ b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoAnnotationData.java
@@ -27,7 +27,7 @@ public class DispoAnnotationData implements Identifiable<String> {
private int index;
private String developerNotes;
private String customerNotes;
- private String locationRefs;
+ private String locationRefs = "";
private boolean isConnected;
private List<String> idsOfCoveredDiscrepancies;
private String resolution;
diff --git a/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/internal/DispoApiTest.java b/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/internal/DispoApiTest.java
index 2a09bea4cf..d62b94981a 100644
--- a/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/internal/DispoApiTest.java
+++ b/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/internal/DispoApiTest.java
@@ -298,23 +298,23 @@ public class DispoApiTest {
annotationToCreate.setResolution("VALID");
when(dispoItem.getStatus()).thenReturn("COMPLETE");
when(validator.validate(Matchers.any(DispoAnnotationData.class))).thenReturn(true);
- String acutal = dispoApi.createDispoAnnotation(branch, itemId.getGuid(), annotationToCreate, "name");
+ String acutal = dispoApi.createDispoAnnotation(branch, itemId.getGuid(), annotationToCreate, "name", false);
assertEquals(expectedId, acutal);
when(dispoItem.getStatus()).thenReturn("PASS");
- acutal = dispoApi.createDispoAnnotation(branch, itemId.getGuid(), annotationToCreate, "name");
+ acutal = dispoApi.createDispoAnnotation(branch, itemId.getGuid(), annotationToCreate, "name", false);
assertEquals(expectedId, acutal);
when(dispoItem.getStatus()).thenReturn("INCOMPLETE");
- acutal = dispoApi.createDispoAnnotation(branch, itemId.getGuid(), annotationToCreate, "name");
+ acutal = dispoApi.createDispoAnnotation(branch, itemId.getGuid(), annotationToCreate, "name", false);
assertEquals(expectedId, acutal);
annotationToCreate.setResolution("INVALID");
- acutal = dispoApi.createDispoAnnotation(branch, itemId.getGuid(), annotationToCreate, "name");
+ acutal = dispoApi.createDispoAnnotation(branch, itemId.getGuid(), annotationToCreate, "name", false);
assertEquals(expectedId, acutal);
when(storage.findDispoItemById(branch, itemId.getGuid())).thenReturn(null); // shouldn't call dataFactory method
- acutal = dispoApi.createDispoAnnotation(branch, itemId.getGuid(), annotationToCreate, "name");
+ acutal = dispoApi.createDispoAnnotation(branch, itemId.getGuid(), annotationToCreate, "name", false);
assertEquals("", acutal);
verify(dispoConnector, times(4)).connectAnnotation(annotationToCreate, mockDiscrepancies);// Only tried to connect 3 times, excluded when annotations was invalid
@@ -367,27 +367,27 @@ public class DispoApiTest {
newAnnotation.setLocationRefs("5-10");
newAnnotation.setResolution("resOrig");
newAnnotation.setResolutionType("CODE");
- boolean actual = dispoApi.editDispoAnnotation(branch, itemId.getGuid(), expectedId, newAnnotation, "name");
+ boolean actual = dispoApi.editDispoAnnotation(branch, itemId.getGuid(), expectedId, newAnnotation, "name", false);
assertTrue(actual);
annotations.set(0, origAnnotation);
// Now change Location Refs, disconnector should be called
newAnnotation.setLocationRefs("1-10");
when(validator.validate(Matchers.any(DispoAnnotationData.class))).thenReturn(false);
- actual = dispoApi.editDispoAnnotation(branch, itemId.getGuid(), expectedId, newAnnotation, "name");
+ actual = dispoApi.editDispoAnnotation(branch, itemId.getGuid(), expectedId, newAnnotation, "name", false);
assertTrue(actual);
annotations.set(0, origAnnotation);
// reset the resolution and change just the resolution type, disconnector and should be called
newAnnotation.setLocationRefs("5-10");
newAnnotation.setResolutionType("TEST");
when(validator.validate(Matchers.any(DispoAnnotationData.class))).thenReturn(true);
- actual = dispoApi.editDispoAnnotation(branch, itemId.getGuid(), expectedId, newAnnotation, "name");
+ actual = dispoApi.editDispoAnnotation(branch, itemId.getGuid(), expectedId, newAnnotation, "name", false);
assertTrue(actual);
annotations.set(0, origAnnotation);
// Reset resolution type, only change to resolution, disconnector is called
newAnnotation.setResolutionType("CODE");
newAnnotation.setResolution("NEW");
when(validator.validate(Matchers.any(DispoAnnotationData.class))).thenReturn(true);
- actual = dispoApi.editDispoAnnotation(branch, itemId.getGuid(), expectedId, newAnnotation, "name");
+ actual = dispoApi.editDispoAnnotation(branch, itemId.getGuid(), expectedId, newAnnotation, "name", false);
assertTrue(actual);
verify(dispoConnector, times(3)).connectAnnotation(any(DispoAnnotationData.class), eq(mockDiscrepancies));
@@ -411,7 +411,7 @@ public class DispoApiTest {
DispoAnnotationData annotationInvalid = new DispoAnnotationData();
annotationInvalid.setIsResolutionValid(false);
- boolean actual = dispoApi.deleteDispoAnnotation(branch, itemId.getGuid(), expectedId, "name");
+ boolean actual = dispoApi.deleteDispoAnnotation(branch, itemId.getGuid(), expectedId, "name", false);
assertTrue(actual);
annotations.add(annotation);
@@ -421,7 +421,7 @@ public class DispoApiTest {
annotationValid.setResolutionType("OTHER");
when(mockAnnotations.get(0)).thenReturn(annotationValid);
- actual = dispoApi.deleteDispoAnnotation(branch, itemId.getGuid(), expectedId, "name");
+ actual = dispoApi.deleteDispoAnnotation(branch, itemId.getGuid(), expectedId, "name", false);
verify(dataFactory, times(2)).createUpdatedItem(any(List.class), eq(mockDiscrepancies));
assertTrue(actual);
}
diff --git a/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/resources/AnnotationResourceTest.java b/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/resources/AnnotationResourceTest.java
index ac27d7a227..8c04c6f309 100644
--- a/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/resources/AnnotationResourceTest.java
+++ b/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/resources/AnnotationResourceTest.java
@@ -60,7 +60,8 @@ public class AnnotationResourceTest {
annotationToCreate.setLocationRefs("1-10");
annotationToCreate.setId(mockId);
- when(dispositionApi.createDispoAnnotation(branch, "itemId", annotationToCreate, "name")).thenReturn(mockId);
+ when(dispositionApi.createDispoAnnotation(branch, "itemId", annotationToCreate, "name", false)).thenReturn(
+ mockId);
when(dispositionApi.getDispoAnnotationById(branch, "itemId", mockId)).thenReturn(annotationToCreate);
DispoAnnotationData expectedAnnotation = new DispoAnnotationData();
@@ -122,15 +123,15 @@ public class AnnotationResourceTest {
newAnnotation.setLocationRefs("2-11");
DispoAnnotationData annotationToEdit = new DispoAnnotationData();
annotationToEdit.setId(mockId);
- when(dispositionApi.editDispoAnnotation(branch, "itemId", annotationToEdit.getId(), newAnnotation,
- "name")).thenReturn(true);
+ when(dispositionApi.editDispoAnnotation(branch, "itemId", annotationToEdit.getId(), newAnnotation, "name",
+ false)).thenReturn(true);
when(dispositionApi.getDispoItemById(branch, "itemId")).thenReturn(dispoItem);
when(dispoItem.getStatus()).thenReturn(DispoStrings.Item_Complete);
Response response = resource.putDispoAnnotation(annotationToEdit.getId(), newAnnotation, "name");
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
- when(dispositionApi.editDispoAnnotation(branch, "itemId", annotationToEdit.getId(), newAnnotation,
- "name")).thenReturn(false);
+ when(dispositionApi.editDispoAnnotation(branch, "itemId", annotationToEdit.getId(), newAnnotation, "name",
+ false)).thenReturn(false);
response = resource.putDispoAnnotation(annotationToEdit.getId(), newAnnotation, "name");
assertEquals(Response.Status.NOT_MODIFIED.getStatusCode(), response.getStatus());
}
@@ -139,13 +140,15 @@ public class AnnotationResourceTest {
public void testDelete() {
DispoAnnotationData annotationToEdit = new DispoAnnotationData();
annotationToEdit.setId(mockId);
- when(dispositionApi.deleteDispoAnnotation(branch, "itemId", annotationToEdit.getId(), "name")).thenReturn(true);
+ when(dispositionApi.deleteDispoAnnotation(branch, "itemId", annotationToEdit.getId(), "name", false)).thenReturn(
+ true);
when(dispositionApi.getDispoItemById(branch, "itemId")).thenReturn(dispoItem);
when(dispoItem.getStatus()).thenReturn(DispoStrings.Item_InComplete);
Response response = resource.deleteDispoAnnotation(annotationToEdit.getId(), "name");
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
- when(dispositionApi.deleteDispoAnnotation(branch, "itemId", annotationToEdit.getId(), "name")).thenReturn(false);
+ when(dispositionApi.deleteDispoAnnotation(branch, "itemId", annotationToEdit.getId(), "name", false)).thenReturn(
+ false);
response = resource.deleteDispoAnnotation(annotationToEdit.getId(), "name");
assertEquals(Response.Status.NOT_MODIFIED.getStatusCode(), response.getStatus());
}
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 ba33e6f910..e93b3dc54a 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
@@ -54,7 +54,7 @@ public interface DispoApi {
Long createDispoSet(BranchId branch, DispoSetDescriptorData descriptor);
- String createDispoAnnotation(BranchId branch, String itemId, DispoAnnotationData annotation, String userName);
+ String createDispoAnnotation(BranchId branch, String itemId, DispoAnnotationData annotation, String userName, boolean isCi);
void editDispoSet(BranchId branch, String dispoSetId, DispoSetData newDispoSet);
@@ -62,7 +62,7 @@ public interface DispoApi {
boolean massEditTeam(BranchId branch, String setId, List<String> itemNames, String team, String commitMessage);
- boolean editDispoAnnotation(BranchId branch, String itemId, String annotationId, DispoAnnotationData newAnnotation, String userName);
+ boolean editDispoAnnotation(BranchId branch, String itemId, String annotationId, DispoAnnotationData newAnnotation, String userName, boolean isCi);
void copyDispoSet(BranchId branch, String destSetId, BranchId sourceBranch, String sourceSetId, CopySetParams params);
@@ -74,7 +74,9 @@ public interface DispoApi {
boolean deleteDispoItem(BranchId branch, String itemId);
- boolean deleteDispoAnnotation(BranchId branch, String itemId, String annotationId, String userName);
+ boolean deleteDispoAnnotation(BranchId branch, String itemId, String annotationId, String userName, boolean isCi);
+
+ boolean deleteAllDispoAnnotation(BranchId branch, String itemId, String userName, boolean isCi);
// Utilities
boolean isUniqueProgramName(String name);
@@ -92,5 +94,5 @@ public interface DispoApi {
String getDispoItemId(BranchId branch, String setId, String item);
- boolean isCiSetConfigured(String ciSet);
+ BranchId getCiSetConfigured(String ciSet);
}
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 a899836d2a..772c0352db 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
@@ -151,10 +151,10 @@ public class DispoApiImpl implements DispoApi {
}
@Override
- public String createDispoAnnotation(BranchId branch, String itemId, DispoAnnotationData annotationToCreate, String userName) {
+ public String createDispoAnnotation(BranchId branch, String itemId, DispoAnnotationData annotationToCreate, String userName, boolean isCi) {
String idOfNewAnnotation = "";
DispoItem dispoItem = getQuery().findDispoItemById(branch, itemId);
- if (dispoItem != null && dispoItem.getAssignee().equalsIgnoreCase(userName)) {
+ if (dispoItem != null && (isCi || dispoItem.getAssignee().equalsIgnoreCase(userName))) {
List<DispoAnnotationData> annotationsList = dispoItem.getAnnotationsList();
dataFactory.initAnnotation(annotationToCreate);
idOfNewAnnotation = dataFactory.getNewId();
@@ -321,10 +321,10 @@ public class DispoApiImpl implements DispoApi {
}
@Override
- public boolean editDispoAnnotation(BranchId branch, String itemId, String annotationId, DispoAnnotationData newAnnotation, String userName) {
+ public boolean editDispoAnnotation(BranchId branch, String itemId, String annotationId, DispoAnnotationData newAnnotation, String userName, boolean isCi) {
boolean wasUpdated = false;
DispoItem dispoItem = getQuery().findDispoItemById(branch, itemId);
- if (dispoItem != null && dispoItem.getAssignee().equalsIgnoreCase(userName)) {
+ if (dispoItem != null && (isCi || dispoItem.getAssignee().equalsIgnoreCase(userName))) {
List<DispoAnnotationData> annotationsList = dispoItem.getAnnotationsList();
Map<String, Discrepancy> discrepanciesList = dispoItem.getDiscrepanciesList();
DispoAnnotationData origAnnotation = DispoUtil.getById(annotationsList, annotationId);
@@ -378,10 +378,10 @@ public class DispoApiImpl implements DispoApi {
}
@Override
- public boolean deleteDispoAnnotation(BranchId branch, String itemId, String annotationId, String userName) {
+ public boolean deleteDispoAnnotation(BranchId branch, String itemId, String annotationId, String userName, boolean isCi) {
boolean wasUpdated = false;
DispoItem dispoItem = getQuery().findDispoItemById(branch, itemId);
- if (dispoItem != null && dispoItem.getAssignee().equalsIgnoreCase(userName)) {
+ if (dispoItem != null && (isCi || dispoItem.getAssignee().equalsIgnoreCase(userName))) {
List<DispoAnnotationData> annotationsList = dispoItem.getAnnotationsList();
Map<String, Discrepancy> discrepanciesList = dispoItem.getDiscrepanciesList();
DispoAnnotationData annotationToRemove = DispoUtil.getById(annotationsList, annotationId);
@@ -406,6 +406,18 @@ public class DispoApiImpl implements DispoApi {
}
@Override
+ public boolean deleteAllDispoAnnotation(BranchId branch, String itemId, String userName, boolean isCi) {
+ boolean wasUpdated = false;
+ DispoItem dispoItem = getQuery().findDispoItemById(branch, itemId);
+ if (dispoItem != null) {
+ for (DispoAnnotationData annotation : dispoItem.getAnnotationsList()) {
+ wasUpdated = deleteDispoAnnotation(branch, itemId, annotation.getId(), userName, isCi);
+ }
+ }
+ return wasUpdated;
+ }
+
+ @Override
public List<IOseeBranch> getDispoPrograms() {
return getQuery().getDispoBranches();
}
@@ -676,8 +688,12 @@ public class DispoApiImpl implements DispoApi {
}
@Override
- public boolean isCiSetConfigured(String ciSet) {
- return !getCiSet(ciSet).isEmpty();
+ public BranchId getCiSetConfigured(String ciSet) {
+ HashMap<ArtifactReadable, BranchId> set = getCiSet(ciSet);
+ if (!set.isEmpty()) {
+ return set.values().iterator().next();
+ }
+ return BranchId.SENTINEL;
}
}
diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/AnnotationResource.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/AnnotationResource.java
index 62fc795e7f..bbba4796ea 100644
--- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/AnnotationResource.java
+++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/AnnotationResource.java
@@ -58,7 +58,7 @@ public class AnnotationResource {
Response response;
DispoAnnotationData createdAnnotation;
if (!annotation.getLocationRefs().isEmpty()) {
- String createdAnnotationId = dispoApi.createDispoAnnotation(branch, itemId, annotation, userName);
+ String createdAnnotationId = dispoApi.createDispoAnnotation(branch, itemId, annotation, userName, false);
if (createdAnnotationId != "") {
status = Status.CREATED;
createdAnnotation = dispoApi.getDispoAnnotationById(branch, itemId, createdAnnotationId);
@@ -118,7 +118,7 @@ public class AnnotationResource {
@Consumes(MediaType.APPLICATION_JSON)
public Response putDispoAnnotation(@PathParam("annotationId") String annotationId, DispoAnnotationData newAnnotation, @QueryParam("userName") String userName) {
Response response;
- boolean wasEdited = dispoApi.editDispoAnnotation(branch, itemId, annotationId, newAnnotation, userName);
+ boolean wasEdited = dispoApi.editDispoAnnotation(branch, itemId, annotationId, newAnnotation, userName, false);
if (wasEdited) {
response = Response.status(Response.Status.OK).build();
@@ -140,7 +140,7 @@ public class AnnotationResource {
@DELETE
public Response deleteDispoAnnotation(@PathParam("annotationId") String annotationId, @QueryParam("userName") String userName) {
Response response;
- boolean wasEdited = dispoApi.deleteDispoAnnotation(branch, itemId, annotationId, userName);
+ boolean wasEdited = dispoApi.deleteDispoAnnotation(branch, itemId, annotationId, userName, false);
if (wasEdited) {
response = Response.status(Response.Status.OK).build();
} else {
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 07adc5a3cb..bb679648cf 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
@@ -21,10 +21,10 @@ 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.disposition.model.CiItemData;
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.disposition.rest.util.DispoUtil;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.orcs.data.ArtifactReadable;
@@ -72,61 +72,57 @@ public class ContinuousIntegrationResource {
@GET
@Path("{ciSet}/configured")
@Produces(MediaType.APPLICATION_JSON)
- public boolean isCiSetConfigured(@PathParam("ciSet") String ciSet) {
- return dispoApi.isCiSetConfigured(ciSet);
+ public BranchId getCiSetConfigured(@PathParam("ciSet") String ciSet) {
+ return dispoApi.getCiSetConfigured(ciSet);
}
- @Path("{ciSet}/item/{item}/annotate")
+ @Path("annotate")
@POST
@Consumes(MediaType.APPLICATION_JSON)
- public Response createDispoAnnotation(@PathParam("ciSet") String ciSet, @PathParam("item") String item, DispoAnnotationData data, @QueryParam("userName") String userName) {
- Response response;
- HashMap<ArtifactReadable, BranchId> set = dispoApi.getCiSet(ciSet);
+ public Response createDispoAnnotation(CiItemData data, @QueryParam("userName") String userName) {
+ Response response = null;
+ HashMap<ArtifactReadable, BranchId> set = dispoApi.getCiSet(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(), item);
- String createdAnnotationId = dispoApi.createDispoAnnotation(branchId, itemId, data, userName);
+ String itemId = dispoApi.getDispoItemId(branchId, dispoSet.getIdString(), data.getScriptName());
+ dispoApi.deleteAllDispoAnnotation(branchId, itemId, userName, true);
+ response = createAndUpdateAnnotation(data, userName, response, branchId, itemId);
+ } else {
+ response = Response.status(Response.Status.BAD_REQUEST).build();
+ }
+ return response;
+ }
+
+ private Response createAndUpdateAnnotation(CiItemData data, String userName, Response response, BranchId branchId, String itemId) {
+ for (DispoAnnotationData annotation : data.getAnnotations()) {
+ DispoAnnotationData temp = new DispoAnnotationData();
+ String createdAnnotationId = dispoApi.createDispoAnnotation(branchId, itemId, temp, userName, true);
if (!createdAnnotationId.isEmpty()) {
response = Response.status(Response.Status.OK).build();
- boolean wasEdited = dispoApi.editDispoAnnotation(branchId, itemId, createdAnnotationId, data, userName);
+ initTempAnnotationData(annotation, temp);
+ boolean wasEdited =
+ dispoApi.editDispoAnnotation(branchId, itemId, createdAnnotationId, temp, userName, true);
if (wasEdited) {
response = Response.status(Response.Status.OK).build();
} else {
response = Response.status(Response.Status.NOT_MODIFIED).build();
+ break;
}
} else {
response = Response.status(Response.Status.NOT_ACCEPTABLE).build();
+ break;
}
- } else {
- response = Response.status(Response.Status.BAD_REQUEST).build();
}
return response;
}
- @Path("{ciSet}/item/{item}/update")
- @POST
- @Consumes(MediaType.APPLICATION_JSON)
- public Response editDispoAnnotation(@PathParam("ciSet") String ciSet, @PathParam("item") String item, DispoAnnotationData data, @QueryParam("userName") String userName) {
- Response response;
- HashMap<ArtifactReadable, BranchId> set = dispoApi.getCiSet(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);
- List<DispoItem> dispoItems = dispoApi.getDispoItems(branchId, dispoSet.getIdString(), false);
- DispoItem dispoItem = DispoUtil.findDispoItem(dispoItems, item);
- DispoAnnotationData id = DispoUtil.getById(dispoItem.getAnnotationsList(), data.getId());
- boolean wasEdited = dispoApi.editDispoAnnotation(branchId, itemId, id.getId(), data, userName);
- if (wasEdited) {
- response = Response.status(Response.Status.OK).build();
- } else {
- response = Response.status(Response.Status.NOT_MODIFIED).build();
- }
- } else {
- response = Response.status(Response.Status.BAD_REQUEST).build();
- }
- return response;
+ private void initTempAnnotationData(DispoAnnotationData annotation, DispoAnnotationData temp) {
+ temp.setLocationRefs(annotation.getLocationRefs());
+ temp.setResolution(annotation.getResolution());
+ temp.setResolutionType(annotation.getResolutionType());
+ temp.setCustomerNotes(annotation.getCustomerNotes());
+ temp.setDeveloperNotes(annotation.getDeveloperNotes());
}
}

Back to the top