Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2016-10-07 17:55:03 -0400
committerDonald Dunne2016-10-11 20:58:51 -0400
commitb310fbc23ba28d8911ab5aa47558ad6b9c5a7383 (patch)
treed1389819235d27738ab79343f7b168caaa9033ee
parent64186cc2251682628c6890693cd9d5c0d8f0bd9e (diff)
downloadorg.eclipse.osee-b310fbc23ba28d8911ab5aa47558ad6b9c5a7383.tar.gz
org.eclipse.osee-b310fbc23ba28d8911ab5aa47558ad6b9c5a7383.tar.xz
org.eclipse.osee-b310fbc23ba28d8911ab5aa47558ad6b9c5a7383.zip
feature[ats_ATS315180]: Add ability to open burndown from Sprint
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/agile/AgileEndpointApi.java9
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/agile/JaxBurndownExcel.java46
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsChangeSet.java3
-rw-r--r--plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/agile/AgileEndpointTest.java48
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/util/AtsChangeSet.java8
-rw-r--r--plugins/org.eclipse.osee.ats.rest/OSEE-INF/support/OSEE_Sprint_Burndown.iqy2
-rw-r--r--plugins/org.eclipse.osee.ats.rest/OSEE-INF/support/OSEE_Sprint_Burndown.xlsbin54784 -> 56320 bytes
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/agile/AgileEndpointImpl.java95
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsChangeSet.java8
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/RestUtil.java14
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/agile/XOpenSprintBurndownButton.java116
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/AtsWidgetProvider.java3
-rw-r--r--plugins/org.eclipse.osee.ats/support/WorkDef_Sprint.ats14
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeResourceNameResolver.java9
14 files changed, 364 insertions, 11 deletions
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/agile/AgileEndpointApi.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/agile/AgileEndpointApi.java
index d6ae85dab2f..00191867534 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/agile/AgileEndpointApi.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/agile/AgileEndpointApi.java
@@ -172,4 +172,13 @@ public interface AgileEndpointApi {
@Path("item/{itemId}/points")
public Response setPoints(@PathParam("itemId") long itemId, String points);
+ /**
+ * If missing, creates artifacts OSEE_Sprint_Burndown.iqy and OSEE_Sprint_Burndown.xls as children of sprint or
+ * returns existing if already exist
+ */
+ @GET
+ @Path("team/{teamUuid}/sprint/{sprintUuid}/burndownExcel")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response getSprintBurndownExcel(@PathParam("teamUuid") long teamUuid, @PathParam("sprintUuid") long sprintUuid);
+
}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/agile/JaxBurndownExcel.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/agile/JaxBurndownExcel.java
new file mode 100644
index 00000000000..0dc8861f683
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/agile/JaxBurndownExcel.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.ats.api.agile;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class JaxBurndownExcel {
+
+ Long excelSheetUuid;
+ Long excelQueryUuid;
+ String error;
+
+ public Long getExcelSheetUuid() {
+ return excelSheetUuid;
+ }
+
+ public void setExcelSheetUuid(Long excelSheetUuid) {
+ this.excelSheetUuid = excelSheetUuid;
+ }
+
+ public Long getExcelQueryUuid() {
+ return excelQueryUuid;
+ }
+
+ public void setExcelQueryUuid(Long excelQueryUuid) {
+ this.excelQueryUuid = excelQueryUuid;
+ }
+
+ public String getError() {
+ return error;
+ }
+
+ public void setError(String error) {
+ this.error = error;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsChangeSet.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsChangeSet.java
index 0317480443c..62585acd395 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsChangeSet.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/util/IAtsChangeSet.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.ats.api.util;
+import java.io.InputStream;
import java.util.Collection;
import java.util.List;
import org.eclipse.osee.ats.api.IAtsObject;
@@ -128,4 +129,6 @@ public interface IAtsChangeSet {
void setSoleAttributeFromString(IAtsObject atsObject, IAttributeType attributeType, String value);
+ void setSoleAttributeFromStream(ArtifactId artifact, IAttributeType attributeType, InputStream inputStream);
+
}
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/agile/AgileEndpointTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/agile/AgileEndpointTest.java
index ebc014f1d26..11b1a4bb638 100644
--- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/agile/AgileEndpointTest.java
+++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/agile/AgileEndpointTest.java
@@ -18,6 +18,7 @@ import org.eclipse.osee.ats.api.agile.JaxAgileBacklog;
import org.eclipse.osee.ats.api.agile.JaxAgileFeatureGroup;
import org.eclipse.osee.ats.api.agile.JaxAgileSprint;
import org.eclipse.osee.ats.api.agile.JaxAgileTeam;
+import org.eclipse.osee.ats.api.agile.JaxBurndownExcel;
import org.eclipse.osee.ats.api.agile.JaxNewAgileBacklog;
import org.eclipse.osee.ats.api.agile.JaxNewAgileFeatureGroup;
import org.eclipse.osee.ats.api.agile.JaxNewAgileSprint;
@@ -25,6 +26,8 @@ import org.eclipse.osee.ats.api.agile.JaxNewAgileTeam;
import org.eclipse.osee.ats.api.data.AtsRelationTypes;
import org.eclipse.osee.ats.client.integration.tests.AtsClientService;
import org.eclipse.osee.ats.demo.api.DemoArtifactToken;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.jdk.core.type.Pair;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
@@ -231,4 +234,49 @@ public class AgileEndpointTest {
Assert.assertTrue(html.contains("Total Remaining"));
}
+ @Test
+ public void testGetSprintBurndownExcel() {
+ Pair<Artifact, Artifact> teamSprint = getTeamSprint();
+ Artifact agileTeam = teamSprint.getFirst();
+ Artifact sprint2 = teamSprint.getSecond();
+ Assert.assertEquals(0, sprint2.getChildren().size());
+ Response response = agile.getSprintBurndownExcel(agileTeam.getUuid(), sprint2.getUuid());
+ Assert.assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+
+ JaxBurndownExcel report = response.readEntity(JaxBurndownExcel.class);
+ Assert.assertNotNull(report);
+
+ sprint2.reloadAttributesAndRelations();
+ Assert.assertEquals(2, sprint2.getChildren().size());
+
+ Long excelSheetUuid = report.getExcelSheetUuid();
+ Assert.assertNotNull(excelSheetUuid);
+ Artifact excelArt = AtsClientService.get().getArtifact(excelSheetUuid);
+ Assert.assertNotNull(excelSheetUuid);
+ Assert.assertEquals("xls", excelArt.getSoleAttributeValue(CoreAttributeTypes.Extension, null));
+ Assert.assertNotNull(excelArt.getSoleAttributeValue(CoreAttributeTypes.NativeContent, null));
+ Assert.assertEquals(CoreArtifactTypes.GeneralDocument, excelArt.getArtifactType());
+
+ Long excelQueryUuid = report.getExcelQueryUuid();
+ Assert.assertNotNull(excelQueryUuid);
+ Artifact excelQueryArt = AtsClientService.get().getArtifact(excelQueryUuid);
+ Assert.assertNotNull(excelQueryUuid);
+ Assert.assertEquals("iqy", excelQueryArt.getSoleAttributeValue(CoreAttributeTypes.Extension, null));
+ Assert.assertNotNull(excelQueryArt.getSoleAttributeValue(CoreAttributeTypes.NativeContent, null));
+ Assert.assertEquals(CoreArtifactTypes.GeneralDocument, excelQueryArt.getArtifactType());
+
+ // Ensure that successive calls return same uuids and do not create new artifacts
+ response = agile.getSprintBurndownExcel(agileTeam.getUuid(), sprint2.getUuid());
+ Assert.assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+
+ JaxBurndownExcel report2 = response.readEntity(JaxBurndownExcel.class);
+ Assert.assertNotNull(report2);
+
+ sprint2.reloadAttributesAndRelations();
+ Assert.assertEquals(2, sprint2.getChildren().size());
+ Assert.assertEquals(report.getExcelQueryUuid(), report2.getExcelQueryUuid());
+ Assert.assertEquals(report.getExcelSheetUuid(), report2.getExcelSheetUuid());
+
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/util/AtsChangeSet.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/util/AtsChangeSet.java
index 75ca26e53d6..7c0da26d2b4 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/util/AtsChangeSet.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/util/AtsChangeSet.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.ats.core.client.util;
import static org.eclipse.osee.framework.core.enums.RelationSorter.PREEXISTING;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -403,4 +404,11 @@ public class AtsChangeSet extends AbstractAtsChangeSet {
add(art);
}
+ @Override
+ public void setSoleAttributeFromStream(ArtifactId artifact, IAttributeType attributeType, InputStream inputStream) {
+ Artifact art = getArtifact(artifact);
+ art.setSoleAttributeFromStream(attributeType, inputStream);
+ add(art);
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.rest/OSEE-INF/support/OSEE_Sprint_Burndown.iqy b/plugins/org.eclipse.osee.ats.rest/OSEE-INF/support/OSEE_Sprint_Burndown.iqy
index 072b9364d06..55125a5ff53 100644
--- a/plugins/org.eclipse.osee.ats.rest/OSEE-INF/support/OSEE_Sprint_Burndown.iqy
+++ b/plugins/org.eclipse.osee.ats.rest/OSEE-INF/support/OSEE_Sprint_Burndown.iqy
@@ -1,6 +1,6 @@
WEB
1
-http://a5481444.sw.nos.boeing.com:8092/ats/agile/team/6915488/sprint/1226060751/burndown/ui
+BASE_URI/agile/team/TEAM_ID/sprint/SPRINT_ID/burndown/ui
Selection=AllTables
Formatting=None
diff --git a/plugins/org.eclipse.osee.ats.rest/OSEE-INF/support/OSEE_Sprint_Burndown.xls b/plugins/org.eclipse.osee.ats.rest/OSEE-INF/support/OSEE_Sprint_Burndown.xls
index 10bc765944c..affc512f43e 100644
--- a/plugins/org.eclipse.osee.ats.rest/OSEE-INF/support/OSEE_Sprint_Burndown.xls
+++ b/plugins/org.eclipse.osee.ats.rest/OSEE-INF/support/OSEE_Sprint_Burndown.xls
Binary files differ
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/agile/AgileEndpointImpl.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/agile/AgileEndpointImpl.java
index 6977ca34a44..b17d8c2deb6 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/agile/AgileEndpointImpl.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/agile/AgileEndpointImpl.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.osee.ats.rest.internal.agile;
+import java.io.File;
+import java.io.FileInputStream;
import java.net.URI;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -17,10 +19,13 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
+import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriBuilder;
@@ -42,6 +47,7 @@ import org.eclipse.osee.ats.api.agile.JaxAgileFeatureGroup;
import org.eclipse.osee.ats.api.agile.JaxAgileItem;
import org.eclipse.osee.ats.api.agile.JaxAgileSprint;
import org.eclipse.osee.ats.api.agile.JaxAgileTeam;
+import org.eclipse.osee.ats.api.agile.JaxBurndownExcel;
import org.eclipse.osee.ats.api.agile.JaxNewAgileBacklog;
import org.eclipse.osee.ats.api.agile.JaxNewAgileFeatureGroup;
import org.eclipse.osee.ats.api.agile.JaxNewAgileSprint;
@@ -55,8 +61,12 @@ import org.eclipse.osee.ats.core.users.AtsCoreUsers;
import org.eclipse.osee.ats.rest.IAtsServer;
import org.eclipse.osee.ats.rest.internal.util.RestUtil;
import org.eclipse.osee.ats.rest.internal.world.WorldResource;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.CoreBranches;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
import org.eclipse.osee.framework.jdk.core.type.ClassBasedResourceToken;
import org.eclipse.osee.framework.jdk.core.type.IResourceRegistry;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -616,4 +626,87 @@ public class AgileEndpointImpl implements AgileEndpointApi {
return Response.ok().build();
}
-}
+ @Override
+ @GET
+ @Path("team/{teamUuid}/sprint/{sprintUuid}/burndownExcel")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response getSprintBurndownExcel(@PathParam("teamUuid") long teamUuid, @PathParam("sprintUuid") long sprintUuid) {
+ JaxBurndownExcel report = new JaxBurndownExcel();
+ ArtifactReadable sprintArt = atsServer.getArtifact(sprintUuid);
+ IAgileSprint sprint = atsServer.getWorkItemFactory().getAgileSprint(sprintArt);
+ Conditions.assertNotNull(sprintArt, "Sprint not found with id %s", sprintUuid);
+ ArtifactReadable burndownExcel = null, burndownQuery = null;
+ for (ArtifactReadable art : sprintArt.getChildren()) {
+ if (art.getName().equals(
+ "OSEE_Sprint_Burndown") && art.getSoleAttributeValue(CoreAttributeTypes.Extension, "").equals("xls")) {
+ burndownExcel = art;
+ } else if (art.getName().equals(
+ "OSEE_Sprint_Burndown") && art.getSoleAttributeValue(CoreAttributeTypes.Extension, "").equals("iqy")) {
+ burndownQuery = art;
+ }
+ }
+ if ((burndownExcel != null && burndownQuery == null) || (burndownExcel == null && burndownQuery != null)) {
+ report.setError(
+ "Either OSEE_Sprint_Burndown.xls or OSEE_Sprint_Burndown.iqy was found. Both need to be found or none. Names must match exactly.");
+ return Response.ok(report).build();
+ }
+ try {
+ // If not found, create and save artifacts related to this burndown
+ if (burndownExcel == null) {
+ IAtsChangeSet changes = atsServer.createChangeSet("Create Burndown Artifacts", AtsCoreUsers.SYSTEM_USER);
+
+ // Store xls file to OSEE databasePlugin
+ File burndownXls = RestUtil.getResourceAsFile("support/OSEE_Sprint_Burndown.xls");
+ FileInputStream burndownFileInputStream = new FileInputStream(burndownXls);
+
+ ArtifactId burndownExcelArt =
+ changes.createArtifact(CoreArtifactTypes.GeneralDocument, "OSEE_Sprint_Burndown");
+ changes.setSoleAttributeValue(burndownExcelArt, CoreAttributeTypes.Extension, "xls");
+ changes.setSoleAttributeFromStream(burndownExcelArt, CoreAttributeTypes.NativeContent,
+ burndownFileInputStream);
+ changes.relate(sprint, CoreRelationTypes.Default_Hierarchical__Child, burndownExcelArt);
+ report.setExcelSheetUuid(burndownExcelArt.getUuid());
+
+ // Store query file to OSEE database
+ String burndownqry = RestUtil.getResource("support/OSEE_Sprint_Burndown.iqy");
+ burndownqry = burndownqry.replace("BASE_URI", uriInfo.getBaseUri().toString());
+ IAgileTeam team =
+ atsServer.getConfigItemFactory().getAgileTeam(atsServer.getArtifact(sprint.getTeamUuid()));
+ burndownqry = burndownqry.replace("TEAM_ID", team.getId().toString());
+ burndownqry = burndownqry.replace("SPRINT_ID", sprintArt.getId().toString());
+ ArtifactId burndownQryArt =
+ changes.createArtifact(CoreArtifactTypes.GeneralDocument, "OSEE_Sprint_Burndown");
+ changes.setSoleAttributeValue(burndownQryArt, CoreAttributeTypes.Extension, "iqy");
+ changes.setSoleAttributeFromStream(burndownQryArt, CoreAttributeTypes.NativeContent,
+ Lib.stringToInputStream(burndownqry));
+ changes.relate(sprint, CoreRelationTypes.Default_Hierarchical__Child, burndownQryArt);
+ report.setExcelQueryUuid(burndownQryArt.getUuid());
+
+ changes.execute();
+ }
+ // Else if found
+ else {
+ ArtifactReadable excelArt = null, queryArt = null;
+ for (ArtifactReadable child : sprintArt.getChildren()) {
+ if (child.getSoleAttributeValue(CoreAttributeTypes.Extension, "").equals("xls")) {
+ excelArt = child;
+ report.setExcelSheetUuid(excelArt.getUuid());
+ } else if (child.getSoleAttributeValue(CoreAttributeTypes.Extension, "").equals("iqy")) {
+ queryArt = child;
+ report.setExcelQueryUuid(queryArt.getUuid());
+ }
+ }
+ if (excelArt == null) {
+ report.setError("Could not access Excel burndown artifact.");
+ }
+ if (queryArt == null) {
+ report.setError(report.getError() + "\nCould not access Excel Query burndown artifact.");
+ }
+ }
+ } catch (Exception ex) {
+ throw new OseeWebApplicationException(ex, Status.INTERNAL_SERVER_ERROR);
+ }
+ return Response.ok(report).build();
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsChangeSet.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsChangeSet.java
index f86e71c8546..10dee860faf 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsChangeSet.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/AtsChangeSet.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.ats.rest.internal.util;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -357,4 +358,11 @@ public class AtsChangeSet extends AbstractAtsChangeSet {
add(art);
}
+ @Override
+ public void setSoleAttributeFromStream(ArtifactId artifact, IAttributeType attributeType, InputStream inputStream) {
+ ArtifactReadable art = getArtifact(artifact);
+ getTransaction().setSoleAttributeFromStream(art, attributeType, inputStream);
+ add(art);
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/RestUtil.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/RestUtil.java
index 86a70eb2dfa..41d0abdcdd0 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/RestUtil.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/util/RestUtil.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.ats.rest.internal.util;
+import java.io.File;
import java.net.URI;
import java.net.URL;
import java.util.Arrays;
@@ -17,10 +18,12 @@ import java.util.Collection;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriBuilder;
+import org.eclipse.core.runtime.FileLocator;
import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.core.util.AtsUtilCore;
import org.eclipse.osee.ats.rest.IAtsServer;
import org.eclipse.osee.ats.rest.internal.AtsApplication;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.ViewModel;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.osgi.framework.Bundle;
@@ -40,6 +43,17 @@ public class RestUtil {
return Lib.inputStreamToString(url.openStream());
}
+ public static File getResourceAsFile(String path) {
+ Bundle bundle = FrameworkUtil.getBundle(AtsApplication.class);
+ URL url = bundle.getEntry("OSEE-INF/" + path);
+ try {
+ URL fileUrl = FileLocator.toFileURL(url);
+ return new File(fileUrl.toURI().getPath());
+ } catch (Exception ex) {
+ throw new OseeCoreException(ex, "Error getting resource [%s] as file", path);
+ }
+ }
+
public static String simplePageHtml(String title, String message) throws Exception {
String html = getResource("templates/simple.html");
html = html.replaceFirst("<\\?PUT_MESSAGE_HERE\\?>", message);
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/agile/XOpenSprintBurndownButton.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/agile/XOpenSprintBurndownButton.java
new file mode 100644
index 00000000000..f3be60af2e5
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/agile/XOpenSprintBurndownButton.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.ats.agile;
+
+import java.io.File;
+import java.io.InputStream;
+import javax.ws.rs.core.Response;
+import org.eclipse.osee.ats.AtsImage;
+import org.eclipse.osee.ats.api.agile.IAgileSprint;
+import org.eclipse.osee.ats.api.agile.JaxBurndownExcel;
+import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
+import org.eclipse.osee.ats.internal.Activator;
+import org.eclipse.osee.ats.internal.AtsClientService;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.util.Result;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.logging.OseeLevel;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.skynet.widgets.IArtifactWidget;
+import org.eclipse.osee.framework.ui.skynet.widgets.XButton;
+import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.program.Program;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class XOpenSprintBurndownButton extends XButton implements IArtifactWidget {
+
+ private IAgileSprint sprint;
+ private final boolean editable = false;
+ public static final String WIDGET_ID = XOpenSprintBurndownButton.class.getSimpleName();
+
+ public XOpenSprintBurndownButton() {
+ super("Open Sprint Burndown/up");
+ setImage(ImageManager.getImage(AtsImage.REPORT));
+ setToolTip("Click to run Open Report");
+ addXModifiedListener(listener);
+ }
+
+ @Override
+ public Artifact getArtifact() {
+ return (Artifact) sprint.getStoreObject();
+ }
+
+ XModifiedListener listener = new XModifiedListener() {
+ @Override
+ public void widgetModified(org.eclipse.osee.framework.ui.skynet.widgets.XWidget widget) {
+ try {
+ createAndOpenBurndown();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ };
+ };
+
+ private void createAndOpenBurndown() {
+ try {
+ Response response = AtsClientService.getAgileEndpoint().getSprintBurndownExcel(sprint.getTeamUuid(), sprint.getId());
+ if (response.getStatus() == Response.Status.OK.getStatusCode()) {
+ JaxBurndownExcel report = response.readEntity(JaxBurndownExcel.class);
+ Artifact excelArt = AtsClientService.get().getArtifact(report.getExcelSheetUuid());
+ File excelFile = new File("C:/UserData/OSEE_Sprint_Burndown.xls");
+ InputStream inputStream = excelArt.getSoleAttributeValue(CoreAttributeTypes.NativeContent, null);
+ Lib.inputStreamToFile(inputStream, excelFile);
+ File queryFile = new File("C:/UserData/OSEE_Sprint_Burndown.iqy");
+ Artifact queryArt = AtsClientService.get().getArtifact(report.getExcelQueryUuid());
+ Lib.writeStringToFile(queryArt.getSoleAttributeValueAsString(CoreAttributeTypes.NativeContent, ""),
+ queryFile);
+ Program.launch(excelFile.getAbsolutePath());
+ } else {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, "Error getting/generating report.");
+ }
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+
+ @Override
+ public Result isDirty() {
+ return Result.FalseResult;
+ }
+
+ @Override
+ public void revert() {
+ // do nothing
+ }
+
+ @Override
+ public void saveToArtifact() {
+ // do nothing
+ }
+
+ @Override
+ public void setArtifact(Artifact artifact) throws OseeCoreException {
+ if (artifact.isOfType(AtsArtifactTypes.AgileSprint)) {
+ this.sprint = (IAgileSprint) artifact;
+ }
+ }
+
+ @Override
+ public boolean isEditable() {
+ return editable;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/AtsWidgetProvider.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/AtsWidgetProvider.java
index 29983f79fc7..dad83b25fca 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/AtsWidgetProvider.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/widgets/AtsWidgetProvider.java
@@ -14,6 +14,7 @@ package org.eclipse.osee.ats.util.widgets;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
+import org.eclipse.osee.ats.agile.XOpenSprintBurndownButton;
import org.eclipse.osee.ats.agile.XRunSprintSummaryButton;
import org.eclipse.osee.ats.api.program.IAtsProgram;
import org.eclipse.osee.ats.column.OperationalImpactWithWorkaroundXWidget;
@@ -142,6 +143,8 @@ public class AtsWidgetProvider implements IXWidgetProvider {
return new XProgramSelectionWidget();
} else if (widgetName.equals(XRunSprintSummaryButton.WIDGET_ID)) {
return new XRunSprintSummaryButton();
+ } else if (widgetName.equals(XOpenSprintBurndownButton.WIDGET_ID)) {
+ return new XOpenSprintBurndownButton();
} else if (widgetName.equals(XWorkPackageWidget.WIDGET_ID)) {
return new XWorkPackageWidget();
}
diff --git a/plugins/org.eclipse.osee.ats/support/WorkDef_Sprint.ats b/plugins/org.eclipse.osee.ats/support/WorkDef_Sprint.ats
index 2f105a92f6f..75301488af0 100644
--- a/plugins/org.eclipse.osee.ats/support/WorkDef_Sprint.ats
+++ b/plugins/org.eclipse.osee.ats/support/WorkDef_Sprint.ats
@@ -8,12 +8,6 @@ workDefinition "WorkDef_Sprint" {
option REQUIRED_FOR_TRANSITION
}
- widgetDefinition "Holiday" {
- attributeName "ats.Holiday"
- description "Holidays during Agile Sprint"
- xWidgetName "XDateDam"
- }
-
widgetDefinition "Un-Planned Points" {
attributeName "ats.Un-Planned Points"
xWidgetName "XIntegerDam"
@@ -46,6 +40,10 @@ workDefinition "WorkDef_Sprint" {
xWidgetName "XRunSprintSummaryButton"
}
+ widgetDefinition "Open Sprint Burndown" {
+ xWidgetName "XOpenSprintBurndownButton"
+ }
+
state "Cancelled" {
type Cancelled
ordinal 3
@@ -64,11 +62,11 @@ workDefinition "WorkDef_Sprint" {
widget "End Date"
widget "Run Sprint Summary"
}
- widget "Holiday"
composite {
- numColumns 4
+ numColumns 6
widget "Planned Points"
widget "Un-Planned Points"
+ widget "Open Sprint Burndown"
}
widget "Title"
widget "Description"
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeResourceNameResolver.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeResourceNameResolver.java
index 30af01e3588..3c2033f8232 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeResourceNameResolver.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/attribute/AttributeResourceNameResolver.java
@@ -21,6 +21,7 @@ import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.orcs.core.ds.ResourceNameResolver;
+import org.eclipse.osee.orcs.core.internal.artifact.ArtifactImpl;
import org.eclipse.osee.orcs.data.AttributeTypes;
/**
@@ -63,7 +64,13 @@ public class AttributeResourceNameResolver implements ResourceNameResolver {
builder.append(getStorageName());
- String fileTypeExtension = getExtension(attribute);
+ String fileTypeExtension = null;
+ if (identity instanceof ArtifactImpl) {
+ fileTypeExtension = ((ArtifactImpl) identity).getSoleAttributeValue(CoreAttributeTypes.Extension, null);
+ }
+ if (!Strings.isValid(fileTypeExtension)) {
+ fileTypeExtension = getExtension(attribute);
+ }
if (Strings.isValid(fileTypeExtension)) {
builder.append(".");
builder.append(fileTypeExtension);

Back to the top