Author: ronvoe122
Date: 2008-04-07 11:24:21-0700
New Revision: 10543
Modified:
trunk/src/conf/classes/ScarabBundle_de.properties
trunk/src/conf/classes/ScarabBundle_en.properties
trunk/src/java/org/tigris/scarab/actions/ModifyModule.java
trunk/src/java/org/tigris/scarab/om/ActivityManager.java
trunk/src/java/org/tigris/scarab/om/GlobalParameter.java
trunk/src/java/org/tigris/scarab/om/ReportManager.java
trunk/src/java/org/tigris/scarab/om/ScarabModule.java
trunk/src/java/org/tigris/scarab/reports/ReportBridge.java
trunk/src/java/org/tigris/scarab/reports/ReportTableModel.java
trunk/src/webapp/WEB-INF/templates/screens/admin/ModifyModule.vm
trunk/src/webapp/WEB-INF/templates/screens/home/EnterNew.vm
Log:
SCB1381: It is now possible define a summary-report which is always displayed on a modules home page.
Implemented by Johannes Hoechstaedter.
Modified: trunk/src/conf/classes/ScarabBundle_de.properties
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/conf/classes/ScarabBundle_de.properties?view=diff&rev=10543&p1=trunk/src/conf/classes/ScarabBundle_de.properties&p2=trunk/src/conf/classes/ScarabBundle_de.properties&r1=10542&r2=10543
==============================================================================
--- trunk/src/conf/classes/ScarabBundle_de.properties (original)
+++ trunk/src/conf/classes/ScarabBundle_de.properties 2008-04-07 11:24:21-0700
@@ -691,6 +691,9 @@
StackTraceError=<pre>If the stack trace below has at the top a mention of "ResourceNotFoundException", that means that a template could not be found (404) and is probably the result of a broken link. If the stack trace has something else, please enter a copy of the stack trace <strong>and an explanation of what you did to cause it</strong> to the <a href="http://www.solitone.org/scarab/issues/">Issue Tracking System</a> for analysis. If you are a developer and think you know what the problem is, feel free to send in a patch to fix the problem. </pre>
## Reports
+DefaultReport=Standard Report
+Report=Report
+DefaultReportSubtitle=Standard Modulreport
Update=aktualisieren
Group=Gruppe
Personal=persönlich
Modified: trunk/src/conf/classes/ScarabBundle_en.properties
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/conf/classes/ScarabBundle_en.properties?view=diff&rev=10543&p1=trunk/src/conf/classes/ScarabBundle_en.properties&p2=trunk/src/conf/classes/ScarabBundle_en.properties&r1=10542&r2=10543
==============================================================================
--- trunk/src/conf/classes/ScarabBundle_en.properties (original)
+++ trunk/src/conf/classes/ScarabBundle_en.properties 2008-04-07 11:24:21-0700
@@ -754,6 +754,9 @@
NoErrorMessage=Sorry, there was no error message. \n Although, one common source of the error could be a result of not being able \n to find the requested template. Please try going back to the \n {0} screen and starting over.
## Reports
+DefaultReport=Default Report
+Report=Report
+DefaultReportSubtitle=Predefined report for this module
Update=Update
Group=Group
Personal=personal
Modified: trunk/src/java/org/tigris/scarab/actions/ModifyModule.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/actions/ModifyModule.java?view=diff&rev=10543&p1=trunk/src/java/org/tigris/scarab/actions/ModifyModule.java&p2=trunk/src/java/org/tigris/scarab/actions/ModifyModule.java&r1=10542&r2=10543
==============================================================================
--- trunk/src/java/org/tigris/scarab/actions/ModifyModule.java (original)
+++ trunk/src/java/org/tigris/scarab/actions/ModifyModule.java 2008-04-07 11:24:21-0700
@@ -109,6 +109,7 @@
Group moduleGroup = intake.get
("Module",me.getQueryKey(), false);
+
if (moduleGroup == null)
{
setTarget(data, template);
@@ -221,6 +222,7 @@
storeGlobalParameter(GlobalParameter.ISSUE_REASON_REQUIRED, me, pp);
storeGlobalParameter(GlobalParameter.REQUIRED_ROLE_FOR_REQUESTING_ACCESS, me, pp);
storeGlobalParameter(GlobalParameter.COMMENT_RENDER_ENGINE, me, pp);
+ storeGlobalParameter(GlobalParameter.DEFAULT_REPORT, me, pp);
}
Modified: trunk/src/java/org/tigris/scarab/om/ActivityManager.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/om/ActivityManager.java?view=diff&rev=10543&p1=trunk/src/java/org/tigris/scarab/om/ActivityManager.java&p2=trunk/src/java/org/tigris/scarab/om/ActivityManager.java&r1=10542&r2=10543
==============================================================================
--- trunk/src/java/org/tigris/scarab/om/ActivityManager.java (original)
+++ trunk/src/java/org/tigris/scarab/om/ActivityManager.java 2008-04-07 11:24:21-0700
@@ -376,6 +376,14 @@
{
throw new TorqueException(e); //EXCEPTION
}
+
+ //set default report for current module to dirty
+ Module module=issue.getModule();
+
+ if(module instanceof ScarabModule){
+ ((ScarabModule)module).setDefaultReportDirty(true);
+ }
+
return activity;
}
}
Modified: trunk/src/java/org/tigris/scarab/om/GlobalParameter.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/om/GlobalParameter.java?view=diff&rev=10543&p1=trunk/src/java/org/tigris/scarab/om/GlobalParameter.java&p2=trunk/src/java/org/tigris/scarab/om/GlobalParameter.java&r1=10542&r2=10543
==============================================================================
--- trunk/src/java/org/tigris/scarab/om/GlobalParameter.java (original)
+++ trunk/src/java/org/tigris/scarab/om/GlobalParameter.java 2008-04-07 11:24:21-0700
@@ -70,5 +70,7 @@
"required-role-for-requesting-access";
public static final String COMMENT_RENDER_ENGINE =
"comment-render-engine";
+ public static final String DEFAULT_REPORT =
+ "default-report";
}
Modified: trunk/src/java/org/tigris/scarab/om/ReportManager.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/om/ReportManager.java?view=diff&rev=10543&p1=trunk/src/java/org/tigris/scarab/om/ReportManager.java&p2=trunk/src/java/org/tigris/scarab/om/ReportManager.java&r1=10542&r2=10543
==============================================================================
--- trunk/src/java/org/tigris/scarab/om/ReportManager.java (original)
+++ trunk/src/java/org/tigris/scarab/om/ReportManager.java 2008-04-07 11:24:21-0700
@@ -67,6 +67,7 @@
throws TorqueException
{
super();
+ setRegion(getClassName().replace('.', '_'));
}
}
Modified: trunk/src/java/org/tigris/scarab/om/ScarabModule.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/om/ScarabModule.java?view=diff&rev=10543&p1=trunk/src/java/org/tigris/scarab/om/ScarabModule.java&p2=trunk/src/java/org/tigris/scarab/om/ScarabModule.java&r1=10542&r2=10543
==============================================================================
--- trunk/src/java/org/tigris/scarab/om/ScarabModule.java (original)
+++ trunk/src/java/org/tigris/scarab/om/ScarabModule.java 2008-04-07 11:24:21-0700
@@ -60,6 +60,7 @@
// Turbine classes
import org.apache.torque.TorqueException;
+import org.apache.torque.om.NumberKey;
import org.apache.torque.om.Persistent;
import org.apache.torque.util.Criteria;
import org.apache.torque.util.SqlEnum;
@@ -82,6 +83,7 @@
import org.tigris.scarab.util.ScarabException;
import org.tigris.scarab.util.ScarabPaginatedList;
import org.tigris.scarab.util.ScarabLocalizedTorqueException;
+import org.tigris.scarab.reports.ReportBridge;
import org.tigris.scarab.services.cache.ScarabCache;
// FIXME! do not like referencing servlet inside of business objects
@@ -122,7 +124,15 @@
private String port = null;
private String scheme = null;
private String scriptName = null;
-
+
+ private static final String GET_DEFAULTREPORT="getDefaultReport";
+
+ /**
+ * true if the cached report of this module has to be updated,
+ * because some attribute values had changed in the module.
+ */
+ private boolean defaultReportDirty=false;
+
/**
* Get the value of domain.
* @return value of domain.
@@ -1102,5 +1112,85 @@
return '{' + super.toString() + " - ID=" + getModuleId() + " - "
+ getName() + '}';
}
-}
+
+ /**
+ * Method returns all not deleted reports with scope module
+ * @return
+ */
+ public List getNotDeletedModuleReports(){
+ Criteria crit=new Criteria();
+
+ //not deleted
+ crit.add(ReportPeer.DELETED,false);
+
+// not deleted
+ crit.add(ReportPeer.MODULE_ID,this.getModuleId());
+
+ //scope module
+ crit.add(ReportPeer.SCOPE_ID,2);
+
+ List reports=null;
+
+ try {
+ reports=ReportPeer.doSelect(crit);
+ } catch (TorqueException e) {
+
+ reports=null;
+ }
+
+ return reports;
+ }
+ public boolean isDefaultReportDirty() {
+ return defaultReportDirty;
+ }
+
+ public void setDefaultReportDirty(boolean defaultReportDirty) {
+ this.defaultReportDirty = defaultReportDirty;
+ }
+
+ /**
+ * method returns the default report defined for the current module
+ * @author jhoech
+ */
+ public ReportBridge getDefaultReport()
+ throws Exception
+{
+ String id = GlobalParameterManager.getString(GlobalParameter.DEFAULT_REPORT,this);
+
+ ReportBridge defaultReport=null;
+
+ boolean reportDeleted=false;
+
+ if(id != null && id.length() > 0){
+
+ defaultReport =(ReportBridge) ReportManager.getMethodResult().get(this,GET_DEFAULTREPORT,this);
+
+ if(this.isDefaultReportDirty()||defaultReport==null||!defaultReport.getReportId().toString().equals(id)){
+ defaultReport = new ReportBridge(ReportManager.getInstance(new NumberKey(id), true));
+ ReportManager.getMethodResult().put(defaultReport,this,GET_DEFAULTREPORT,this);
+ this.setDefaultReportDirty(false);
+ }
+
+ if(defaultReport!=null){
+ Criteria crit =new Criteria();
+ crit.add(ReportPeer.REPORT_ID,id);
+ List l=ReportPeer.doSelect(crit);
+ Iterator iter=l.iterator();
+
+ while(iter.hasNext()){
+ Report report=(Report) iter.next();
+ if(report.getDeleted())reportDeleted=true;
+ }
+ }
+ }
+
+ //return null if report is deleted
+ if(defaultReport!=null&&reportDeleted){
+ return null;
+ }
+ else{
+ return defaultReport;
+ }
+ }
+}
Modified: trunk/src/java/org/tigris/scarab/reports/ReportBridge.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/reports/ReportBridge.java?view=diff&rev=10543&p1=trunk/src/java/org/tigris/scarab/reports/ReportBridge.java&p2=trunk/src/java/org/tigris/scarab/reports/ReportBridge.java&r1=10542&r2=10543
==============================================================================
--- trunk/src/java/org/tigris/scarab/reports/ReportBridge.java (original)
+++ trunk/src/java/org/tigris/scarab/reports/ReportBridge.java 2008-04-07 11:24:21-0700
@@ -62,6 +62,8 @@
import org.tigris.scarab.tools.localization.L10NKeySet;
import org.tigris.scarab.util.word.IssueSearch;
+import org.tigris.scarab.om.ReportManager;
+import org.tigris.scarab.om.ScarabModule;
import org.tigris.scarab.om.ScarabUserManager;
import org.tigris.scarab.om.Module;
import org.tigris.scarab.om.IssueType;
@@ -97,6 +99,8 @@
private org.tigris.scarab.om.Report torqueReport;
private ReportDefinition reportDefn;
private ReportHeading newHeading;
+
+ private final String GET_CACHED_MODEL="getCachedModel";
public ReportBridge()
{
@@ -605,8 +609,37 @@
return anyRemoved;
}
- public ReportTableModel getModel(ScarabUser searcher)
+ /**
+ * Method returns a refreshed instance of the cached table model
+ * @param searcher
+ * @return
+ * @throws Exception
+ */
+ public ReportTableModel getCachedModel(ScarabUser searcher)
throws Exception
+ {
+ ScarabModule module=(ScarabModule)getModule();
+
+ ReportTableModel model=(ReportTableModel) ReportManager.getMethodResult().get(this,GET_CACHED_MODEL,searcher);
+
+ if(model==null){
+ generatedDate=new Date();
+ model=new ReportTableModel(this, getGeneratedDate(), searcher);
+ module.setDefaultReportDirty(false);
+ }
+
+ ReportManager.getMethodResult().put(model,this,GET_CACHED_MODEL,searcher);
+
+ return model;
+ }
+
+ /**
+ * Returns a new table model of the report
+ * @param searcher
+ * @return
+ * @throws Exception
+ */
+ public ReportTableModel getModel(ScarabUser searcher) throws Exception
{
return new ReportTableModel(this, getGeneratedDate(), searcher);
}
Modified: trunk/src/java/org/tigris/scarab/reports/ReportTableModel.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/reports/ReportTableModel.java?view=diff&rev=10543&p1=trunk/src/java/org/tigris/scarab/reports/ReportTableModel.java&p2=trunk/src/java/org/tigris/scarab/reports/ReportTableModel.java&r1=10542&r2=10543
==============================================================================
--- trunk/src/java/org/tigris/scarab/reports/ReportTableModel.java (original)
+++ trunk/src/java/org/tigris/scarab/reports/ReportTableModel.java 2008-04-07 11:24:21-0700
@@ -47,6 +47,7 @@
*/
// JDK classes
+import java.io.Serializable;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
@@ -58,6 +59,7 @@
import org.tigris.scarab.om.ModuleManager;
import org.tigris.scarab.om.MITList;
import org.tigris.scarab.om.MITListItem;
+import org.tigris.scarab.om.ReportManager;
import org.tigris.scarab.om.ScarabUser;
import org.tigris.scarab.om.ActivityPeer;
import org.tigris.scarab.om.ActivitySetPeer;
@@ -73,7 +75,7 @@
* @version $Id$
*/
public class ReportTableModel
- extends TableModel
+ extends TableModel implements Serializable
{
private static final String ACT_ATTRIBUTE_ID =
ActivityPeer.ATTRIBUTE_ID.substring(
@@ -113,11 +115,12 @@
private Integer moduleId;
private Integer issueTypeId;
private MITList mitList;
-
private int[] colspan;
private int[] rowspan;
private boolean isSearchAllowed;
+ private final String GET_VALUE_AT="getValueAt";
+
ReportTableModel(ReportBridge report, Date date, ScarabUser searcher)
throws Exception
{
@@ -315,46 +318,53 @@
throw new IndexOutOfBoundsException("Column index was " + column); //EXCEPTION
}
- Object contents = null;
- // could use a categories list to make this simpler
- if (columnHeadings != null && columnHeadings.size() == 1 &&
- ((ReportHeading)columnHeadings.get(0)).get(0) instanceof ReportDate)
- {
- Date date = ((ReportDate) ((ReportHeading) columnHeadings.get(0))
- .get(column)).dateValue();
- if (date.getTime() <= System.currentTimeMillis())
- {
- contents = new Integer(getIssueCount(getRowDataArray(row),
- date));
- }
- else
- {
- // Dates in the future are not applicable to reporting.
- contents = "";
- }
- }
- else if (rowHeadings != null && rowHeadings.size() == 1 &&
- ((ReportHeading)rowHeadings.get(0)).get(0) instanceof ReportDate)
- {
- Date date = ((ReportDate)((ReportHeading)rowHeadings.get(0))
- .get(row)).dateValue();
- if (date.getTime() <= System.currentTimeMillis())
- {
- contents = new Integer(getIssueCount(
- getColumnDataArray(column), date));
- }
- else
- {
- // Dates in the future are not applicable to reporting.
- contents = "";
- }
- }
- else
- {
- contents = new Integer(getIssueCount(
- getRowDataArray(row), getColumnDataArray(column), date));
+ Object contents = ReportManager.getMethodResult().get(this,GET_VALUE_AT,new Integer(row),new Integer(column));
+
+ if(contents==null){
+
+ //could use a categories list to make this simpler
+ if (columnHeadings != null && columnHeadings.size() == 1 &&
+ ((ReportHeading)columnHeadings.get(0)).get(0) instanceof ReportDate)
+ {
+ Date date = ((ReportDate) ((ReportHeading) columnHeadings.get(0))
+ .get(column)).dateValue();
+ if (date.getTime() <= System.currentTimeMillis())
+ {
+ contents = new Integer(getIssueCount(getRowDataArray(row),
+ date));
+ }
+ else
+ {
+ // Dates in the future are not applicable to reporting.
+ contents = "";
+ }
+ }
+ else if (rowHeadings != null && rowHeadings.size() == 1 &&
+ ((ReportHeading)rowHeadings.get(0)).get(0) instanceof ReportDate)
+ {
+ Date date = ((ReportDate)((ReportHeading)rowHeadings.get(0))
+ .get(row)).dateValue();
+ if (date.getTime() <= System.currentTimeMillis())
+ {
+ contents = new Integer(getIssueCount(
+ getColumnDataArray(column), date));
+ }
+ else
+ {
+ // Dates in the future are not applicable to reporting.
+ contents = "";
+ }
+ }
+ else
+ {
+
+ contents = new Integer(getIssueCount(
+ getRowDataArray(row), getColumnDataArray(column), date));
+ }
}
+ ReportManager.getMethodResult().put(contents,this,GET_VALUE_AT,new Integer(row),new Integer(column));
+
return contents;
}
Modified: trunk/src/webapp/WEB-INF/templates/screens/admin/ModifyModule.vm
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/webapp/WEB-INF/templates/screens/admin/ModifyModule.vm?view=diff&rev=10543&p1=trunk/src/webapp/WEB-INF/templates/screens/admin/ModifyModule.vm&p2=trunk/src/webapp/WEB-INF/templates/screens/admin/ModifyModule.vm&r1=10542&r2=10543
==============================================================================
--- trunk/src/webapp/WEB-INF/templates/screens/admin/ModifyModule.vm (original)
+++ trunk/src/webapp/WEB-INF/templates/screens/admin/ModifyModule.vm 2008-04-07 11:24:21-0700
@@ -120,6 +120,25 @@
</select>
</td>
</tr>
+ <tr>
+
+##Configuration of default report
+ <th>$l10n.DefaultReport</th>
+ <td>
+ <select name="$scarabG.ParameterName.DEFAULT_REPORT">
+
+ #set ($reports = $editModule.getNotDeletedModuleReports())
+
+ #set ($defaultReport = $editModule.getDefaultReport())
+
+ <option selected="selected" value="" >$l10n.None</option>
+
+ #foreach ($report in $reports)
+ <option value="$report.ReportId" #if ($report.ReportId == $defaultReport.ReportId) selected #end>$report.Name</option>
+ #end
+ </select>
+ </td>
+ </tr>
#end
#*
<tr>
Modified: trunk/src/webapp/WEB-INF/templates/screens/home/EnterNew.vm
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/webapp/WEB-INF/templates/screens/home/EnterNew.vm?view=diff&rev=10543&p1=trunk/src/webapp/WEB-INF/templates/screens/home/EnterNew.vm&p2=trunk/src/webapp/WEB-INF/templates/screens/home/EnterNew.vm&r1=10542&r2=10543
==============================================================================
--- trunk/src/webapp/WEB-INF/templates/screens/home/EnterNew.vm (original)
+++ trunk/src/webapp/WEB-INF/templates/screens/home/EnterNew.vm 2008-04-07 11:24:21-0700
@@ -116,4 +116,15 @@
</div>
-->
+##show default report
+#set ($report = $currentModule.getDefaultReport())
+#if($report)
+ <h3>$l10n.Report $report.Name</h3>
+ <div class="colbar">
+ $l10n.DefaultReportSubtitle
+ </div>
+ #set ($reportModel = $report.getCachedModel($data.User))
+ #reportTable($reportModel)
+#end
+
</div>
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.