|
|
| Line 1: | |||
| + | This report shows a user the total number of Codestation artifacts. 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("Build Life"); | ||
| + | rmd.addColumn("Stamp"); | ||
| + | rmd.addColumn("Status"); | ||
| + | rmd.addColumn("Set"); | ||
| + | rmd.addColumn("Files"); | ||
| + | return rmd; | ||
| + | </pre> | ||
| + | ---- | ||
| + | ''Context Script:'' | ||
| + | <pre>import com.urbancode.anthill3.domain.reporting.*; | ||
| + | import com.urbancode.anthill3.runtime.paths.CodestationPathHelper; | ||
| + | import com.urbancode.codestation2.domain.artifacts.*; | ||
| + | import com.urbancode.codestation2.domain.buildlife.*; | ||
| + | import com.urbancode.codestation2.domain.project.*; | ||
| + | import com.urbancode.codestation2.server.CodestationRepositoryFileHelper; | ||
| + | import com.urbancode.commons.fileutils.FileUtils; | ||
| + | import com.urbancode.devilfish.services.var.VarService; | ||
| + | import com.urbancode.devilfish.services.file.FileInfo; | ||
| + | import java.io.File; | ||
| + | ReportOutput output = new ReportOutput(metaData); | ||
| + | CodestationRepositoryFileHelper cs = CodestationRepositoryFileHelper.getInstance(); | ||
| + | CodestationCompatableProject[] projects = CodestationProjectFactory.getInstance().restoreAllCodestation(); | ||
| + | for (int p=0; p<projects.length; p++) { | ||
| + | CodestationBuildLife[] buildLives = CodestationBuildLifeFactory.getInstance().restoreAllForProject(projects[p]); | ||
| + | for (b=0; b<buildLives.length; b++) { | ||
| + | CodestationCompatableArtifactSet[] sets = cs.getPopulatedBuildLifeArtifactSetList(buildLives[b]); | ||
| + | for (int s=0; s<sets.length; s++) { | ||
| + | ReportRow row = new ReportRow(output, "1"); | ||
| + | row.setColumnValue("Project", projects[p].getName()); | ||
| + | row.setColumnValue("Build Life", buildLives[b].getId().toString()); | ||
| + | row.setColumnValue("Stamp", buildLives[b].getLatestStampValue()); | ||
| + | row.setColumnValue("Status", buildLives[b].getLatestStatusName()); | ||
| + | row.setColumnValue("Set", sets[s].getName()); | ||
| + | String rawRepoLifeSetPath = CodestationPathHelper.getInstance().getSetPath(buildLives[b], sets[s]); | ||
| + | String repoLifeSetPath = VarService.getInstance().resolve(rawRepoLifeSetPath); | ||
| + | File baseSetDir = new File(repoLifeSetPath); | ||
| + | FileInfo[] files = cs.getBuildLifeArtifactSetFileInfo(buildLives[b], sets[s]); | ||
| + | StringBuffer sb = new StringBuffer(); | ||
| + | for (int f=0; f<files.length; f++) { | ||
| + | if (!".ahs.dig".equals(files[f].getName())) { | ||
| + | sb.append(FileUtils.getRelativeFileName(baseSetDir, new File(files[f].getPath()))).append("<br/>"); | ||
| + | } | ||
| + | } | ||
| + | row.setColumnValue("Files", sb.toString()); | ||
| + | output.addRow(row); | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | return output; | ||
| + | </pre> | ||
| + | ---- | ||
| + | '''Related Content''' | ||
| + | [[AnthillPro Template Reports]]<br/> | ||
| + | [[Report Templates]] | ||