public List<TableElement> getGroups(Unittype unittype, XAPS xaps) throws Exception { List<TableElement> list = new ArrayList<TableElement>(); List<String> topLevelGroupnames = convertGroupsToNames(unittype.getGroups().getTopLevelGroups()); Collections.sort(topLevelGroupnames, String.CASE_INSENSITIVE_ORDER); for (String groupname : topLevelGroupnames) { Group group = unittype.getGroups().getByName(groupname); getGroup(unittype, list, group, 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)); }