Line 1: |
|
|
+ |
This report shows a user the total number of builds during times of the day. This report has to be used in conjunction with a report template such as the [[Bar Chart Template]].
|
|
|
|
|
|
|
+ |
----
|
|
|
|
|
|
|
+ |
''Meta-Data Script:''
|
|
|
|
|
|
|
+ |
<pre>import com.urbancode.anthill3.domain.reporting.*;
|
|
|
|
|
|
|
+ |
ReportMetaData rmd = new ReportMetaData();
|
|
|
|
|
|
|
+ |
rmd.addColumn("12a");
|
|
|
+ |
rmd.addColumn("1a");
|
|
|
+ |
rmd.addColumn("2a");
|
|
|
+ |
rmd.addColumn("3a");
|
|
|
+ |
rmd.addColumn("4a");
|
|
|
+ |
rmd.addColumn("5a");
|
|
|
+ |
rmd.addColumn("6a");
|
|
|
+ |
rmd.addColumn("7a");
|
|
|
+ |
rmd.addColumn("8a");
|
|
|
+ |
rmd.addColumn("9a");
|
|
|
+ |
rmd.addColumn("10a");
|
|
|
+ |
rmd.addColumn("11a");
|
|
|
+ |
rmd.addColumn("12p");
|
|
|
+ |
rmd.addColumn("1p");
|
|
|
+ |
rmd.addColumn("2p");
|
|
|
+ |
rmd.addColumn("3p");
|
|
|
+ |
rmd.addColumn("4p");
|
|
|
+ |
rmd.addColumn("5p");
|
|
|
+ |
rmd.addColumn("6p");
|
|
|
+ |
rmd.addColumn("7p");
|
|
|
+ |
rmd.addColumn("8p");
|
|
|
+ |
rmd.addColumn("9p");
|
|
|
+ |
rmd.addColumn("10p");
|
|
|
+ |
rmd.addColumn("11p");
|
|
|
|
|
|
|
+ |
return rmd;
|
|
|
+ |
</pre>
|
|
|
|
|
|
|
+ |
----
|
|
|
|
|
|
|
+ |
''Context Script:''
|
|
|
|
|
|
|
+ |
<pre>import com.urbancode.anthill3.dashboard.*;
|
|
|
+ |
import com.urbancode.anthill3.domain.reporting.*;
|
|
|
+ |
import com.urbancode.anthill3.domain.userprofile.*;
|
|
|
+ |
import com.urbancode.anthill3.domain.workflow.WorkflowStatusEnum;
|
|
|
+ |
import java.util.*;
|
|
|
|
|
|
|
|
|
|
|
+ |
BuildLifeWorkflowCaseSummary[] summaries = DashboardFactory.getInstance().getBuildLifeWorkflowSummaries(null, null, new Integer(100));
|
|
|
|
|
|
|
+ |
// Get the timezone for the current user
|
|
|
+ |
TimeZone timeZone = UserProfileFactory.getTimeZone();
|
|
|
+ |
Calendar cal = Calendar.getInstance(timeZone);
|
|
|
|
|
|
|
+ |
int[] hoursCount = new int[24];
|
|
|
+ |
int[] hoursCountFailed = new int[24];
|
|
|
|
|
|
|
+ |
for (int i = 0; i < summaries.length; i++) {
|
|
|
+ |
if (summaries[i].getEndDate() != null) {
|
|
|
+ |
Calendar tempCal = Calendar.getInstance(timeZone);
|
|
|
+ |
tempCal.setTime(summaries[i].getEndDate());
|
|
|
+ |
boolean failed = (summaries[i].getStatus() == WorkflowStatusEnum.FAILED);
|
|
|
|
|
|
|
+ |
if (failed) {
|
|
|
+ |
hoursCountFailed[tempCal.get(Calendar.HOUR_OF_DAY)]++;
|
|
|
+ |
}
|
|
|
+ |
else {
|
|
|
+ |
hoursCount[tempCal.get(Calendar.HOUR_OF_DAY)]++;
|
|
|
+ |
}
|
|
|
+ |
}
|
|
|
+ |
}
|
|
|
|
|
|
|
+ |
ReportOutput output = new ReportOutput(metaData);
|
|
|
|
|
|
|
|
|
|
|
+ |
ReportRow row = new ReportRow(output, "Failed");
|
|
|
+ |
row.setColumnValue("12a", hoursCountFailed[0] + "");
|
|
|
+ |
row.setColumnValue("1a", hoursCountFailed[1] + "");
|
|
|
+ |
row.setColumnValue("2a", hoursCountFailed[2] + "");
|
|
|
+ |
row.setColumnValue("3a", hoursCountFailed[3] + "");
|
|
|
+ |
row.setColumnValue("4a", hoursCountFailed[4] + "");
|
|
|
+ |
row.setColumnValue("5a", hoursCountFailed[5] + "");
|
|
|
+ |
row.setColumnValue("6a", hoursCountFailed[6] + "");
|
|
|
+ |
row.setColumnValue("7a", hoursCountFailed[7] + "");
|
|
|
+ |
row.setColumnValue("8a", hoursCountFailed[8] + "");
|
|
|
+ |
row.setColumnValue("9a", hoursCountFailed[9] + "");
|
|
|
+ |
row.setColumnValue("10a", hoursCountFailed[10] + "");
|
|
|
+ |
row.setColumnValue("11a", hoursCountFailed[11] + "");
|
|
|
+ |
row.setColumnValue("12p", hoursCountFailed[12] + "");
|
|
|
+ |
row.setColumnValue("1p", hoursCountFailed[13] + "");
|
|
|
+ |
row.setColumnValue("2p", hoursCountFailed[14] + "");
|
|
|
+ |
row.setColumnValue("3p", hoursCountFailed[15] + "");
|
|
|
+ |
row.setColumnValue("4p", hoursCountFailed[16] + "");
|
|
|
+ |
row.setColumnValue("5p", hoursCountFailed[17] + "");
|
|
|
+ |
row.setColumnValue("6p", hoursCountFailed[18] + "");
|
|
|
+ |
row.setColumnValue("7p", hoursCountFailed[19] + "");
|
|
|
+ |
row.setColumnValue("8p", hoursCountFailed[20] + "");
|
|
|
+ |
row.setColumnValue("9p", hoursCountFailed[21] + "");
|
|
|
+ |
row.setColumnValue("10p", hoursCountFailed[22] + "");
|
|
|
+ |
row.setColumnValue("11p", hoursCountFailed[23] + "");
|
|
|
+ |
output.addRow(row);
|
|
|
|
|
|
|
+ |
ReportRow row = new ReportRow(output, "Successful");
|
|
|
+ |
row.setColumnValue("12a", hoursCount[0] + "");
|
|
|
+ |
row.setColumnValue("1a", hoursCount[1] + "");
|
|
|
+ |
row.setColumnValue("2a", hoursCount[2] + "");
|
|
|
+ |
row.setColumnValue("3a", hoursCount[3] + "");
|
|
|
+ |
row.setColumnValue("4a", hoursCount[4] + "");
|
|
|
+ |
row.setColumnValue("5a", hoursCount[5] + "");
|
|
|
+ |
row.setColumnValue("6a", hoursCount[6] + "");
|
|
|
+ |
row.setColumnValue("7a", hoursCount[7] + "");
|
|
|
+ |
row.setColumnValue("8a", hoursCount[8] + "");
|
|
|
+ |
row.setColumnValue("9a", hoursCount[9] + "");
|
|
|
+ |
row.setColumnValue("10a", hoursCount[10] + "");
|
|
|
+ |
row.setColumnValue("11a", hoursCount[11] + "");
|
|
|
+ |
row.setColumnValue("12p", hoursCount[12] + "");
|
|
|
+ |
row.setColumnValue("1p", hoursCount[13] + "");
|
|
|
+ |
row.setColumnValue("2p", hoursCount[14] + "");
|
|
|
+ |
row.setColumnValue("3p", hoursCount[15] + "");
|
|
|
+ |
row.setColumnValue("4p", hoursCount[16] + "");
|
|
|
+ |
row.setColumnValue("5p", hoursCount[17] + "");
|
|
|
+ |
row.setColumnValue("6p", hoursCount[18] + "");
|
|
|
+ |
row.setColumnValue("7p", hoursCount[19] + "");
|
|
|
+ |
row.setColumnValue("8p", hoursCount[20] + "");
|
|
|
+ |
row.setColumnValue("9p", hoursCount[21] + "");
|
|
|
+ |
row.setColumnValue("10p", hoursCount[22] + "");
|
|
|
+ |
row.setColumnValue("11p", hoursCount[23] + "");
|
|
|
|
|
|
|
+ |
output.addRow(row);
|
|
|
|
|
|
|
+ |
return output;
|
|
|
+ |
</pre>
|
|
|
|
|
|
|
+ |
----
|
|
|
|
|
|
|
+ |
'''Related Content'''
|
|
|
|
|
|
|
+ |
[[AnthillPro Template Reports]]<br/>
|
|
|
+ |
[[Report Templates]]
|