[Anthill-pro] Reports
Yanko, Curtis
curt_yanko at uhc.com
Mon Jan 14 13:02:11 CST 2008
Here is Builds by month for 2008:
Meta-data script:
import com.urbancode.anthill3.domain.project.*;
import com.urbancode.anthill3.domain.reporting.*;
ReportMetaData rmd = new ReportMetaData();
// Add some parameters to the report
SelectParamMetaData params = new SelectParamMetaData();
Project[] allMyProjectsArray =
ProjectFactory.getInstance().restoreAllActive();
String[] labels = new String[allMyProjectsArray.length + 1];
String[] values = new String[allMyProjectsArray.length + 1];
for (int i = 0; i < allMyProjectsArray.length; i++) {
labels[i] = allMyProjectsArray[i].getName();
values[i] = allMyProjectsArray[i].getId().toString();
}
labels[allMyProjectsArray.length] = "All";
values[allMyProjectsArray.length] = "all";
params.setLabels(labels);
params.setValues(values);
params.setName("project");
params.setLabel("Project");
params.setDescription("Select the project to evaluate successful and
failed executions of that project. Or select ''All'' to display all
projects together.");
// rmd.addParameter(params);
// Configure columns
rmd.addColumn("Jan");
rmd.addColumn("Feb");
rmd.addColumn("Mar");
rmd.addColumn("Apr");
rmd.addColumn("May");
rmd.addColumn("Jun");
rmd.addColumn("Jul");
rmd.addColumn("Aug");
rmd.addColumn("Sep");
rmd.addColumn("Oct");
rmd.addColumn("Nov");
rmd.addColumn("Dec");
return rmd;
Script:
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.*;
// Get the timezone for the current user
TimeZone timeZone = UserProfileFactory.getTimeZone();
Calendar cal = Calendar.getInstance(timeZone);
//Set our Date range
Date startDate = new java.util.Date(108, 0, 1);
Date endDate = new java.util.Date(108, 11, 31);
// Get workflows
BuildLifeWorkflowCaseSummary[] summaries =
DashboardFactory.getInstance().getBuildLifeWorkflowSummaries(null,
startDate, endDate);
int janCount = 0;
int febCount = 0;
int marCount = 0;
int aprCount = 0;
int mayCount = 0;
int junCount = 0;
int julCount = 0;
int augCount = 0;
int sepCount = 0;
int octCount = 0;
int novCount = 0;
int decCount = 0;
int failedJanCount = 0;
int failedFebCount = 0;
int failedMarCount = 0;
int failedAprCount = 0;
int failedMayCount = 0;
int failedJunCount = 0;
int failedJulCount = 0;
int failedAugCount = 0;
int failedSepCount = 0;
int failedOctCount = 0;
int failedNovCount = 0;
int failedDecCount = 0;
for (int i = 0; i < summaries.length; i++) {
Calendar tempCal = (Calendar) cal.clone();
tempCal.setTime(summaries[i].getEndDate());
boolean failed = (summaries[i].getStatus() ==
WorkflowStatusEnum.FAILED || summaries[i].getStatus() ==
WorkflowStatusEnum.ERROR);
int dow = tempCal.get(Calendar.MONTH);
switch (dow) {
case Calendar.JANUARY:
if (failed) failedJanCount++; else janCount++;
break;
case Calendar.FEBRUARY:
if (failed) failedFebCount++; else febCount++;
break;
case Calendar.MARCH:
if (failed) failedMarCount++; else marCount++;
break;
case Calendar.APRIL:
if (failed) failedAprCount++; else aprCount++;
break;
case Calendar.MAY:
if (failed) failedMayCount++; else mayCount++;
break;
case Calendar.JUNE:
if (failed) failedJunCount++; else junCount++;
break;
case Calendar.JULY:
if (failed) failedJulCount++; else julCount++;
break;
case Calendar.AUGUST:
if (failed) failedAugCount++; else augCount++;
break;
case Calendar.SEPTEMBER:
if (failed) failedSepCount++; else sepCount++;
break;
case Calendar.OCTOBER:
if (failed) failedOctCount++; else octCount++;
break;
case Calendar.NOVEMBER:
if (failed) failedNovCount++; else novCount++;
break;
case Calendar.DECEMBER:
if (failed) failedDecCount++; else decCount++;
break;
}
}
ReportOutput output = new ReportOutput(metaData);
ReportRow row = new ReportRow(output, "Failed");
row.setColumnValue("Jan", failedJanCount + "");
row.setColumnValue("Feb", failedFebCount + "");
row.setColumnValue("Mar", failedMarCount + "");
row.setColumnValue("Apr", failedAprCount + "");
row.setColumnValue("May", failedMayCount + "");
row.setColumnValue("Jun", failedJunCount + "");
row.setColumnValue("Jul", failedJulCount + "");
row.setColumnValue("Aug", failedAugCount + "");
row.setColumnValue("Sep", failedSepCount + "");
row.setColumnValue("Oct", failedOctCount + "");
row.setColumnValue("Nov", failedNovCount + "");
row.setColumnValue("Dec", failedDecCount + "");
output.addRow(row);
ReportRow row = new ReportRow(output, "Successful");
row.setColumnValue("Jan", janCount + "");
row.setColumnValue("Feb", febCount + "");
row.setColumnValue("Mar", marCount + "");
row.setColumnValue("Apr", aprCount + "");
row.setColumnValue("May", mayCount + "");
row.setColumnValue("Jun", junCount + "");
row.setColumnValue("Jul", julCount + "");
row.setColumnValue("Aug", augCount + "");
row.setColumnValue("Sep", sepCount + "");
row.setColumnValue("Oct", octCount + "");
row.setColumnValue("Nov", novCount + "");
row.setColumnValue("Dec", decCount + "");
output.addRow(row);
return output;
We're working on cleaning the date handling. I also did a builds by
Quarter from this but that should be straight forward.
===
-Curt
W: 860.702.9059
M: 860.881.2050
-----Original Message-----
From: anthill-pro-bounces at lists.urbancode.com
[mailto:anthill-pro-bounces at lists.urbancode.com] On Behalf Of Ryan Smith
Sent: Monday, January 14, 2008 11:33 AM
To: AnthillPro user and support list.
Cc: AnthillPro user and support list.
Subject: Re: [Anthill-pro] Reports
Curtis,
Unfortunately, that method requires the project id. I'm looking for one
that works across all projects but I'm not seeing one yet.
Ryan
Yanko, Curtis wrote:
> Tried this but no joy:
>
> BuildLifeWorkflowCaseSummary[] summaries =
> DashboardFactory.getInstance().getBuildLifeWorkflowSummaries(null, new
> java.util.Date(2008, 1, 2), new java.util.Date(2008, 12, 31));
>
> ===
> -Curt
> W: 860.702.9059
> M: 860.881.2050
>
>
> ----------------------------------------------------------------------
> --
> *From:* anthill-pro-bounces at lists.urbancode.com
> [mailto:anthill-pro-bounces at lists.urbancode.com] *On Behalf Of *Yanko,
> Curtis
> *Sent:* Monday, January 14, 2008 11:09 AM
> *To:* AnthillPro user and support list.; AnthillPro user and support
list.
> *Subject:* RE: [Anthill-pro] Reports
>
> Ok, in remoting I see this:
>
>
>
> getBuildLifeWorkflowSummaries
>
> public BuildLifeWorkflowCaseSummary
<http://ahpstage.uhc.com/tools/remoting/anthill3-remoting/api/com/urbanc
ode/anthill3/dashboard/BuildLifeWorkflowCaseSummary.html>[]
*getBuildLifeWorkflowSummaries*(java.lang.Long projectId,
>
java.lang.Integer start,
>
java.lang.Integer count)
> throws
> PersistenceException
> <http://ahpstage.uhc.com/tools/remoting/anthill3-remoting/api/com/urba
> ncode/anthill3/domain/persistent/PersistenceException.html>
>
> *Throws:*
> |PersistenceException
>
> <http://ahpstage.uhc.com/tools/remoting/anthill3-remoting/api/com/urba
> ncode/anthill3/domain/persistent/PersistenceException.html>|
>
> ----------------------------------------------------------------------
> --
>
>
> getBuildLifeWorkflowSummaries
>
> public BuildLifeWorkflowCaseSummary
<http://ahpstage.uhc.com/tools/remoting/anthill3-remoting/api/com/urbanc
ode/anthill3/dashboard/BuildLifeWorkflowCaseSummary.html>[]
*getBuildLifeWorkflowSummaries*(java.lang.Long projectId,
>
java.util.Date startDate,
>
java.util.Date endDate)
> throws
> PersistenceException
> <http://ahpstage.uhc.com/tools/remoting/anthill3-remoting/api/com/urba
> ncode/anthill3/domain/persistent/PersistenceException.html>
>
> *Throws:*
> |PersistenceException
>
> <http://ahpstage.uhc.com/tools/remoting/anthill3-remoting/api/com/urba
> ncode/anthill3/domain/persistent/PersistenceException.html>|
>
> ||
> ||
> |So I'm guessing that the Days-of-the-week script just gets the last
> |100
> build lifes??? and I should use this second approach and set my dates
> from Jan 1 to Dec 31 of 2008.|
> ||
> |What's the synatax fpor that? Would I set in the Meta-data script?|
> ||
>
> ===
> -Curt
> W: 860.702.9059
> M: 860.881.2050
>
>
> ----------------------------------------------------------------------
> --
> *From:* anthill-pro-bounces at lists.urbancode.com
> [mailto:anthill-pro-bounces at lists.urbancode.com] *On Behalf Of *Yanko,
> Curtis
> *Sent:* Monday, January 14, 2008 10:55 AM
> *To:* AnthillPro user and support list.
> *Subject:* RE: [Anthill-pro] Reports
>
> Ok, first crack at Builds by Month:
>
> It essentially works but I am only getting builds for January ( and
> probably not all of it even).
>
> I did a modify job on the Days-of-the-week report and this line is
> where I think I'm running into trouble:
>
> // Get workflows for the last 7 days for the right project
> BuildLifeWorkflowCaseSummary[] summaries =
> DashboardFactory.getInstance().getBuildLifeWorkflowSummaries(null,
> null, new Integer(100));
>
> I didn't modify it but the comment and that integer 100 are scaring
me.
>
> Now, ideally I'd like to limit this to 2008 and have a seperate report
> for 2007 (which I'm willing to hard code into the script)
>
> Thoughts on approach?
>
> ===
> -Curt
> W: 860.702.9059
> M: 860.881.2050
>
>
>
>
> This e-mail, including attachments, may include confidential and/or
> proprietary information, and may be used only by the person or entity
> to which it is addressed. If the reader of this e-mail is not the
> intended recipient or his or her authorized agent, the reader is
> hereby notified that any dissemination, distribution or copying of
> this e-mail is prohibited. If you have received this e-mail in error,
> please notify the sender by replying to this message and delete this
e-mail immediately.
>
>
> This e-mail, including attachments, may include confidential and/or
> proprietary information, and may be used only by the person or entity
> to which it is addressed. If the reader of this e-mail is not the
> intended recipient or his or her authorized agent, the reader is
> hereby notified that any dissemination, distribution or copying of
> this e-mail is prohibited. If you have received this e-mail in error,
> please notify the sender by replying to this message and delete this
e-mail immediately.
>
>
> This e-mail, including attachments, may include confidential and/or
> proprietary information, and may be used only by the person or entity
> to which it is addressed. If the reader of this e-mail is not the
> intended recipient or his or her authorized agent, the reader is
> hereby notified that any dissemination, distribution or copying of
> this e-mail is prohibited. If you have received this e-mail in error,
> please notify the sender by replying to this message and delete this
e-mail immediately.
>
>
> ----------------------------------------------------------------------
> --
>
> _______________________________________________
> Anthill-pro mailing list
> Anthill-pro at lists.urbancode.com
> http://lists.urbancode.com/mailman/listinfo/anthill-pro
--
===========================================================
Ryan Smith. 2044 Euclid Ave., Suite 600
Lead Developer Cleveland, Ohio 44115
Urbancode, Inc.
email: rws at urbancode.com
web: www.urbancode.com phone: 216-858-9000
web: www.anthillpro.com fax: 216-858-9602
===========================================================
_______________________________________________
Anthill-pro mailing list
Anthill-pro at lists.urbancode.com
http://lists.urbancode.com/mailman/listinfo/anthill-pro
This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity to
which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified
that any dissemination, distribution or copying of this e-mail is
prohibited. If you have received this e-mail in error, please notify the
sender by replying to this message and delete this e-mail immediately.
More information about the Anthill-pro
mailing list