private String toRefSect1(String scriptName,Collection<SubCommand> subCommands){
  if (subCommands.isEmpty()) {
    return "";
  }
  Map<String,Object> map=new HashMap<>();
  map.put("name",scriptName);
  map.put("title",REF_TITLE_SUBCOMMANDS.get());
  map.put("info",getDocSubcommandsDescriptionSupplement());
  map.put("intro",REF_INTRO_SUBCOMMANDS.get(scriptName));
  if (scriptName.equals("dsconfig")) {
    map.put("isItemizedList",true);
  }
  List<String> scUsageList=new ArrayList<>();
  for (  SubCommand subCommand : subCommands) {
    if (subCommand.isHidden()) {
      continue;
    }
    if (scriptName.equals("dsconfig")) {
      scUsageList.add(getSubCommandListItem(scriptName,subCommand));
    }
 else {
      scUsageList.add(toRefSect2(scriptName,subCommand));
    }
  }
  map.put("subcommands",scUsageList);
  StringBuilder sb=new StringBuilder();
  applyTemplate(sb,"refSect1.ftl",map);
  return sb.toString();
}

private String toRefSect1 ( String scriptName , Collection < SubCommand > subCommands ) { if ( subCommands . isEmpty ( ) ) { return "" ; } Map < String , Object > map = new HashMap < > ( ) ; map . put ( "name" , scriptName ) ; map . put ( "title" , REF_TITLE_SUBCOMMANDS . get ( ) ) ; map . put ( "info" , getDocSubcommandsDescriptionSupplement ( ) ) ; map . put ( "intro" , REF_INTRO_SUBCOMMANDS . get ( scriptName ) ) ; if ( scriptName . equals ( "dsconfig" ) ) { map . put ( "isItemizedList" , true ) ; } List < String > scUsageList = new ArrayList < > ( ) ; for ( SubCommand subCommand : subCommands ) { if ( subCommand . isHidden ( ) ) { continue ; } if ( scriptName . equals ( "dsconfig" ) ) { scUsageList . add ( getSubCommandListItem ( scriptName , subCommand ) ) ; } else { scUsageList . add ( toRefSect2 ( scriptName , subCommand ) ) ; } } map . put ( "subcommands" , scUsageList ) ; StringBuilder sb = new StringBuilder ( ) ; applyTemplate ( sb , "refSect1.ftl" , map ) ; return sb . toString ( ) ; }
returns a generated docbook xml refsect1 element for all subcommands .
