Library Job Usage

This report shows the user a list of library jobs, the folder they reside in, and what they are used by. This report has to be used in conjunction with a report template such as the HTML Template.


Meta-Data Script:

import com.urbancode.anthill3.domain.reporting.*;

ReportMetaData rmd = new ReportMetaData();

rmd.addColumn("Job");
rmd.addColumn("Containing Folder");
rmd.addColumn("Used By");

return rmd;

Report Script:

import com.urbancode.anthill3.domain.jobconfig.*;
import com.urbancode.anthill3.domain.profile.*;
import com.urbancode.anthill3.domain.project.*;
import com.urbancode.anthill3.domain.reporting.*;
import com.urbancode.anthill3.domain.workflow.*;
import com.urbancode.anthill3.persistence.*;

JobConfig[] jobLibraryArray = JobConfigFactory.getInstance().restoreAllLibrary();
ReportOutput output = new ReportOutput(metaData);

for (int i = 0; i < jobLibraryArray.length; i++) {
  ReportRow row = new ReportRow(output, "1");
  row.setColumnValue("Job", jobLibraryArray[i].getName());     

  String[] projectNames =    JobConfigFactory.getInstance().getProjectNamesUsingJobConfig(jobLibraryArray[i]);
  StringBuffer usedBy = new StringBuffer();
  for (int j = 0; j < projectNames.length; j++) {
    usedBy.append(projectNames[j] + "\n");
  }
  
  row.setColumnValue("Used By", usedBy.toString());
     
  folder = jobLibraryArray[i].getFolder();
  String where = folder.getName();
  while(folder.getParent() != null && folder.getParent().getParent() != null) {
     folder = folder.getParent();
     where = folder.getName() + "/" + where; 
  }
  row.setColumnValue("Containing Folder", where);
  output.addRow(row);
}

return output;

Related Content

AnthillPro Template Reports
Report Templates