diff options
author | donald.g.dunne | 2014-08-21 16:56:03 +0000 |
---|---|---|
committer | Roberto E. Escobar | 2014-08-28 23:59:57 +0000 |
commit | 713ca12c8f41ca2736aab3aa9032e7acd8b37462 (patch) | |
tree | 224451ee0d3531792cde24d4626ad215eca26df0 | |
parent | e38ddcef8db4fda8d95d0787e39fa1f380869ba1 (diff) | |
download | org.eclipse.osee-713ca12c8f41ca2736aab3aa9032e7acd8b37462.tar.gz org.eclipse.osee-713ca12c8f41ca2736aab3aa9032e7acd8b37462.tar.xz org.eclipse.osee-713ca12c8f41ca2736aab3aa9032e7acd8b37462.zip |
feature[ats_ATS64164]: CPA: Cleanup ActionPage layout0.18.0.v201408290100_RC
Change-Id: I821832f6868a43ec52208fd35d03b02ed7425a86
11 files changed, 236 insertions, 55 deletions
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/IAtsServer.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/IAtsServer.java index a5995792463..8e7b53c1684 100644 --- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/IAtsServer.java +++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/IAtsServer.java @@ -84,4 +84,6 @@ public interface IAtsServer extends IAtsConfigItemFactoryProvider, IAtsConfigPro ArtifactReadable getActionById(String id); + String getConfigValue(String key); + }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/action/IWorkItemPage.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/action/IWorkItemPage.java index 6695720dd4d..f4fb2fcf960 100644 --- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/action/IWorkItemPage.java +++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/action/IWorkItemPage.java @@ -18,8 +18,8 @@ import org.eclipse.osee.orcs.data.ArtifactReadable; */ public interface IWorkItemPage { - String getHtml(ArtifactReadable action, String title, IResourceRegistry registry) throws Exception; + String getHtml(ArtifactReadable action, String title, IResourceRegistry registry, boolean details) throws Exception; - String getHtmlWithTransition(ArtifactReadable action, String title, IResourceRegistry registry) throws Exception; + String getHtmlWithTransition(ArtifactReadable action, String title, IResourceRegistry registry, boolean details) throws Exception; }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/AtsServerImpl.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/AtsServerImpl.java index 4ef1afc4326..efb7c8df06b 100644 --- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/AtsServerImpl.java +++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/AtsServerImpl.java @@ -12,6 +12,7 @@ package org.eclipse.osee.ats.impl.internal; import java.util.List; import org.eclipse.osee.ats.api.IAtsObject; +import org.eclipse.osee.ats.api.data.AtsArtifactToken; import org.eclipse.osee.ats.api.notify.IAtsNotificationService; import org.eclipse.osee.ats.api.review.IAtsReviewService; import org.eclipse.osee.ats.api.team.IAtsConfigItemFactory; @@ -51,6 +52,8 @@ import org.eclipse.osee.ats.impl.internal.workitem.AtsWorkItemServiceImpl; import org.eclipse.osee.ats.impl.internal.workitem.ConfigItemFactory; import org.eclipse.osee.ats.impl.internal.workitem.WorkItemFactory; import org.eclipse.osee.ats.impl.internal.workitem.WorkItemPage; +import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; +import org.eclipse.osee.framework.core.enums.CoreBranches; import org.eclipse.osee.framework.database.IOseeDatabaseService; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.type.OseeStateException; @@ -304,4 +307,22 @@ public class AtsServerImpl implements IAtsServer { return action; } + @Override + public String getConfigValue(String key) { + String result = null; + @SuppressWarnings("unchecked") + ArtifactReadable atsConfig = + orcsApi.getQueryFactory(null).fromBranch(CoreBranches.COMMON).andIds(AtsArtifactToken.AtsConfig).getResults().getExactlyOne(); + if (atsConfig != null) { + for (Object obj : atsConfig.getAttributeValues(CoreAttributeTypes.GeneralStringData)) { + String str = (String) obj; + if (str.startsWith(key)) { + result = str.replaceFirst(key + "=", ""); + break; + } + } + } + return result; + } + } diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/ActionPage.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/ActionPage.java index fac5bb962dc..43ff5088d3b 100644 --- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/ActionPage.java +++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/ActionPage.java @@ -11,10 +11,15 @@ package org.eclipse.osee.ats.impl.internal.workitem; import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; +import java.util.Date; import java.util.List; import org.eclipse.osee.ats.api.IAtsWorkItem; +import org.eclipse.osee.ats.api.data.AtsArtifactTypes; import org.eclipse.osee.ats.api.data.AtsAttributeTypes; +import org.eclipse.osee.ats.api.data.AtsRelationTypes; import org.eclipse.osee.ats.api.workdef.IAtsCompositeLayoutItem; import org.eclipse.osee.ats.api.workdef.IAtsLayoutItem; import org.eclipse.osee.ats.api.workdef.IAtsStateDefinition; @@ -24,10 +29,13 @@ import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow; import org.eclipse.osee.ats.impl.IAtsServer; import org.eclipse.osee.ats.impl.resource.AtsResourceTokens; import org.eclipse.osee.framework.core.data.IAttributeType; +import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.jdk.core.type.IResourceRegistry; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.AHTML; +import org.eclipse.osee.framework.jdk.core.util.AXml; import org.eclipse.osee.framework.jdk.core.util.Conditions; +import org.eclipse.osee.framework.jdk.core.util.DateUtil; import org.eclipse.osee.framework.jdk.core.util.Lib; import org.eclipse.osee.framework.jdk.core.util.Strings; import org.eclipse.osee.logger.Log; @@ -42,6 +50,13 @@ import org.eclipse.osee.template.engine.StringOptionsRule; */ public class ActionPage { + private static final String DEFECT_TABLE_HEADER = + "<table border=\"1\" align=\"center\" width=\"98%\"><tr><th>Severity</th><th>Disposition</th><th>Closed</th><th>User</th><th>Created</th><th>Injected</th><th>Description</th><th>Location</th><th>Resolution</th></tr>"; + private static final String ROLE_TABLE_HEADER = + "<table border=\"1\" align=\"center\" width=\"90%\"><tr><th>Role</th><th>User</th><th>Completed</th><th>Hours Spent</th></tr>"; + private static final String COMMIT_MANAGER_WIDGET_NAME = "Commit Manager"; + private static final String REVIEW_DEFECT_WIDGET_NAME = "Review Defect"; + private static final String ROLE_WIDGET_NAME = "Role"; private String pageTemplate; private PageCreator page; private IAtsWorkItem workItem; @@ -51,13 +66,19 @@ public class ActionPage { private final IAtsServer atsServer; private final Log logger; private boolean addTransition = false; + private static final List<String> roleKeys = Arrays.asList("role", "userId", "completed", "hoursSpent"); + private static final List<String> defectKeys = Arrays.asList("severity", "disposition", "closed", "user", "date", + "injectionActivity", "description", "location", "resolution"); + private static List<String> ignoredWidgets; + private final boolean details; - public ActionPage(Log logger, IAtsServer atsServer, IResourceRegistry registry, ArtifactReadable action, String title) { + public ActionPage(Log logger, IAtsServer atsServer, IResourceRegistry registry, ArtifactReadable action, String title, boolean details) { this.logger = logger; this.atsServer = atsServer; this.registry = registry; this.action = action; this.title = title; + this.details = details; } private IAtsWorkItem getWorkItem() { @@ -102,7 +123,7 @@ public class ActionPage { } addStates(page, workItem, action); - addDebug(page, workItem, action); + addDetails(page, workItem, action); return page.realizePage(AtsResourceTokens.AtsActionHtml); } @@ -116,15 +137,40 @@ public class ActionPage { } private String getTeamStr(ArtifactReadable action) { - String results = action.getSoleAttributeAsString(AtsAttributeTypes.TeamDefinition); - results = atsServer.getArtifactByGuid(results).getName(); + String results = action.getSoleAttributeAsString(AtsAttributeTypes.TeamDefinition, ""); + if (Strings.isValid(results)) { + results = atsServer.getArtifactByGuid(results).getName(); + } else { + ArtifactReadable teamWf = getParentTeamWf(action); + if (teamWf != null) { + results = getTeamStr(teamWf); + } + } return results; } + private ArtifactReadable getParentTeamWf(ArtifactReadable action2) { + ArtifactReadable teamWf = null; + if (action.isOfType(AtsArtifactTypes.TeamWorkflow)) { + teamWf = action; + } else if (action.isOfType(AtsArtifactTypes.ReviewArtifact)) { + teamWf = action.getRelated(AtsRelationTypes.TeamWorkflowToReview_Team).getOneOrNull(); + } else if (action.isOfType(AtsArtifactTypes.Task)) { + teamWf = action.getRelated(AtsRelationTypes.TeamWfToTask_TeamWf).getOneOrNull(); + } + return teamWf; + } + private String getAIStr(ArtifactReadable action) { - String results = action.getSoleAttributeAsString(AtsAttributeTypes.ActionableItem); - results = atsServer.getArtifactByGuid(results).getName(); - return results; + StringBuilder sb = new StringBuilder(); + ArtifactReadable teamWf = getParentTeamWf(action); + if (teamWf != null) { + for (AttributeReadable<Object> aiGuid : teamWf.getAttributes(AtsAttributeTypes.ActionableItem)) { + sb.append(atsServer.getArtifactByGuid(aiGuid.toString()).getName()); + sb.append(", "); + } + } + return sb.toString().replaceFirst(", $", ""); } private String getCreatedByStr(IAtsWorkItem workItem, ArtifactReadable action) { @@ -199,22 +245,118 @@ public class ActionPage { addLayoutItems(sb, workItem, items); } + private boolean inComposite = false; + private void addLayoutItems(StringBuilder sb, IAtsWorkItem workItem, Collection<IAtsLayoutItem> items) { for (IAtsLayoutItem layout : items) { if (layout instanceof IAtsCompositeLayoutItem) { + inComposite = true; + sb.append("<tr><td><table width=\"100%\"><tr>"); addWidgets(sb, workItem, ((IAtsCompositeLayoutItem) layout).getaLayoutItems()); + sb.append("</tr></table></td></tr>"); + inComposite = false; } else { - addWidget(sb, workItem, (IAtsWidgetDefinition) layout); + IAtsWidgetDefinition widget = (IAtsWidgetDefinition) layout; + if (!getIgnoreWidgetNames().contains(widget.getName())) { + if (!inComposite) { + sb.append("<tr><td>"); + } else { + sb.append("<td>"); + } + addWidget(sb, workItem, widget); + if (!inComposite) { + sb.append("</td></tr>"); + } else { + sb.append("</td>"); + } + } + } + } + } + + private void addWidget(StringBuilder sb, IAtsWorkItem workItem, IAtsWidgetDefinition widget) { + if (widget.getName().equals(ROLE_WIDGET_NAME)) { + addRoleWidget(sb, workItem, widget); + } else if (widget.getName().equals(REVIEW_DEFECT_WIDGET_NAME)) { + addDefectWidget(sb, workItem, widget); + } else if (widget.getName().equals(COMMIT_MANAGER_WIDGET_NAME)) { + addCommitManager(sb, workItem, widget); + } else { + addWidgetDefault(sb, workItem, widget); + } + } + + private void addCommitManager(StringBuilder sb, IAtsWorkItem workItem2, IAtsWidgetDefinition widget) { + sb.append("Commit Manager: "); + IOseeBranch branch = atsServer.getBranchService().getBranch((IAtsTeamWorkflow) workItem); + if (branch != null) { + sb.append(branch.getName()); + } + } + + private List<String> getIgnoreWidgetNames() { + if (ignoredWidgets == null) { + ignoredWidgets = new ArrayList<String>(); + for (String widgetName : atsServer.getConfigValue("IgnoredWidgetNames").split(";")) { + ignoredWidgets.add(widgetName); + } + } + return ignoredWidgets; + } + + private void addRoleWidget(StringBuilder sb, IAtsWorkItem workItem, IAtsWidgetDefinition widget) { + sb.append("Roles: "); + Collection<String> roles = + atsServer.getAttributeResolver().getAttributesToStringList(workItem, AtsAttributeTypes.Role); + if (!roles.isEmpty()) { + sb.append(ROLE_TABLE_HEADER); + for (String xml : roles) { + sb.append("<tr>"); + for (String key : roleKeys) { + sb.append("<td>"); + String data = AXml.getTagData(xml, key); + if (key.equals("userId")) { + data = atsServer.getUserService().getUserById(data).getName(); + } + sb.append(data); + sb.append("</td>"); + } + sb.append("</tr>"); } + sb.append("</table>"); } } - private void addWidget(StringBuilder sb, IAtsWorkItem workItem, IAtsWidgetDefinition layout) { - sb.append("<tr><td>"); - sb.append(layout.getName()); + private void addDefectWidget(StringBuilder sb, IAtsWorkItem workItem, IAtsWidgetDefinition widget) { + sb.append("Defects: "); + Collection<String> defects = + atsServer.getAttributeResolver().getAttributesToStringList(workItem, AtsAttributeTypes.ReviewDefect); + if (!defects.isEmpty()) { + sb.append(DEFECT_TABLE_HEADER); + for (String xml : defects) { + sb.append("<tr>"); + for (String key : defectKeys) { + sb.append("<td>"); + String data = AXml.getTagData(xml, key); + if (key.equals("user")) { + data = atsServer.getUserService().getUserById(data).getName(); + } else if (key.equals("date")) { + data = DateUtil.getDateStr(new Date(Long.valueOf(data)), DateUtil.MMDDYYHHMM); + } + sb.append(data); + sb.append("</td>"); + } + sb.append("</tr>"); + } + sb.append("</table>"); + } + } + + private void addWidgetDefault(StringBuilder sb, IAtsWorkItem workItem, IAtsWidgetDefinition widget) { + sb.append(widget.getName()); sb.append(": <b>"); try { - IAttributeType attributeType = atsServer.getAttributeResolver().getAttributeType(layout.getAtrributeName()); + IAttributeType attributeType = atsServer.getAttributeResolver().getAttributeType(widget.getAtrributeName()); Collection<String> attributesToStringList = atsServer.getAttributeResolver().getAttributesToStringList(workItem, attributeType); if (attributesToStringList.size() > 1) { @@ -225,7 +367,7 @@ public class ActionPage { } catch (OseeCoreException ex) { sb.append("exception: " + ex.getLocalizedMessage()); } - sb.append("</b></td></tr>"); + sb.append("</b>"); } private String getStateHtmlTemplate() throws IOException { @@ -235,17 +377,28 @@ public class ActionPage { return pageTemplate; } - private static void addDebug(PageCreator page, IAtsWorkItem workItem, ArtifactReadable artifact) { + private void addDetails(PageCreator page, IAtsWorkItem workItem, ArtifactReadable artifact) { StringBuilder sb = new StringBuilder(); - try { - for (AttributeReadable<?> attr : artifact.getAttributes()) { - sb.append(String.format("%s [%s]\n", attr.getAttributeType(), - AHTML.textToHtml(String.valueOf(attr.getValue())))); + if (details) { + try { + addDetail(sb, "Guid", artifact.getGuid()); + addDetail(sb, "Artifact Type", artifact.getArtifactType().getName()); + sb.append("</br><b>Attribute Raw Data:</b></br>"); + for (AttributeReadable<?> attr : artifact.getAttributes()) { + addDetail(sb, attr.getAttributeType().getName(), AHTML.textToHtml(String.valueOf(attr.getValue()))); + } + } catch (OseeCoreException ex) { + sb.append("exception: " + ex.getLocalizedMessage()); } - } catch (OseeCoreException ex) { - sb.append("exception: " + ex.getLocalizedMessage()); } - page.addKeyValuePair("debug", sb.toString()); + page.addKeyValuePair("details", sb.toString()); + } + + private static void addDetail(StringBuilder sb, String key, String value) { + sb.append(key); + sb.append(": <b>"); + sb.append(value); + sb.append("</b></br>"); } public boolean isAddTransition() { diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/AtsWorkItemServiceImpl.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/AtsWorkItemServiceImpl.java index c0d8d6275fb..349cf25afae 100644 --- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/AtsWorkItemServiceImpl.java +++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/AtsWorkItemServiceImpl.java @@ -68,7 +68,7 @@ public class AtsWorkItemServiceImpl implements IAtsWorkItemService { @Override public IAtsTeamWorkflow getParentTeamWorkflow(IAtsWorkItem workItem) throws OseeCoreException { - return workItemFactory.getWorkItem(workItem).getParentTeamWorkflow(); + return workItem.getParentTeamWorkflow(); } @Override diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/WorkItemPage.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/WorkItemPage.java index 470c9e97871..51b7a3b327c 100644 --- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/WorkItemPage.java +++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/workitem/WorkItemPage.java @@ -30,14 +30,14 @@ public class WorkItemPage implements IWorkItemPage { } @Override - public String getHtml(ArtifactReadable action, String title, IResourceRegistry registry) throws Exception { - ActionPage page = new ActionPage(logger, atsServer, registry, action, title); + public String getHtml(ArtifactReadable action, String title, IResourceRegistry registry, boolean details) throws Exception { + ActionPage page = new ActionPage(logger, atsServer, registry, action, title, details); return page.generate(); } @Override - public String getHtmlWithTransition(ArtifactReadable action, String title, IResourceRegistry registry) throws Exception { - ActionPage page = new ActionPage(logger, atsServer, registry, action, title); + public String getHtmlWithTransition(ArtifactReadable action, String title, IResourceRegistry registry, boolean details) throws Exception { + ActionPage page = new ActionPage(logger, atsServer, registry, action, title, details); page.addTransitionStates(); return page.generate(); } diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/resource/html/atsAction.html b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/resource/html/atsAction.html index 6b336b10eab..0c76f6e9e16 100644 --- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/resource/html/atsAction.html +++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/resource/html/atsAction.html @@ -12,7 +12,7 @@ <div class="container"> <div><h2>ATS - <?atsId?></h2><div> -<table border="1" cellpadding="3" cellspacing="0" width="100%" class="table table-striped"> +<table border="2" cellpadding="3" cellspacing="0" width="100%" class="table table-striped"> <tr> <td colspan="3">Title: <b><?title?></b></td> </tr> @@ -25,13 +25,12 @@ <tr> <td>Team: <b><?team?></b></td> - <td>Id: <b><?id?></b></td> + <td>Targeted Version: <b><?version?></b></td> <td>ATS Id: <b><?atsId?></b></td> </tr> <tr> - <td>Targeted Version: <b><?version?></b></td> - <td colspan="2">Assignees: <b><?assignees?></b></td> + <td colspan="3">Assignees: <b><?assignees?></b></td> </tr> <tr> @@ -53,11 +52,12 @@ <?transition?> </div> -<table border="1" cellpadding="3" cellspacing="0" width="100%"> +<table cellpadding="3" cellspacing="0" width="100%"> <tr><td> <?states?> </td></tr> </table> +<?details?> </body> </html>
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/resource/html/atsState.html b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/resource/html/atsState.html index 7ba5a685a60..e10462ad77f 100644 --- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/resource/html/atsState.html +++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/resource/html/atsState.html @@ -1,6 +1,6 @@ -<table border="1" align="center" bgcolor="#FFFFF0" cellpadding="3" cellspacing="0" width="95%" class="table table-striped"> +<table border="2" align="center" cellpadding="3" cellspacing="0" width="95%" class="table table-striped"> <tr><td align="center" colspan="3">TITLE</td></tr> - <tr><td>WIDGETS</td></tr> + WIDGETS </table> </br> diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/resource/html/atsWidget.html b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/resource/html/atsWidget.html deleted file mode 100644 index 0eb5f1ef90e..00000000000 --- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/resource/html/atsWidget.html +++ /dev/null @@ -1,4 +0,0 @@ - -<table width="95%"> - WIDGETS -</table> diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/resources/ActionResource.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/resources/ActionResource.java index 66eed7955e7..7f4fc16805e 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/resources/ActionResource.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/resources/ActionResource.java @@ -78,7 +78,25 @@ public final class ActionResource { @Produces(MediaType.TEXT_HTML) public String getAction(@PathParam("id") String id) throws Exception { ArtifactReadable action = AtsServerService.get().getActionById(id); - return atsServer.getWorkItemPage().getHtml(action, "Action - " + id, resourceRegistry); + if (action == null) { + return AHTML.simplePage(String.format("Action with id [%s] can not be found", id)); + } + return atsServer.getWorkItemPage().getHtml(action, "Action - " + id, resourceRegistry, false); + } + + /** + * @param id (guid, atsId) of action to display + * @return html representation of the action + */ + @Path("{id}/details") + @GET + @Produces(MediaType.TEXT_HTML) + public String getActionWithDetails(@PathParam("id") String id) throws Exception { + ArtifactReadable action = AtsServerService.get().getActionById(id); + if (action == null) { + return AHTML.simplePage(String.format("Action with id [%s] can not be found", id)); + } + return atsServer.getWorkItemPage().getHtml(action, "Action - " + id, resourceRegistry, true); } /** @@ -139,7 +157,7 @@ public final class ActionResource { htmlStr = atsServer.getWorkItemPage().getHtml( ((ArtifactReadable) action.getTeamWorkflows().iterator().next().getStoreObject()), - "Action Created - " + action.getGuid(), resourceRegistry); + "Action Created - " + action.getGuid(), resourceRegistry, false); } return Response.status(200).entity(htmlStr).build(); @@ -154,7 +172,7 @@ public final class ActionResource { if (action != null) { IAtsWorkItem workItem = atsServer.getWorkItemFactory().getWorkItem(action); if (workItem != null) { - results = atsServer.getWorkItemPage().getHtml(action, "Action - " + searchId, resourceRegistry); + results = atsServer.getWorkItemPage().getHtml(action, "Action - " + searchId, resourceRegistry, false); } else { results = AHTML.simplePage(String.format("Undisplayable %s", action)); } @@ -167,7 +185,7 @@ public final class ActionResource { if (legacyQueryResults.size() == 1) { results = atsServer.getWorkItemPage().getHtml(legacyQueryResults.getExactlyOne(), "Action - " + searchId, - resourceRegistry); + resourceRegistry, false); break; } else if (legacyQueryResults.size() > 1) { results = getGuidListHtml(legacyQueryResults); diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/resources/StateResource.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/resources/StateResource.java index 117733e711a..ace59577204 100644 --- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/resources/StateResource.java +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/resources/StateResource.java @@ -56,16 +56,6 @@ public final class StateResource { } /** - * @return html representation of action with states - */ - @GET - @Produces(MediaType.TEXT_HTML) - public String getStates() throws Exception { - ArtifactReadable action = atsServer.getArtifactByGuid(guid); - return atsServer.getWorkItemPage().getHtml(action, "Action - " + guid, resourceRegistry); - } - - /** * @param id * @return html representation w/ transition ui */ @@ -74,7 +64,7 @@ public final class StateResource { @Produces(MediaType.TEXT_HTML) public String getTransition() throws Exception { ArtifactReadable action = AtsServerService.get().getActionById(guid); - return atsServer.getWorkItemPage().getHtmlWithTransition(action, "Action - " + guid, resourceRegistry); + return atsServer.getWorkItemPage().getHtmlWithTransition(action, "Action - " + guid, resourceRegistry, false); } /** @@ -131,7 +121,8 @@ public final class StateResource { // reload before display action = atsServer.getArtifactByGuid(guid); htmlStr = - atsServer.getWorkItemPage().getHtml(action, "Action Transitioned - " + action.getGuid(), resourceRegistry); + atsServer.getWorkItemPage().getHtml(action, "Action Transitioned - " + action.getGuid(), resourceRegistry, + false); } else { throw new OseeCoreException("Unhandled operation [%s]", operation); } |