Author: adamw Date: 2005-08-27 13:52:21 -0400 (Sat, 27 Aug 2005) New Revision: 993 Modified: trunk/jira-extensions/changelog-report/src/etc/atlassian-plugin.xml trunk/jira-extensions/changelog-report/src/etc/pl/net/mamut/jira/changelog_report.properties trunk/jira-extensions/changelog-report/src/java/pl/net/mamut/jira/ChangelogGlobalReport.java trunk/jira-extensions/developer-issues-report/src/java/pl/net/mamut/jira/DeveloperIssuesReport.java trunk/jira-extensions/developersinvolvement-report/src/java/pl/net/mamut/jira/DevelopersInvolvementReport.java trunk/jira-extensions/issuesclosed-report/src/java/pl/net/mamut/jira/IssuesClosedReport.java trunk/jira-extensions/jira-file-modifications/jira-3.3/edit-webapp/includes/navigator/table/header.jsp trunk/jira-extensions/jira-file-modifications/jira-3.3/edit-webapp/secure/views/navigator/rnotes.jsp trunk/jira-extensions/junit-tests-adamw/src/java/pl/net/mamut/jira/AbstractJiraTest.java trunk/jira-extensions/junit-tests-adamw/src/java/pl/net/mamut/jira/ReleaseNotesReportTest.java trunk/jira-extensions/junit-tests-adamw/src/java/pl/net/mamut/jira/UnreleasedProjectVersionsReportTest.java trunk/jira-extensions/junit-tests-adamw/src/java/pl/net/mamut/jira/VotingExtensionsTest.java trunk/jira-extensions/releasenotes-affect-report/src/java/pl/net/mamut/jira/ReleaseNotesAffectReport.java trunk/jira-extensions/releasenotes-report/src/java/pl/net/mamut/ReleaseNotesReport.java trunk/jira-extensions/roadmap-report/src/etc/atlassian-plugin.xml trunk/jira-extensions/roadmap-report/src/etc/pl/net/mamut/jira/roadmap_report.properties trunk/jira-extensions/roadmap-report/src/java/pl/net/mamut/jira/RoadmapGlobalReport.java Log: jira 3.3 compatibility & fixes Modified: trunk/jira-extensions/changelog-report/src/etc/atlassian-plugin.xml =================================================================== --- trunk/jira-extensions/changelog-report/src/etc/atlassian-plugin.xml 2005-08-27 09:55:01 UTC (rev 992) +++ trunk/jira-extensions/changelog-report/src/etc/atlassian-plugin.xml 2005-08-27 17:52:21 UTC (rev 993) @@ -1,12 +1,12 @@ <atlassian-plugin key="pl.net.mamut.jira.changelogreport" name="Released project versions report"> <plugin-info> - <description>A seleased project versions global report plugin.</description> + <description>Released project versions global report plugin.</description> <version>1.0</version> <application-version min="3.0" max="3.0"/> <vendor name="Adam Warski" url="http://mamut.net.pl/"/> </plugin-info> - <report-global key="changelog" name="Released project versions report" class="pl.net.mamut.jira.ChangelogGlobalReport"> + <report-global key="changelog" name="Project changelog report" class="pl.net.mamut.jira.ChangelogGlobalReport"> <description key="report.changelog.description">i18n description</description> <label key="report.changelog.label" /> Modified: trunk/jira-extensions/changelog-report/src/etc/pl/net/mamut/jira/changelog_report.properties =================================================================== --- trunk/jira-extensions/changelog-report/src/etc/pl/net/mamut/jira/changelog_report.properties 2005-08-27 09:55:01 UTC (rev 992) +++ trunk/jira-extensions/changelog-report/src/etc/pl/net/mamut/jira/changelog_report.properties 2005-08-27 17:52:21 UTC (rev 993) @@ -1,5 +1,5 @@ -report.changelog.label = Released project versions report -report.changelog.name = Released project versions report +report.changelog.label = Project changelog report +report.changelog.name = Project changelog report report.changelog.description = Generates a changelog-like view of released versions of selected projects, for a given period of time, including selected issue types and priorities. report.changelog.projects.name = Projects report.changelog.projects.description = Select projects which you want to include in the report. Modified: trunk/jira-extensions/changelog-report/src/java/pl/net/mamut/jira/ChangelogGlobalReport.java =================================================================== --- trunk/jira-extensions/changelog-report/src/java/pl/net/mamut/jira/ChangelogGlobalReport.java 2005-08-27 09:55:01 UTC (rev 992) +++ trunk/jira-extensions/changelog-report/src/java/pl/net/mamut/jira/ChangelogGlobalReport.java 2005-08-27 17:52:21 UTC (rev 993) @@ -5,7 +5,10 @@ package pl.net.mamut.jira; import com.atlassian.jira.config.ConstantsManager; +import com.atlassian.jira.config.SubTaskManager; import com.atlassian.jira.config.properties.ApplicationProperties; +import com.atlassian.jira.issue.IssueImpl; +import com.atlassian.jira.issue.IssueManager; import com.atlassian.jira.issue.search.SearchException; import com.atlassian.jira.issue.search.SearchProvider; import com.atlassian.jira.issue.search.SearchRequest; @@ -13,6 +16,7 @@ import com.atlassian.jira.issue.search.parameters.lucene.IssueTypeParameter; import com.atlassian.jira.issue.search.parameters.lucene.PriorityParameter; import com.atlassian.jira.issue.search.parameters.lucene.ProjectParameter; +import com.atlassian.jira.issue.security.IssueSecurityLevelManager; import com.atlassian.jira.plugin.globalreport.impl.AbstractGlobalReport; import com.atlassian.jira.plugin.report.ReportModuleDescriptor; import com.atlassian.jira.project.ProjectManager; @@ -43,17 +47,25 @@ private final OutlookDateManager outlookDateManager; private final ProjectManager projectManager; private final VersionManager versionManager; + private final IssueManager issueManager; + private final SubTaskManager subTaskManager; + private final IssueSecurityLevelManager issueSecurityLevelManager; public ChangelogGlobalReport(OutlookDateManager outlookDateManager, ApplicationProperties appProps, ConstantsManager constantsManager, SearchProvider searchProvider, - ProjectManager projectManager, VersionManager versionManager) + ProjectManager projectManager, VersionManager versionManager, + IssueManager issueManager, SubTaskManager subTaskManager, + IssueSecurityLevelManager issueSecurityLevelManager) { this.outlookDateManager = outlookDateManager; this.searchProvider = searchProvider; this.constantsManager = constantsManager; this.appProps = appProps; this.projectManager = projectManager; - this.versionManager = versionManager; + this.versionManager = versionManager; + this.issueManager = issueManager; + this.subTaskManager = subTaskManager; + this.issueSecurityLevelManager = issueSecurityLevelManager; } /** @@ -75,7 +87,19 @@ sr.addParameter(new IssueTypeParameter(sections)); sr.addParameter(new PriorityParameter(priorities)); sr.addParameter(new ProjectParameter(projectId)); - return searchProvider.search(sr, remoteUser); + + // Converting the list of issues represented by generic values + // to a list of wrappers. + List gvIssues = searchProvider.search(sr, remoteUser); + List wrIssues = new ArrayList(); + + for (Iterator iter = gvIssues.iterator(); iter.hasNext();) + wrIssues.add(new IssueImpl((GenericValue) iter.next(), + issueManager, projectManager, versionManager, + issueSecurityLevelManager, constantsManager, + subTaskManager)); + + return wrIssues; } private int min(int a, int b) { if (a < b) return a; else return b; } Modified: trunk/jira-extensions/developer-issues-report/src/java/pl/net/mamut/jira/DeveloperIssuesReport.java =================================================================== --- trunk/jira-extensions/developer-issues-report/src/java/pl/net/mamut/jira/DeveloperIssuesReport.java 2005-08-27 09:55:01 UTC (rev 992) +++ trunk/jira-extensions/developer-issues-report/src/java/pl/net/mamut/jira/DeveloperIssuesReport.java 2005-08-27 17:52:21 UTC (rev 993) @@ -1,17 +1,12 @@ package pl.net.mamut.jira; import com.atlassian.jira.config.ConstantsManager; -import com.atlassian.jira.config.properties.ApplicationProperties; -import com.atlassian.jira.issue.IssueManager; import com.atlassian.jira.issue.search.SearchException; import com.atlassian.jira.issue.search.SearchProvider; import com.atlassian.jira.issue.search.SearchRequest; import com.atlassian.jira.issue.search.parameters.lucene.ProjectParameter; import com.atlassian.jira.issue.search.parameters.lucene.ResolutionParameter; -import com.atlassian.jira.project.ProjectManager; -import com.atlassian.jira.project.version.VersionManager; import com.atlassian.jira.issue.ActionManager; -import com.atlassian.jira.security.PermissionManager; import com.atlassian.jira.util.I18nHelper; import com.atlassian.jira.util.ParameterUtils; import com.atlassian.jira.web.action.ProjectActionSupport; @@ -26,7 +21,6 @@ import org.ofbiz.core.entity.GenericValue; import java.text.DateFormat; import com.atlassian.jira.web.action.admin.user.UserBrowser; -import com.atlassian.plugin.PluginManager; import java.util.*; @@ -36,30 +30,17 @@ */ public class DeveloperIssuesReport extends AbstractGlobalReport { private final SearchProvider searchProvider; - private final IssueManager issueManager; private final ConstantsManager constantsManager; - private final ApplicationProperties appProps; private final OutlookDateManager outlookDateManager; - private final ProjectManager projectManager; - private final VersionManager versionManager; - private final PermissionManager permissionManager; - private final PluginManager pluginManager; private final ActionManager actionManager; - public DeveloperIssuesReport(OutlookDateManager outlookDateManager, ApplicationProperties appProps, - ConstantsManager constantsManager, SearchProvider searchProvider, IssueManager issueManager, - ProjectManager projectManager, VersionManager versionManager, PermissionManager permissionManager, - PluginManager pluginManager, ActionManager actionManager) + public DeveloperIssuesReport(OutlookDateManager outlookDateManager, + ConstantsManager constantsManager, SearchProvider searchProvider, + ActionManager actionManager) { this.outlookDateManager = outlookDateManager; this.searchProvider = searchProvider; - this.issueManager = issueManager; this.constantsManager = constantsManager; - this.appProps = appProps; - this.projectManager = projectManager; - this.versionManager = versionManager; - this.permissionManager = permissionManager; - this.pluginManager = pluginManager; this.actionManager = actionManager; } @@ -86,7 +67,6 @@ * @param n Number of months */ private void nMonthsBack(Calendar cal, int n) { - int day = cal.get(Calendar.DAY_OF_MONTH); int month = cal.get(Calendar.MONTH); int year = cal.get(Calendar.YEAR); Modified: trunk/jira-extensions/developersinvolvement-report/src/java/pl/net/mamut/jira/DevelopersInvolvementReport.java =================================================================== --- trunk/jira-extensions/developersinvolvement-report/src/java/pl/net/mamut/jira/DevelopersInvolvementReport.java 2005-08-27 09:55:01 UTC (rev 992) +++ trunk/jira-extensions/developersinvolvement-report/src/java/pl/net/mamut/jira/DevelopersInvolvementReport.java 2005-08-27 17:52:21 UTC (rev 993) @@ -1,28 +1,16 @@ package pl.net.mamut.jira; -import com.atlassian.core.util.DateUtils; import com.atlassian.jira.issue.IssueManager; -import com.atlassian.jira.issue.index.DocumentConstants; -import com.atlassian.jira.issue.search.SearchException; -import com.atlassian.jira.issue.search.SearchProvider; -import com.atlassian.jira.issue.search.SearchRequest; -import com.atlassian.jira.issue.search.parameters.lucene.DateParameter; -import com.atlassian.jira.issue.search.parameters.lucene.ProjectParameter; import com.atlassian.jira.web.bean.PercentageGraphModel; import com.atlassian.jira.web.bean.PercentageGraphRow; -import com.atlassian.jira.plugin.report.impl.AbstractReport; import com.atlassian.jira.project.ProjectManager; import com.atlassian.jira.issue.ActionManager; import com.atlassian.jira.util.I18nHelper; import com.atlassian.jira.util.ParameterUtils; import com.atlassian.jira.web.action.ProjectActionSupport; import com.atlassian.jira.web.bean.I18nBean; -import com.atlassian.jira.web.util.OutlookDate; -import com.atlassian.jira.web.util.OutlookDateManager; import com.opensymphony.user.User; import java.sql.Timestamp; -import org.apache.log4j.Logger; -import org.ofbiz.core.entity.EntityOperator; import com.atlassian.jira.plugin.report.ReportModuleDescriptor; import com.atlassian.jira.plugin.globalreport.impl.AbstractGlobalReport; import com.atlassian.jira.issue.action.ChangeHistory; Modified: trunk/jira-extensions/issuesclosed-report/src/java/pl/net/mamut/jira/IssuesClosedReport.java =================================================================== --- trunk/jira-extensions/issuesclosed-report/src/java/pl/net/mamut/jira/IssuesClosedReport.java 2005-08-27 09:55:01 UTC (rev 992) +++ trunk/jira-extensions/issuesclosed-report/src/java/pl/net/mamut/jira/IssuesClosedReport.java 2005-08-27 17:52:21 UTC (rev 993) @@ -1,34 +1,19 @@ package pl.net.mamut.jira; -import com.atlassian.core.util.DateUtils; import com.atlassian.jira.issue.IssueManager; -import com.atlassian.jira.issue.index.DocumentConstants; -import com.atlassian.jira.issue.search.SearchException; -import com.atlassian.jira.issue.search.SearchProvider; -import com.atlassian.jira.issue.search.SearchRequest; -import com.atlassian.jira.issue.search.parameters.lucene.DateParameter; -import com.atlassian.jira.issue.search.parameters.lucene.ProjectParameter; -import com.atlassian.jira.web.bean.PercentageGraphModel; -import com.atlassian.jira.web.bean.PercentageGraphRow; -import com.atlassian.jira.plugin.report.impl.AbstractReport; import com.atlassian.jira.project.ProjectManager; import com.atlassian.jira.issue.ActionManager; import com.atlassian.jira.util.I18nHelper; import com.atlassian.jira.util.ParameterUtils; import com.atlassian.jira.web.action.ProjectActionSupport; import com.atlassian.jira.web.bean.I18nBean; -import com.atlassian.jira.web.util.OutlookDate; -import com.atlassian.jira.web.util.OutlookDateManager; import com.opensymphony.user.User; import java.sql.Timestamp; -import org.apache.log4j.Logger; -import org.ofbiz.core.entity.EntityOperator; import com.atlassian.jira.plugin.report.ReportModuleDescriptor; import com.atlassian.jira.plugin.globalreport.impl.AbstractGlobalReport; import com.atlassian.jira.issue.action.ChangeHistory; import org.ofbiz.core.entity.GenericValue; import java.text.DateFormat; -import com.atlassian.jira.web.action.admin.user.UserBrowser; import java.util.*; /**Report to generate number of resolved issues in projects for a given period Modified: trunk/jira-extensions/jira-file-modifications/jira-3.3/edit-webapp/includes/navigator/table/header.jsp =================================================================== --- trunk/jira-extensions/jira-file-modifications/jira-3.3/edit-webapp/includes/navigator/table/header.jsp 2005-08-27 09:55:01 UTC (rev 992) +++ trunk/jira-extensions/jira-file-modifications/jira-3.3/edit-webapp/includes/navigator/table/header.jsp 2005-08-27 17:52:21 UTC (rev 993) @@ -31,7 +31,7 @@ <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td valign="bottom" width=80%><b><webwork:text name="'navigator.results.currentview'"/>:</b><br> - <webwork:if test="'bulk' != $view"> + <webwork:if test="'bulk' != $view && 'rnotes' != $view"> <webwork:text name="'navigator.results.currentview.browser'"/> </webwork:if> <webwork:else> Modified: trunk/jira-extensions/jira-file-modifications/jira-3.3/edit-webapp/secure/views/navigator/rnotes.jsp =================================================================== --- trunk/jira-extensions/jira-file-modifications/jira-3.3/edit-webapp/secure/views/navigator/rnotes.jsp 2005-08-27 09:55:01 UTC (rev 992) +++ trunk/jira-extensions/jira-file-modifications/jira-3.3/edit-webapp/secure/views/navigator/rnotes.jsp 2005-08-27 17:52:21 UTC (rev 993) @@ -1,7 +1,7 @@ -<%@ page import="com.atlassian.jira.web.component.IssueTableLayoutBean, - com.atlassian.jira.web.component.IssuePager, +<%@ page import="com.atlassian.jira.web.component.IssuePager, java.util.*, org.ofbiz.core.entity.GenericValue, + com.atlassian.jira.issue.Issue, com.atlassian.jira.ComponentManager, com.atlassian.jira.issue.search.util.QueryCreator, com.atlassian.jira.web.action.issue.IssueNavigator, @@ -13,56 +13,50 @@ <%@ taglib uri="webwork" prefix="webwork" %> <%@ taglib uri="sitemesh-page" prefix="page" %> -<!-- JIRA PART --> - +<html> +<head> + <title><webwork:if test="searchRequest/name">[<webwork:property value="searchRequest/name"/>] </webwork:if><webwork:text name="'navigator.title'"/></title> +</head> +<body> <table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="ffffff"> - <tr> +<%-- remove for printable decorator --%> + <tr class="hidden"> <!-- This is here to get around a rendering problem on Mozilla which manifests when viewing the page over a relatively slow connection. The filterform is rendered to take up more than half the page. By givving a 'relative' row to the browser first we ensure that the rest of the rows are rendered similarly and hence the width of the filterform column is fixed. Fixes JRA-5116 --> <webwork:if test="/mode == 'show'"> - <td width="300" bgcolor="ffffff"></td> + <td class="filterFormCell"> </td> </webwork:if> <webwork:else> - <td width="214" bgcolor="f0f0f0"></td> + <td class="filterSummaryCell"> </td> </webwork:else> - <td width="1"><img src="<webwork:url page="/images/border/spacer.gif"/>" height="1" width="1"></td> - <td width="100%"></td> + <td> </td> </tr> <tr> <webwork:if test="/mode == 'show'"> - <td width="300" valign="top" bgcolor="ffffff"> + <td class="filterFormCell"> <jsp:include page="/includes/navigator/filter-form.jsp" flush="false" /> </td> </webwork:if> <webwork:else> - <td width="214" valign="top" bgcolor="f0f0f0"> + <td class="filterSummaryCell"> <jsp:include page="/includes/navigator/summary-pane.jsp" flush="false" /> </td> </webwork:else> - <td width="1" bgcolor="bbbbbb"><img src="<webwork:url page="/images/border/spacer.gif"/>" height="1" width="1"></td> +<%-- end remove --%> <td valign="top"> <table cellspacing="0" cellpadding="10" border="0" width="100%"><tr><td> - -<webwork:if test="/searchResults"> + +<webwork:if test="/searchResults && /hasAnyErrors == false"> <jsp:include page="/includes/navigator/table/header.jsp"/> </webwork:if> -<webwork:else> - <page:applyDecorator name="jirapanel"> - <page:param name="title"><webwork:property value="text('navigator.title')"/></page:param> - <page:param name="width">100%</page:param> - <p> - <webwork:text name="'navigator.desc1'"/> - </p> - <p> - <webwork:text name="'navigator.desc2'"/> - </p> - <jsp:include page="/includes/errormessages.jsp" /> - </page:applyDecorator> -</webwork:else> - + +<p> +<webwork:if test="/hasErrorMessages == false && /hasErrors == false" > + + <!-- JBoss part --> <webwork:if test="/hasErrorMessages == false && /hasErrors == false" > @@ -73,26 +67,47 @@ List issues = searchResults.getIssues(); TextUtils textUtils = new TextUtils(); + final ConstantsManager constantsManager = + ComponentManager.getInstance().getConstantsManager(); + Iterator iter; /* Map: issue type id -> (Set of issue) */ - Map issuesMap = new TreeMap(); + Map issuesMap = new TreeMap(new Comparator() { + // Sorting issue types by the "sequence" field. + public int compare(Object arg0, Object arg1) { + String id1 = (String) arg0; + String id2 = (String) arg1; + + GenericValue gv1 = constantsManager.getIssueType(id1); + GenericValue gv2 = constantsManager.getIssueType(id2); + + return gv1.getLong("sequence").compareTo( + gv2.getLong("sequence")); + }}); /* Map: issue type id -> issue name */ Map issuesNamesMap = new HashMap(); - List allIssueTypes = ComponentManager.getInstance().getConstantsManager().getAllIssueTypes(); + List allIssueTypes = constantsManager.getAllIssueTypes(); for (iter = allIssueTypes.iterator(); iter.hasNext();) { GenericValue issueType = (GenericValue)iter.next(); - issuesNamesMap.put(issueType.getString("id"), issueType.getString("name")); - } - - /* Preparing issueMap */ + issuesNamesMap.put(issueType.getString("id"), issueType.getString("name")); + } + + /* Preparing issueMap */ for (iter = issuesNamesMap.keySet().iterator(); iter.hasNext();) - issuesMap.put(iter.next(), new TreeSet()); - + issuesMap.put(iter.next(), new TreeSet(new Comparator() { + public int compare(Object o1, Object o2) { + Issue i1 = (Issue) o1; + Issue i2 = (Issue) o2; + + return i1.getId().compareTo(i2.getId()); + } + })); + /* Filling sets in issueMap */ for (iter = issues.iterator(); iter.hasNext();) { - GenericValue issue = (GenericValue) iter.next(); - ((Set)issuesMap.get(issue.getString("type"))).add(issue); + Issue issue = (Issue) iter.next(); + ((Set)issuesMap.get(issue.getIssueType().getString("id"))).add(issue); } for (iter = issuesMap.keySet().iterator(); iter.hasNext();) { @@ -105,13 +120,13 @@ <ul> <% for (Iterator iter2 = currIssues.iterator(); iter2.hasNext();) { - GenericValue issue = (GenericValue) iter2.next(); + Issue issue = (Issue) iter2.next(); %> <li> - [ <a href="<%= request.getContextPath() %>/browse/<%= issue.getString("key") %>"> - <%= issue.getString("key") %> + [ <a href="<%= request.getContextPath() %>/browse/<%= issue.getKey() %>"> + <%= issue.getKey() %> </a> ] - <%= textUtils.htmlEncode(issue.getString("summary")) %> + <%= textUtils.htmlEncode(issue.getSummary()) %> </li> <% } @@ -136,11 +151,11 @@ <% for (Iterator iter2 = currIssues.iterator(); iter2.hasNext();) { - GenericValue issue = (GenericValue) iter2.next(); + Issue issue = (Issue) iter2.next(); %> * - [ <%= issue.getString("key") %> ] - <%= textUtils.htmlEncode(issue.getString("summary")) %> + [ <%= issue.getKey() %> ] + <%= textUtils.htmlEncode(issue.getSummary()) %> <br /> <% } @@ -151,7 +166,10 @@ </webwork:if> <!-- JIRA PART --> - - </td></tr></table> +</webwork:if> +</p> + </td></tr></table> </td></tr> </table> +</body> +</html> Modified: trunk/jira-extensions/junit-tests-adamw/src/java/pl/net/mamut/jira/AbstractJiraTest.java =================================================================== --- trunk/jira-extensions/junit-tests-adamw/src/java/pl/net/mamut/jira/AbstractJiraTest.java 2005-08-27 09:55:01 UTC (rev 992) +++ trunk/jira-extensions/junit-tests-adamw/src/java/pl/net/mamut/jira/AbstractJiraTest.java 2005-08-27 17:52:21 UTC (rev 993) @@ -40,7 +40,7 @@ Properties properties = new Properties(); try { - properties.load( + properties.load( AbstractJiraTest.class.getResourceAsStream("jira_tests.properties")); adminLogin = properties.getProperty("adminLogin"); @@ -49,12 +49,12 @@ userPassword = properties.getProperty("userPassword"); host = properties.getProperty("host"); - /*adminLogin = "00testuser1"; + adminLogin = "00testuser1"; adminPassword = "00TesTUseR1"; userLogin = "00testuser2"; userPassword = "00TesTUseR2"; host = "http://dev03.atl.jboss.com/jira/"; - adminLogin = ""; + /*adminLogin = "adamw"; adminPassword = "adamw"; userLogin = "user1"; userPassword = "user1"; Modified: trunk/jira-extensions/junit-tests-adamw/src/java/pl/net/mamut/jira/ReleaseNotesReportTest.java =================================================================== --- trunk/jira-extensions/junit-tests-adamw/src/java/pl/net/mamut/jira/ReleaseNotesReportTest.java 2005-08-27 09:55:01 UTC (rev 992) +++ trunk/jira-extensions/junit-tests-adamw/src/java/pl/net/mamut/jira/ReleaseNotesReportTest.java 2005-08-27 17:52:21 UTC (rev 993) @@ -17,11 +17,9 @@ private String issId1; private String issRep1; - - private String issId2; + private String issRep2; - - private String issId3; + private String issRep3; protected void setUp() throws Exception { @@ -35,8 +33,8 @@ verId2 = addVersion(prjId, "ver2", "12-May-2005", false); issId1 = addIssue(prjId, "1", "issue1", "3", new String[] { verId1, verId2 }, true); - issId2 = addIssue(prjId, "2", "issue2", "2", new String[] { verId1 }, false); - issId3 = addIssue(prjId, "3", "issue3", "1", new String[] { verId2 }, false); + addIssue(prjId, "2", "issue2", "2", new String[] { verId1 }, false); + addIssue(prjId, "3", "issue3", "1", new String[] { verId2 }, false); issRep1 = getIssueRepresentation(prjId, "issue1"); issRep2 = getIssueRepresentation(prjId, "issue2"); Modified: trunk/jira-extensions/junit-tests-adamw/src/java/pl/net/mamut/jira/UnreleasedProjectVersionsReportTest.java =================================================================== --- trunk/jira-extensions/junit-tests-adamw/src/java/pl/net/mamut/jira/UnreleasedProjectVersionsReportTest.java 2005-08-27 09:55:01 UTC (rev 992) +++ trunk/jira-extensions/junit-tests-adamw/src/java/pl/net/mamut/jira/UnreleasedProjectVersionsReportTest.java 2005-08-27 17:52:21 UTC (rev 993) @@ -77,7 +77,8 @@ wr.setParameter("priorities", allPriorities); wr.setParameter("period", "month"); wr.setParameter("style", "html"); - wr.setParameter("dateend", "31-Dec-2004"); + wr.setParameter("datenow", "no"); + wr.setParameter("datebegin", "01-Dec-2004"); wc.sendRequest(wr); @@ -94,7 +95,8 @@ wr.setParameter("priorities", allPriorities); wr.setParameter("period", "year"); wr.setParameter("style", "html"); - wr.setParameter("dateend", "31-Dec-2004"); + wr.setParameter("datenow", "no"); + wr.setParameter("datebegin", "01-Jan-2004"); wc.sendRequest(wr); @@ -110,7 +112,8 @@ wr.setParameter("priorities", new String[] { "1", "3" }); wr.setParameter("period", "quarter"); wr.setParameter("style", "html"); - wr.setParameter("dateend", "01-Dec-2004"); + wr.setParameter("datenow", "no"); + wr.setParameter("datebegin", "01-Oct-2004"); wc.sendRequest(wr); Modified: trunk/jira-extensions/junit-tests-adamw/src/java/pl/net/mamut/jira/VotingExtensionsTest.java =================================================================== --- trunk/jira-extensions/junit-tests-adamw/src/java/pl/net/mamut/jira/VotingExtensionsTest.java 2005-08-27 09:55:01 UTC (rev 992) +++ trunk/jira-extensions/junit-tests-adamw/src/java/pl/net/mamut/jira/VotingExtensionsTest.java 2005-08-27 17:52:21 UTC (rev 993) @@ -16,10 +16,8 @@ private String prjId; - private String issId1; private String issRep1; - private String issId2; private String issRep2; private String addVotingScheme(String name, String description) throws Exception { @@ -99,7 +97,7 @@ prjId = addProject("TestProject1", "XXA", true); - issId1 = addIssue(prjId, "1", "issue1", "1", new String[] {}, true); + addIssue(prjId, "1", "issue1", "1", new String[] {}, true); issRep1 = getIssueRepresentation(prjId, "issue1"); vsIds = new String[2]; @@ -115,7 +113,7 @@ goToMainPage(); loginUser(); - issId2 = addIssue(prjId, "2", "issue2", "2", new String[] {}, false); + addIssue(prjId, "2", "issue2", "2", new String[] {}, false); issRep2 = getIssueRepresentation(prjId, "issue2"); } Modified: trunk/jira-extensions/releasenotes-affect-report/src/java/pl/net/mamut/jira/ReleaseNotesAffectReport.java =================================================================== --- trunk/jira-extensions/releasenotes-affect-report/src/java/pl/net/mamut/jira/ReleaseNotesAffectReport.java 2005-08-27 09:55:01 UTC (rev 992) +++ trunk/jira-extensions/releasenotes-affect-report/src/java/pl/net/mamut/jira/ReleaseNotesAffectReport.java 2005-08-27 17:52:21 UTC (rev 993) @@ -32,261 +32,262 @@ */ public class ReleaseNotesAffectReport extends AbstractReport { - private final SearchProvider searchProvider; - private final ConstantsManager constantsManager; - private final ApplicationProperties appProps; - private final VersionManager verMan; - private final CustomFieldManager customFieldManager; - private final IssueManager issueManager; - - /** - * <code>versions</code> - versions ids that match the users input - */ - private Collection versions; - - public ReleaseNotesAffectReport(IssueManager issueManager, ApplicationProperties appProps, ConstantsManager constantsManager, SearchProvider searchProvider, CustomFieldManager customFieldManager) - { - this.issueManager = issueManager; - this.searchProvider = searchProvider; - this.constantsManager = constantsManager; - this.appProps = appProps; - this.verMan = ComponentManager.getInstance().getVersionManager(); - this.customFieldManager = customFieldManager; + private final SearchProvider searchProvider; + private final ConstantsManager constantsManager; + private final ApplicationProperties appProps; + private final VersionManager verMan; + private final CustomFieldManager customFieldManager; + private final IssueManager issueManager; - versions = null; - } - - /** - * Performs a search with the given parameters to find issues to include in the release notes. - * @param remoteUser - * @param versions A collection of versions ids to include in the release notes. - * @param sections A list of issue type ids to include in the relesae notes. - * @return A collection of GenericEntity corresponding to the found issues. - * @throws SearchException - */ - private Collection issueSearch(User remoteUser, Collection versions, List sections) throws SearchException - { - SearchRequest sr = new SearchRequest(remoteUser); - sr.addParameter(new FixForParameter(versions)); - sr.addParameter(new IssueTypeParameter(sections)); - return searchProvider.search(sr, remoteUser); - } - - - /** - * Generates a list of issue types ids from user input to include in the release notes. - * @param sections User input. - * @return List of issue types ids - */ - private List parseSections(String[] sections) - { - List l = new ArrayList(); - for (int i=0; i<sections.length; i++) { - String[] subTypes = sections[i].split("[.]"); - for (int j=0; j<subTypes.length; j++) - if (!subTypes[j].equals("")) l.add(subTypes[j]); - } - return l; - } - - /** - * Parses user input to generate a collection of matching version ids. Version to use when multi-select - * boxes are enabled in to configuration of a report. - * @param selectedVersions Version names template that were read from the user. - * @return Collection of matching version ids. - */ - private Collection parseVersions(String[] selectedVersions) - { - Set r = new TreeSet(); - - for (int i=0; i<selectedVersions.length; i++) - { - long versionId = Long.parseLong(selectedVersions[i]); - if (versionId > 0) - r.add(new Long(versionId)); - } - - return r; - } - - /** - * Reads version parameters from the parameter map. - * @param params - * @return An array of strings holding version ids. - */ - private String[] getVersionsFromParams(Map params) - { - String[] ret; - try - { - ret = (String [])params.get("versions"); - } catch (ClassCastException e1) - { - try - { - ret = new String[1]; - ret[0] = (String)params.get("versions"); - } catch (ClassCastException e2) - { - return null; - } - } - - return ret; - } - - /** - * Reads selected sections from the parameter map. - * @param params - * @return An array of strings holding sections ids. - */ - private String[] getSectionsFromParams(Map params) - { - String[] ret; - try - { - ret = (String [])params.get("sections"); - } catch (ClassCastException e1) - { - try - { - ret = new String[1]; - ret[0] = (String)params.get("sections"); - } catch (ClassCastException e2) - { - return null; - } - } - - return ret; - } - - /** - * Parses user input and returns a collection of version ids that match the users' input. - * @param action - * @param params Parameters of this report. - * @return Collection of version ids that match the users' input. - * @throws PermissionException - */ - private Collection getVersions(ProjectActionSupport action, Map params) throws PermissionException - { - if (versions == null) - versions = parseVersions(getVersionsFromParams(params)); - return versions; - } - - public String generateReportHtml(ProjectActionSupport action, Map params) throws Exception - { - User remoteUser = action.getRemoteUser(); - Map velocityParams = new HashMap(); - - try - { - /* Generating parameters for search */ - Collection versions = getVersions(action, params); - List sections = parseSections(getSectionsFromParams(params)); - - /* Searching for issues to include in the report */ - Collection issues = issueSearch(remoteUser, versions, sections); - - Iterator iter; - /* Map: issue type id -> (Set of issue) */ - Map issuesMap = new TreeMap(); - /* Map: issue type id -> issue name */ - Map issuesNamesMap = new HashMap(); - - CustomField affects = customFieldManager.getCustomFieldObjectByName("Affects"); - - Map affectsValues = new HashMap(); - - Iterator it = issues.iterator(); - - /* prepare affect values for each project */ - while (it.hasNext()) { - Object key = it.next(); - String issueId = ((GenericValue)key).getString("id"); - String str = String.valueOf(affects.getValue( - issueManager.getIssueObject(issueId))); - if (!(str.equals("null"))) - affectsValues.put(key, str.substring(1,str.length() - 1)); - } - - /* Preparing issueMap */ - for (iter = sections.iterator(); iter.hasNext();) - issuesMap.put(iter.next(), new TreeSet()); - - /* Filling sets in issueMap */ - for (iter = issues.iterator(); iter.hasNext();) { - GenericValue issue = (GenericValue) iter.next(); - ((Set)issuesMap.get(issue.getString("type"))).add(issue); - } - - /* Setting the issues' names */ - for (iter = sections.iterator(); iter.hasNext();) { - String issueId = (String)iter.next(); - issuesNamesMap.put(issueId, constantsManager.getIssueType(issueId).getString("name")); - } - - /* Getting the project for which this report is - by looking at - * a representative version. We know that at least one exists - * because validation was passed. */ - Long repVer = (Long) versions.iterator().next(); - GenericValue project = verMan.getVersion(repVer).getProject(); - - /* Preparing parameters for output */ - velocityParams.put("action", action); - velocityParams.put("project", project); - velocityParams.put("appProps", appProps); - velocityParams.put("verMan", verMan); - velocityParams.put("versions", versions); - velocityParams.put("issuesMap", issuesMap); - velocityParams.put("issuesNamesMap", issuesNamesMap); - velocityParams.put("textUtils", new TextUtils()); - velocityParams.put("affectsVal", affectsValues); - - /* Generating release notes source in the format demanded by the user */ - String style = (String)params.get("style"); - - if ("none".equals(style)) - velocityParams.put("generated", ""); - else - velocityParams.put("generated", - descriptor.getHtml(style, velocityParams)); - } catch (SearchException e) - { - return ""; - } - - return descriptor.getHtml("view", velocityParams); - } - - public void validate(ProjectActionSupport action, Map params) - { - /* Checking if the versions field is not empty */ - String[] versions = getVersionsFromParams(params); - if (versions == null || versions.length == 0) - { - action.addError("versions", action.getText("report.releasenotes-affect.versions.required")); - return; - } - - /* Checking if the sections field is not empty */ - String[] sections = getSectionsFromParams(params); - if (sections == null || sections.length == 0) - { - action.addError("sections", action.getText("report.releasenotes-affect.sections.required")); - return; - } - - /* Checking if the versions field is not empty */ - try - { - if (getVersions(action, params).size() == 0) - action.addError("versions", action.getText("report.releasenotes-affect.versions.nomatch")); - } catch (PermissionException e) - { - action.addError("versions", action.getText("report.releasenotes-affect.versions.noperms")); - } - - } + /** + * <code>versions</code> - versions ids that match the users input + */ + private Collection versions; + + public ReleaseNotesAffectReport(IssueManager issueManager, ApplicationProperties appProps, ConstantsManager constantsManager, SearchProvider searchProvider, CustomFieldManager customFieldManager) + { + this.issueManager = issueManager; + this.searchProvider = searchProvider; + this.constantsManager = constantsManager; + this.appProps = appProps; + this.verMan = ComponentManager.getInstance().getVersionManager(); + this.customFieldManager = customFieldManager; + + versions = null; + } + + /** + * Performs a search with the given parameters to find issues to include in the release notes. + * @param remoteUser + * @param versions A collection of versions ids to include in the release notes. + * @param sections A list of issue type ids to include in the relesae notes. + * @return A collection of GenericEntity corresponding to the found issues. + * @throws SearchException + */ + private Collection issueSearch(User remoteUser, Collection versions, List sections) throws SearchException + { + SearchRequest sr = new SearchRequest(remoteUser); + sr.addParameter(new FixForParameter(versions)); + sr.addParameter(new IssueTypeParameter(sections)); + return searchProvider.search(sr, remoteUser); + } + + + /** + * Generates a list of issue types ids from user input to include in the release notes. + * @param sections User input. + * @return List of issue types ids + */ + private List parseSections(String[] sections) + { + List l = new ArrayList(); + for (int i=0; i<sections.length; i++) { + String[] subTypes = sections[i].split("[.]"); + for (int j=0; j<subTypes.length; j++) + if (!subTypes[j].equals("")) l.add(subTypes[j]); + } + return l; + } + + /** + * Parses user input to generate a collection of matching version ids. Version to use when multi-select + * boxes are enabled in to configuration of a report. + * @param selectedVersions Version names template that were read from the user. + * @return Collection of matching version ids. + */ + private Collection parseVersions(String[] selectedVersions) + { + Set r = new TreeSet(); + + for (int i=0; i<selectedVersions.length; i++) + { + long versionId = Long.parseLong(selectedVersions[i]); + if (versionId > 0) + r.add(new Long(versionId)); + } + + return r; + } + + /** + * Reads version parameters from the parameter map. + * @param params + * @return An array of strings holding version ids. + */ + private String[] getVersionsFromParams(Map params) + { + String[] ret; + try + { + ret = (String [])params.get("versions"); + } catch (ClassCastException e1) + { + try + { + ret = new String[1]; + ret[0] = (String)params.get("versions"); + } catch (ClassCastException e2) + { + return null; + } + } + + return ret; + } + + /** + * Reads selected sections from the parameter map. + * @param params + * @return An array of strings holding sections ids. + */ + private String[] getSectionsFromParams(Map params) + { + String[] ret; + try + { + ret = (String [])params.get("sections"); + } catch (ClassCastException e1) + { + try + { + ret = new String[1]; + ret[0] = (String)params.get("sections"); + } catch (ClassCastException e2) + { + return null; + } + } + + return ret; + } + + /** + * Parses user input and returns a collection of version ids that match the users' input. + * @param action + * @param params Parameters of this report. + * @return Collection of version ids that match the users' input. + * @throws PermissionException + */ + private Collection getVersions(ProjectActionSupport action, Map params) throws PermissionException + { + if (versions == null) + versions = parseVersions(getVersionsFromParams(params)); + return versions; + } + + public String generateReportHtml(ProjectActionSupport action, Map params) throws Exception + { + User remoteUser = action.getRemoteUser(); + Map velocityParams = new HashMap(); + + try + { + /* Generating parameters for search */ + Collection versions = getVersions(action, params); + List sections = parseSections(getSectionsFromParams(params)); + + /* Searching for issues to include in the report */ + Collection issues = issueSearch(remoteUser, versions, sections); + + Iterator iter; + /* Map: issue type id -> (Set of issue) */ + Map issuesMap = new TreeMap(); + /* Map: issue type id -> issue name */ + Map issuesNamesMap = new HashMap(); + + CustomField affects = customFieldManager.getCustomFieldObjectByName("Affects"); + + Map affectsValues = new HashMap(); + + Iterator it = issues.iterator(); + + /* prepare affect values for each project */ + if (affects != null) + while (it.hasNext()) { + Object key = it.next(); + String issueId = ((GenericValue)key).getString("id"); + String str = String.valueOf(affects.getValue( + issueManager.getIssueObject(issueId))); + if (!(str.equals("null"))) + affectsValues.put(key, str.substring(1,str.length() - 1)); + } + + /* Preparing issueMap */ + for (iter = sections.iterator(); iter.hasNext();) + issuesMap.put(iter.next(), new TreeSet()); + + /* Filling sets in issueMap */ + for (iter = issues.iterator(); iter.hasNext();) { + GenericValue issue = (GenericValue) iter.next(); + ((Set)issuesMap.get(issue.getString("type"))).add(issue); + } + + /* Setting the issues' names */ + for (iter = sections.iterator(); iter.hasNext();) { + String issueId = (String)iter.next(); + issuesNamesMap.put(issueId, constantsManager.getIssueType(issueId).getString("name")); + } + + /* Getting the project for which this report is - by looking at + * a representative version. We know that at least one exists + * because validation was passed. */ + Long repVer = (Long) versions.iterator().next(); + GenericValue project = verMan.getVersion(repVer).getProject(); + + /* Preparing parameters for output */ + velocityParams.put("action", action); + velocityParams.put("project", project); + velocityParams.put("appProps", appProps); + velocityParams.put("verMan", verMan); + velocityParams.put("versions", versions); + velocityParams.put("issuesMap", issuesMap); + velocityParams.put("issuesNamesMap", issuesNamesMap); + velocityParams.put("textUtils", new TextUtils()); + velocityParams.put("affectsVal", affectsValues); + + /* Generating release notes source in the format demanded by the user */ + String style = (String)params.get("style"); + + if ("none".equals(style)) + velocityParams.put("generated", ""); + else + velocityParams.put("generated", + descriptor.getHtml(style, velocityParams)); + } catch (SearchException e) + { + return ""; + } + + return descriptor.getHtml("view", velocityParams); + } + + public void validate(ProjectActionSupport action, Map params) + { + /* Checking if the versions field is not empty */ + String[] versions = getVersionsFromParams(params); + if (versions == null || versions.length == 0) + { + action.addError("versions", action.getText("report.releasenotes-affect.versions.required")); + return; + } + + /* Checking if the sections field is not empty */ + String[] sections = getSectionsFromParams(params); + if (sections == null || sections.length == 0) + { + action.addError("sections", action.getText("report.releasenotes-affect.sections.required")); + return; + } + + /* Checking if the versions field is not empty */ + try + { + if (getVersions(action, params).size() == 0) + action.addError("versions", action.getText("report.releasenotes-affect.versions.nomatch")); + } catch (PermissionException e) + { + action.addError("versions", action.getText("report.releasenotes-affect.versions.noperms")); + } + + } } Modified: trunk/jira-extensions/releasenotes-report/src/java/pl/net/mamut/ReleaseNotesReport.java =================================================================== --- trunk/jira-extensions/releasenotes-report/src/java/pl/net/mamut/ReleaseNotesReport.java 2005-08-27 09:55:01 UTC (rev 992) +++ trunk/jira-extensions/releasenotes-report/src/java/pl/net/mamut/ReleaseNotesReport.java 2005-08-27 17:52:21 UTC (rev 993) @@ -190,7 +190,19 @@ Iterator iter; /* Map: issue type id -> (Set of issue) */ - Map issuesMap = new TreeMap(); + Map issuesMap = new TreeMap(new Comparator() { + // Sorting issue types by the "sequence" field. + public int compare(Object arg0, Object arg1) { + String id1 = (String) arg0; + String id2 = (String) arg1; + + GenericValue gv1 = constantsManager.getIssueType(id1); + GenericValue gv2 = constantsManager.getIssueType(id2); + + return gv1.getLong("sequence").compareTo( + gv2.getLong("sequence")); + } + }); /* Map: issue type id -> issue name */ Map issuesNamesMap = new HashMap(); @@ -209,7 +221,7 @@ String issueId = (String)iter.next(); issuesNamesMap.put(issueId, constantsManager.getIssueType(issueId).getString("name")); } - + /* Preparing parameters for output */ velocityParams.put("project", project); velocityParams.put("action", action); Modified: trunk/jira-extensions/roadmap-report/src/etc/atlassian-plugin.xml =================================================================== --- trunk/jira-extensions/roadmap-report/src/etc/atlassian-plugin.xml 2005-08-27 09:55:01 UTC (rev 992) +++ trunk/jira-extensions/roadmap-report/src/etc/atlassian-plugin.xml 2005-08-27 17:52:21 UTC (rev 993) @@ -38,6 +38,28 @@ <values class="pl.net.mamut.jira.IssuesPrioritiesValueGenerator" /> </property> <property> + <key>datebegin</key> + <name>report.roadmap.datebegin.name</name> + <description>report.roadmap.datebegin.description</description> + <type>date</type> + </property> + <property> + <key>datenow</key> + <name>report.roadmap.datenow.name</name> + <description>report.roadmap.datenow.description</description> + <type>select</type> + <values> + <value> + <key>no</key> + <value>No</value> + </value> + <value> + <key>yes</key> + <value>Yes</value> + </value> + </values> + </property> + <property> <key>period</key> <name>report.roadmap.period.name</name> <description>report.roadmap.period.description</description> @@ -58,12 +80,6 @@ </values> </property> <property> - <key>dateend</key> - <name>report.roadmap.dateend.name</name> - <description>report.roadmap.dateend.description</description> - <type>date</type> - </property> - <property> <key>style</key> <name>report.roadmap.style.name</name> <description>report.roadmap.style.description</description> Modified: trunk/jira-extensions/roadmap-report/src/etc/pl/net/mamut/jira/roadmap_report.properties =================================================================== --- trunk/jira-extensions/roadmap-report/src/etc/pl/net/mamut/jira/roadmap_report.properties 2005-08-27 09:55:01 UTC (rev 992) +++ trunk/jira-extensions/roadmap-report/src/etc/pl/net/mamut/jira/roadmap_report.properties 2005-08-27 17:52:21 UTC (rev 993) @@ -13,9 +13,12 @@ report.roadmap.period.name = Period covered report.roadmap.period.description = Select the span of time that this report will cover report.roadmap.period.error = Please select one period. -report.roadmap.dateend.name = End date -report.roadmap.dateend.description = Select the date that ends the period of time you chose. -report.roadmap.dateend.error = Please select a date. +report.roadmap.datebegin.name = Begin date +report.roadmap.datebegin.description = Select the date that begins the period of time you chose. +report.roadmap.datebegin.error = Please select a date. +report.roadmap.datenow.name = Today +report.roadmap.datenow.description = Check this box if you want the report's starting date to be today. +report.roadmap.datenow.error = Please select either yes or no. report.roadmap.style.name = Style report.roadmap.style.description = Select the style in which to generate the report source. report.roadmap.style.error = Please select one style. \ No newline at end of file Modified: trunk/jira-extensions/roadmap-report/src/java/pl/net/mamut/jira/RoadmapGlobalReport.java =================================================================== --- trunk/jira-extensions/roadmap-report/src/java/pl/net/mamut/jira/RoadmapGlobalReport.java 2005-08-27 09:55:01 UTC (rev 992) +++ trunk/jira-extensions/roadmap-report/src/java/pl/net/mamut/jira/RoadmapGlobalReport.java 2005-08-27 17:52:21 UTC (rev 993) @@ -5,7 +5,9 @@ package pl.net.mamut.jira; import com.atlassian.jira.config.ConstantsManager; +import com.atlassian.jira.config.SubTaskManager; import com.atlassian.jira.config.properties.ApplicationProperties; +import com.atlassian.jira.issue.IssueImpl; import com.atlassian.jira.issue.IssueManager; import com.atlassian.jira.issue.search.SearchException; import com.atlassian.jira.issue.search.SearchProvider; @@ -14,6 +16,7 @@ import com.atlassian.jira.issue.search.parameters.lucene.IssueTypeParameter; import com.atlassian.jira.issue.search.parameters.lucene.PriorityParameter; import com.atlassian.jira.issue.search.parameters.lucene.ProjectParameter; +import com.atlassian.jira.issue.security.IssueSecurityLevelManager; import com.atlassian.jira.plugin.globalreport.impl.AbstractGlobalReport; import com.atlassian.jira.plugin.report.ReportModuleDescriptor; import com.atlassian.jira.project.ProjectManager; @@ -43,7 +46,6 @@ public class RoadmapGlobalReport extends AbstractGlobalReport { private final SearchProvider searchProvider; - private final IssueManager issueManager; private final ConstantsManager constantsManager; private final ApplicationProperties appProps; private final OutlookDateManager outlookDateManager; @@ -51,21 +53,28 @@ private final VersionManager versionManager; private final PermissionManager permissionManager; private final PluginManager pluginManager; + private final IssueManager issueManager; + private final SubTaskManager subTaskManager; + private final IssueSecurityLevelManager issueSecurityLevelManager; public RoadmapGlobalReport(OutlookDateManager outlookDateManager, ApplicationProperties appProps, - ConstantsManager constantsManager, SearchProvider searchProvider, IssueManager issueManager, + ConstantsManager constantsManager, SearchProvider searchProvider, ProjectManager projectManager, VersionManager versionManager, PermissionManager permissionManager, - PluginManager pluginManager) + PluginManager pluginManager, IssueManager issueManager, + SubTaskManager subTaskManager, + IssueSecurityLevelManager issueSecurityLevelManager) { this.outlookDateManager = outlookDateManager; this.searchProvider = searchProvider; - this.issueManager = issueManager; this.constantsManager = constantsManager; this.appProps = appProps; this.projectManager = projectManager; this.versionManager = versionManager; this.permissionManager = permissionManager; this.pluginManager = pluginManager; + this.issueManager = issueManager; + this.subTaskManager = subTaskManager; + this.issueSecurityLevelManager = issueSecurityLevelManager; } /** @@ -87,7 +96,18 @@ sr.addParameter(new IssueTypeParameter(sections)); sr.addParameter(new PriorityParameter(priorities)); sr.addParameter(new ProjectParameter(projectId)); - return searchProvider.search(sr, remoteUser); + // Converting the list of issues represented by generic values + // to a list of wrappers. + List gvIssues = searchProvider.search(sr, remoteUser); + List wrIssues = new ArrayList(); + + for (Iterator iter = gvIssues.iterator(); iter.hasNext();) + wrIssues.add(new IssueImpl((GenericValue) iter.next(), + issueManager, projectManager, versionManager, + issueSecurityLevelManager, constantsManager, + subTaskManager)); + + return wrIssues; } /** @@ -95,14 +115,13 @@ * @param cal * @param n Number of months */ - private void nMonthsBack(Calendar cal, int n) { - int day = cal.get(Calendar.DAY_OF_MONTH); + private void nMonthsForward(Calendar cal, int n) { int month = cal.get(Calendar.MONTH); int year = cal.get(Calendar.YEAR); - - month -= n; if (month < 0) { - month += 12; - cal.set(Calendar.YEAR, cal.get(Calendar.YEAR)-1); + + month += n-1; if (month > 11) { + month -= 12; + cal.set(Calendar.YEAR, cal.get(Calendar.YEAR)+1); } cal.set(Calendar.MONTH, month); switch(month) @@ -123,20 +142,18 @@ * @param endDate Date that ends the period. * @return Date that begins the period. */ - private Date getBeginDate(String period, Date endDate) + private Date getEndDate(String period, Date endDate) { Calendar cal = Calendar.getInstance(); cal.setTime(endDate); if (period.equals("month")) - nMonthsBack(cal, 1); + nMonthsForward(cal, 1); else if (period.equals("quarter")) - nMonthsBack(cal, 3); + nMonthsForward(cal, 3); else if (period.equals("year")) - nMonthsBack(cal, 12); - - cal.set(Calendar.DAY_OF_YEAR, cal.get(Calendar.DAY_OF_YEAR)+1); - + nMonthsForward(cal, 12); + return cal.getTime(); } @@ -173,8 +190,12 @@ /* Geting the dates */ I18nHelper i18nBean = new I18nBean(remoteUser); - Date endDate = ParameterUtils.getDateParam(params, "dateend", i18nBean.getLocale()); - Date beginDate = getBeginDate((String)params.get("period"), endDate); + Date beginDate; + if (("yes".equals((String) params.get("datenow")))) + beginDate = Calendar.getInstance().getTime(); + else + beginDate = ParameterUtils.getDateParam(params, "datebegin", i18nBean.getLocale()); + Date endDate = getEndDate((String)params.get("period"), beginDate); /* Getting the types */ String[] types = getMultiselectValue(params, "types"); @@ -309,33 +330,19 @@ if (!validateMultivalue(action, params, "priorities")) return; if (!validateSinglevalue(action, params, "period")) return; if (!validateSinglevalue(action, params, "style")) return; + if (!validateSinglevalue(action, params, "datenow")) return; - Date endDate = ParameterUtils.getDateParam(params, "dateend", i18nBean.getLocale()); - OutlookDate outlookDate = outlookDateManager.getOutlookDate(i18nBean.getLocale()); - if (endDate == null || outlookDate.isDatePickerDate(outlookDate.formatDMY(endDate))) - { - action.addError("dateend", action.getText("report.roadmap.dateend.error")); - return; + String dateNow = (String) params.get("datenow"); + if (!("yes".equals(dateNow))) { + Date beginDate = ParameterUtils.getDateParam(params, "datebegin", i18nBean.getLocale()); + OutlookDate outlookDate = outlookDateManager.getOutlookDate(i18nBean.getLocale()); + if (beginDate == null || outlookDate.isDatePickerDate(outlookDate.formatDMY(beginDate))) + { + action.addError("datebegin", action.getText("report.roadmap.datebegin.error")); + return; + } } } public void init(ReportModuleDescriptor arg0) { } -} - -/* - -$browser.setSelectedProjectId($project.getLong("id")) -<td bgcolor="fffff0" colspan=3> - <table height=6 width=180 valign=middle align=right cellspacing=0 cellpadding=0 border=0> - <tr height=6> - <td width="80" valign="middle" align="right"><span class="subText">Progress: </span></td> - #percentageGraph ($browser.getIssueSummaryByFixForVersion($version) $project $version) - </tr> - #if ($browser.getIssuesByFixForVersion($version).size... [truncated message content] |