public List<TableElement> getTriggers(Unittype unittype, XAPS xaps) throws Exception { List<TableElement> list = new ArrayList<TableElement>(); List<String> topLevelTriggerNames = convertTriggersToNames(unittype.getTriggers().getTopLevelTriggers()); Collections.sort(topLevelTriggerNames, String.CASE_INSENSITIVE_ORDER); for (String triggername : topLevelTriggerNames) { Trigger trigger = unittype.getTriggers().getByName(triggername); getTrigger(unittype, list, trigger, WebConstants.PARAMETERS_START_INDENTATION); } return list; }
/** * Find top level jobs. * * @param unittype the unittype * @return the list */ private List<Job> findTopLevelJobs(Unittype unittype) { Job[] jobs = unittype.getJobs().getJobs(); List<Job> topLevel = new ArrayList<Job>(); for (Job j : jobs) { if (j.getDependency() == null) topLevel.add(j); } return topLevel; }
public List<TableElement> getJobs(Unittype unittype) throws Exception { List<TableElement> list = new ArrayList<TableElement>(); List<Job> topLevelJobs = findTopLevelJobs(unittype); if (topLevelJobs.size() > 0) { List<String> topLevelJobnames = convertJobsToNames(topLevelJobs); Collections.sort(topLevelJobnames, String.CASE_INSENSITIVE_ORDER); for (String jobname : topLevelJobnames) { Job topJob = unittype.getJobs().getByName(jobname); getJob(unittype, list, topJob, WebConstants.PARAMETERS_START_INDENTATION); } } return list; }
private void getGroup(Unittype unittype, List<TableElement> list, Group group, Integer nbsp) throws IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { String tableGroupId = getTableGroupId(group); Integer str = nbsp; if (group != null && group.getChildren().size() > 0) { list.add(new TableElement(tableGroupId, str, group, true)); List<String> childrenGroupnames = convertGroupsToNames(group.getChildren()); Collections.sort(childrenGroupnames, String.CASE_INSENSITIVE_ORDER); for (String childrenGroupname : childrenGroupnames) { Group g = unittype.getGroups().getByName(childrenGroupname); getGroup(unittype, list, g, nbsp + WebConstants.PARAMETERS_NEXT_INDENTATION); } } else list.add(new TableElement(tableGroupId, str, group, false)); }
/** * Gets the job. * * @param unittype the unittype * @param list the list * @param job the job * @param nbsp the nbsp * @return the job * @throws IllegalArgumentException the illegal argument exception * @throws SecurityException the security exception * @throws IllegalAccessException the illegal access exception * @throws InvocationTargetException the invocation target exception * @throws NoSuchMethodException the no such method exception */ private void getJob(Unittype unittype, List<TableElement> list, Job job, Integer nbsp) throws IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { String id = getTableJobId(job); Integer str = nbsp; if (getChildren(job).size() > 0) { list.add(new TableElement(id, str, job, true)); List<String> childrenJobnames = convertJobsToNames(getChildren(job)); Collections.sort(childrenJobnames, String.CASE_INSENSITIVE_ORDER); for (String childrenJobname : childrenJobnames) { Job childrenJob = unittype.getJobs().getByName(childrenJobname); getJob(unittype, list, childrenJob, nbsp + WebConstants.PARAMETERS_NEXT_INDENTATION); } } else list.add(new TableElement(id, str, job, false)); }