|
|
| Line 1: | |||
| + | This report will go through your originating workflows (it's trivial to change to all workflows) and list off what non-manual triggers are in place to kick them off. This report has to be used in conjunction with a report template such as the [[HTML Template]]. | ||
| + | ---- | ||
| + | ''Meta-Data Script:'' | ||
| + | <pre> | ||
| + | import com.urbancode.anthill3.domain.reporting.*; | ||
| + | ReportMetaData rmd = new ReportMetaData(); | ||
| + | rmd.addColumn("Project"); | ||
| + | rmd.addColumn("Branch"); | ||
| + | rmd.addColumn("Triggers"); | ||
| + | return rmd; | ||
| + | </pre> | ||
| + | ---- | ||
| + | ''Report Script:'' | ||
| + | <pre>import com.urbancode.anthill3.domain.profile.*; | ||
| + | import com.urbancode.anthill3.domain.project.*; | ||
| + | import com.urbancode.anthill3.domain.reporting.*; | ||
| + | import com.urbancode.anthill3.domain.trigger.*; | ||
| + | import com.urbancode.anthill3.domain.trigger.scheduled.*; | ||
| + | import com.urbancode.anthill3.domain.workflow.*; | ||
| + | import com.urbancode.anthill3.persistence.*; | ||
| + | Project[] projects = ProjectFactory.getInstance().restoreAll(); | ||
| + | ReportOutput output = new ReportOutput(metaData); | ||
| + | for (int i = 0; i < projects.length; i++) { | ||
| + | Workflow[] workflows = projects[i].getOriginatingWorkflowArray(); | ||
| + | project = null; | ||
| + | for (int j = 0; j < workflows.length; j++) { | ||
| + | ReportRow row = new ReportRow(output, " "); | ||
| + | if (project != projects[i]) { | ||
| + | row.setColumnValue("Project", projects[i].getName()); | ||
| + | project = projects[i]; | ||
| + | } | ||
| + | else { | ||
| + | row.setColumnValue("Project", " "); | ||
| + | } | ||
| + | |||
| + | row.setColumnValue("Branch", workflows[j].getName()); | ||
| + | StringBuffer depBuf = new StringBuffer(); | ||
| + | Trigger[] triggers = workflows[j].getTriggerArray(); | ||
| + | StringBuffer trigBuf = new StringBuffer(); | ||
| + | if (workflows[j].isOriginating() && | ||
| + | workflows[j].getBuildProfile().getSourceConfig(). | ||
| + | getRepository().getRepositoryTrigger() != null) { | ||
| + | trigBuf.append("Builds on Commit"); | ||
| + | if (triggers.length != 0) { | ||
| + | trigBuf.append("<br>"); | ||
| + | } | ||
| + | } | ||
| + | for (int k = 0; k < triggers.length; k++) { | ||
| + | trigBuf.append(triggers[k].getName()); | ||
| + | if (triggers[k] instanceof ScheduledTrigger) { | ||
| + | trigBuf.append(" - Fires next at: "); | ||
| + | trigBuf.append(triggers[k].getSchedule(). | ||
| + | getNextOccurrence().toString()); | ||
| + | } | ||
| + | if (k < triggers.length - 1) { | ||
| + | trigBuf.append("<br>"); | ||
| + | } | ||
| + | } | ||
| + | row.setColumnValue("Triggers", trigBuf.toString()); | ||
| + | output.addRow(row); | ||
| + | } | ||
| + | } | ||
| + | return output; | ||
| + | </pre> | ||
| + | ---- | ||
| + | '''Related Content''' | ||
| + | [[AnthillPro Template Reports]]<br/> | ||
| + | [[Report Templates]] | ||