Browse Source

Improved code.

master
Christian P. MOMON 2 years ago
parent
commit
3f2a667040
  1. 73
      src/org/april/agirstatool/core/pages/ProjectsGroupedPageBuilder.java
  2. 97
      src/org/april/agirstatool/core/pages/ProjectsRawPageBuilder.java

73
src/org/april/agirstatool/core/pages/ProjectsGroupedPageBuilder.java

@ -54,7 +54,7 @@ public class ProjectsGroupedPageBuilder
try
{
System.out.println("Building welcome page (2)…");
System.out.println("Building ProjectsGrouped page…");
TagDataManager data = new TagDataManager();
int index = 0;
@ -62,22 +62,7 @@ public class ProjectsGroupedPageBuilder
{
if (project.getParentId() == null)
{
data.setContent("projectLine", index, "projectId", project.getId());
data.setAttribute("projectLine", index, "projectNameLink", "href", project.getPath());
data.setContent("projectLine", index, "projectNameLink", StringEscapeUtils.escapeXml(project.getName()));
data.setContent("projectLine", index, "childCount", project.getChildCount());
data.setContent("projectLine", index, "issueCount", project.issueStats().getCount());
data.setContent("projectLine", index, "activeIssueCount", project.issueStats().getActiveCount());
data.setContent("projectLine", index, "maybeIssueCount", project.issueStats().getMaybeCount());
data.setContent("projectLine", index, "resolvedIssueCount", project.issueStats().getResolvedCount());
data.setContent("projectLine", index, "concludedIssueCount", project.issueStats().getConcludedCount());
data.setContent("projectLine", index, "unassignedIssueCount", project.issueStats().getUnassignedCount());
data.setContent("projectLine", index, "unassignedNewIssueCount", project.issueStats().getUnassignedNewCount());
data.setContent("projectLine", index, "unassignedStartedIssueCount", project.issueStats().getUnassignedStartedCount());
data.setContent("projectLine", index, "unassignedResolvedIssueCount", project.issueStats().getUnassignedResolvedCount());
data.setContent("projectLine", index, "unassignedConcludedIssueCount", project.issueStats().getUnassignedConcludedCount());
data.setContent("projectLine", index, "lastUpdate", AgirStatoolUtils.toHumanShort(project.getLastUpdate(), "n/a"));
data.setAttribute("projectLine", index, "lastUpdate", "title", AgirStatoolUtils.toHumanLong(project.getLastUpdate(), "n/a"));
fillLine(data, index, project);
index += 1;
}
@ -85,23 +70,7 @@ public class ProjectsGroupedPageBuilder
{
for (Project subProject : project.subProjects())
{
data.setContent("projectLine", index, "projectId", subProject.getId());
data.setAttribute("projectLine", index, "projectName", "style", "padding-left: 25px;");
data.setAttribute("projectLine", index, "projectNameLink", "href", subProject.getPath());
data.setContent("projectLine", index, "projectNameLink", StringEscapeUtils.escapeXml(subProject.getName()));
data.setContent("projectLine", index, "childCount", subProject.getChildCount());
data.setContent("projectLine", index, "issueCount", subProject.issueStats().getCount());
data.setContent("projectLine", index, "activeIssueCount", subProject.issueStats().getActiveCount());
data.setContent("projectLine", index, "maybeIssueCount", subProject.issueStats().getMaybeCount());
data.setContent("projectLine", index, "resolvedIssueCount", subProject.issueStats().getResolvedCount());
data.setContent("projectLine", index, "concludedIssueCount", subProject.issueStats().getConcludedCount());
data.setContent("projectLine", index, "unassignedIssueCount", subProject.issueStats().getUnassignedCount());
data.setContent("projectLine", index, "unassignedNewIssueCount", subProject.issueStats().getUnassignedNewCount());
data.setContent("projectLine", index, "unassignedStartedIssueCount", subProject.issueStats().getUnassignedStartedCount());
data.setContent("projectLine", index, "unassignedResolvedIssueCount", subProject.issueStats().getUnassignedResolvedCount());
data.setContent("projectLine", index, "unassignedConcludedIssueCount", subProject.issueStats().getUnassignedConcludedCount());
data.setContent("projectLine", index, "lastUpdate", AgirStatoolUtils.toHumanShort(subProject.issueStats().getLastUpdate(), "n/a"));
data.setAttribute("projectLine", index, "lastUpdate", "title", AgirStatoolUtils.toHumanLong(subProject.issueStats().getLastUpdate(), "n/a"));
fillLine(data, index, subProject);
index += 1;
}
}
@ -111,10 +80,44 @@ public class ProjectsGroupedPageBuilder
}
catch (XidynException exception)
{
throw new AgirStatoolException("Error building welcome page: " + exception.getMessage(), exception);
throw new AgirStatoolException("Error building ProjectsGrouped page: " + exception.getMessage(), exception);
}
//
return result;
}
/**
* Fill line.
*
* @param data
* the data
* @param index
* the index
* @param project
* the project
*/
private static void fillLine(final TagDataManager data, final int index, final Project project)
{
data.setContent("projectLine", index, "projectId", project.getId());
if (project.getParentId() != null)
{
data.setAttribute("projectLine", index, "projectName", "style", "padding-left: 25px;");
}
data.setAttribute("projectLine", index, "projectNameLink", "href", project.getPath());
data.setContent("projectLine", index, "projectNameLink", StringEscapeUtils.escapeXml(project.getName()));
data.setContent("projectLine", index, "childCount", project.getChildCount());
data.setContent("projectLine", index, "issueCount", project.issueStats().getCount());
data.setContent("projectLine", index, "activeIssueCount", project.issueStats().getActiveCount());
data.setContent("projectLine", index, "maybeIssueCount", project.issueStats().getMaybeCount());
data.setContent("projectLine", index, "resolvedIssueCount", project.issueStats().getResolvedCount());
data.setContent("projectLine", index, "concludedIssueCount", project.issueStats().getConcludedCount());
data.setContent("projectLine", index, "unassignedIssueCount", project.issueStats().getUnassignedCount());
data.setContent("projectLine", index, "unassignedNewIssueCount", project.issueStats().getUnassignedNewCount());
data.setContent("projectLine", index, "unassignedStartedIssueCount", project.issueStats().getUnassignedStartedCount());
data.setContent("projectLine", index, "unassignedResolvedIssueCount", project.issueStats().getUnassignedResolvedCount());
data.setContent("projectLine", index, "unassignedConcludedIssueCount", project.issueStats().getUnassignedConcludedCount());
data.setContent("projectLine", index, "lastUpdate", AgirStatoolUtils.toHumanShort(project.getLastUpdate(), "n/a"));
data.setAttribute("projectLine", index, "lastUpdate", "title", AgirStatoolUtils.toHumanLong(project.getLastUpdate(), "n/a"));
}
}

97
src/org/april/agirstatool/core/pages/ProjectsRawPageBuilder.java

@ -52,7 +52,7 @@ public class ProjectsRawPageBuilder
try
{
System.out.println("Building welcome page…");
System.out.println("Building ProjectsRaw page…");
TagDataManager data = new TagDataManager();
int index = 0;
@ -60,30 +60,7 @@ public class ProjectsRawPageBuilder
{
if (project.getParentId() == null)
{
data.setContent("projectLine", index, "projectId", project.getId());
data.setAttribute("projectLine", index, "projectNameLink", "href", project.getPath());
data.setContent("projectLine", index, "projectNameLink", StringEscapeUtils.escapeXml(project.getName()));
data.setContent("projectLine", index, "childCount", project.getChildCount());
data.setContent("projectLine", index, "issueCount", project.issueStats().getCount());
data.setContent("projectLine", index, "newIssueCount", project.issueStats().getNewCount());
data.setContent("projectLine", index, "confirmedIssueCount", project.issueStats().getConfirmedCount());
data.setContent("projectLine", index, "ongoingIssueCount", project.issueStats().getOngoingCount());
data.setContent("projectLine", index, "waitingIssueCount", project.issueStats().getWaitingCount());
data.setContent("projectLine", index, "maybeIssueCount", project.issueStats().getMaybeCount());
data.setContent("projectLine", index, "resolvedIssueCount", project.issueStats().getResolvedCount());
data.setContent("projectLine", index, "rejectedIssueCount", project.issueStats().getRejectedCount());
data.setContent("projectLine", index, "closedIssueCount", project.issueStats().getClosedCount());
data.setContent("projectLine", index, "unassignedIssueCount", project.issueStats().getUnassignedCount());
data.setContent("projectLine", index, "unassignedNewIssueCount", project.issueStats().getUnassignedNewCount());
data.setContent("projectLine", index, "unassignedConfirmedIssueCount", project.issueStats().getUnassignedConfirmedCount());
data.setContent("projectLine", index, "unassignedOngoingIssueCount", project.issueStats().getUnassignedOngoingCount());
data.setContent("projectLine", index, "unassignedWaitingIssueCount", project.issueStats().getUnassignedWaitingCount());
data.setContent("projectLine", index, "unassignedMaybeIssueCount", project.issueStats().getUnassignedMaybeCount());
data.setContent("projectLine", index, "unassignedResolvedIssueCount", project.issueStats().getUnassignedResolvedCount());
data.setContent("projectLine", index, "unassignedRejectedIssueCount", project.issueStats().getUnassignedRejectedCount());
data.setContent("projectLine", index, "unassignedClosedIssueCount", project.issueStats().getUnassignedClosedCount());
data.setContent("projectLine", index, "lastUpdate", AgirStatoolUtils.toHumanShort(project.issueStats().getLastUpdate(), "n/a"));
data.setAttribute("projectLine", index, "lastUpdate", "title", AgirStatoolUtils.toHumanLong(project.issueStats().getLastUpdate(), "n/a"));
fillLine(data, index, project);
index += 1;
}
@ -91,31 +68,7 @@ public class ProjectsRawPageBuilder
{
for (Project subProject : project.subProjects())
{
data.setContent("projectLine", index, "projectId", subProject.getId());
data.setAttribute("projectLine", index, "projectName", "style", "padding-left: 25px;");
data.setAttribute("projectLine", index, "projectNameLink", "href", subProject.getPath());
data.setContent("projectLine", index, "projectNameLink", StringEscapeUtils.escapeXml(subProject.getName()));
data.setContent("projectLine", index, "childCount", subProject.getChildCount());
data.setContent("projectLine", index, "issueCount", subProject.issueStats().getCount());
data.setContent("projectLine", index, "newIssueCount", subProject.issueStats().getNewCount());
data.setContent("projectLine", index, "confirmedIssueCount", subProject.issueStats().getConfirmedCount());
data.setContent("projectLine", index, "ongoingIssueCount", subProject.issueStats().getOngoingCount());
data.setContent("projectLine", index, "waitingIssueCount", subProject.issueStats().getWaitingCount());
data.setContent("projectLine", index, "maybeIssueCount", subProject.issueStats().getMaybeCount());
data.setContent("projectLine", index, "resolvedIssueCount", subProject.issueStats().getResolvedCount());
data.setContent("projectLine", index, "rejectedIssueCount", subProject.issueStats().getRejectedCount());
data.setContent("projectLine", index, "closedIssueCount", subProject.issueStats().getClosedCount());
data.setContent("projectLine", index, "unassignedIssueCount", subProject.issueStats().getUnassignedCount());
data.setContent("projectLine", index, "unassignedNewIssueCount", subProject.issueStats().getUnassignedNewCount());
data.setContent("projectLine", index, "unassignedConfirmedIssueCount", subProject.issueStats().getUnassignedConfirmedCount());
data.setContent("projectLine", index, "unassignedOngoingIssueCount", subProject.issueStats().getUnassignedOngoingCount());
data.setContent("projectLine", index, "unassignedWaitingIssueCount", subProject.issueStats().getUnassignedWaitingCount());
data.setContent("projectLine", index, "unassignedMaybeIssueCount", subProject.issueStats().getUnassignedMaybeCount());
data.setContent("projectLine", index, "unassignedResolvedIssueCount", subProject.issueStats().getUnassignedResolvedCount());
data.setContent("projectLine", index, "unassignedRejectedIssueCount", subProject.issueStats().getUnassignedRejectedCount());
data.setContent("projectLine", index, "unassignedClosedIssueCount", subProject.issueStats().getUnassignedClosedCount());
data.setContent("projectLine", index, "lastUpdate", AgirStatoolUtils.toHumanShort(subProject.issueStats().getLastUpdate(), "n/a"));
data.setAttribute("projectLine", index, "lastUpdate", "title", AgirStatoolUtils.toHumanLong(subProject.issueStats().getLastUpdate(), "n/a"));
fillLine(data, index, subProject);
index += 1;
}
}
@ -125,10 +78,52 @@ public class ProjectsRawPageBuilder
}
catch (XidynException exception)
{
throw new AgirStatoolException("Error building welcome page: " + exception.getMessage(), exception);
throw new AgirStatoolException("Error building ProjectsRaw page: " + exception.getMessage(), exception);
}
//
return result;
}
/**
* Fill line.
*
* @param data
* the data
* @param index
* the index
* @param project
* the project
*/
private static void fillLine(final TagDataManager data, final int index, final Project project)
{
data.setContent("projectLine", index, "projectId", project.getId());
if (project.getParentId() != null)
{
data.setAttribute("projectLine", index, "projectName", "style", "padding-left: 25px;");
}
data.setAttribute("projectLine", index, "projectNameLink", "href", project.getPath());
data.setContent("projectLine", index, "projectNameLink", StringEscapeUtils.escapeXml(project.getName()));
data.setContent("projectLine", index, "childCount", project.getChildCount());
data.setContent("projectLine", index, "issueCount", project.issueStats().getCount());
data.setContent("projectLine", index, "newIssueCount", project.issueStats().getNewCount());
data.setContent("projectLine", index, "confirmedIssueCount", project.issueStats().getConfirmedCount());
data.setContent("projectLine", index, "ongoingIssueCount", project.issueStats().getOngoingCount());
data.setContent("projectLine", index, "waitingIssueCount", project.issueStats().getWaitingCount());
data.setContent("projectLine", index, "maybeIssueCount", project.issueStats().getMaybeCount());
data.setContent("projectLine", index, "resolvedIssueCount", project.issueStats().getResolvedCount());
data.setContent("projectLine", index, "rejectedIssueCount", project.issueStats().getRejectedCount());
data.setContent("projectLine", index, "closedIssueCount", project.issueStats().getClosedCount());
data.setContent("projectLine", index, "unassignedIssueCount", project.issueStats().getUnassignedCount());
data.setContent("projectLine", index, "unassignedNewIssueCount", project.issueStats().getUnassignedNewCount());
data.setContent("projectLine", index, "unassignedConfirmedIssueCount", project.issueStats().getUnassignedConfirmedCount());
data.setContent("projectLine", index, "unassignedOngoingIssueCount", project.issueStats().getUnassignedOngoingCount());
data.setContent("projectLine", index, "unassignedWaitingIssueCount", project.issueStats().getUnassignedWaitingCount());
data.setContent("projectLine", index, "unassignedMaybeIssueCount", project.issueStats().getUnassignedMaybeCount());
data.setContent("projectLine", index, "unassignedResolvedIssueCount", project.issueStats().getUnassignedResolvedCount());
data.setContent("projectLine", index, "unassignedRejectedIssueCount", project.issueStats().getUnassignedRejectedCount());
data.setContent("projectLine", index, "unassignedClosedIssueCount", project.issueStats().getUnassignedClosedCount());
data.setContent("projectLine", index, "lastUpdate", AgirStatoolUtils.toHumanShort(project.issueStats().getLastUpdate(), "n/a"));
data.setAttribute("projectLine", index, "lastUpdate", "title", AgirStatoolUtils.toHumanLong(project.issueStats().getLastUpdate(), "n/a"));
}
}

Loading…
Cancel
Save