code: public void scanTreeForExcludes(StringBuffer sb, String strParentFolderID)
      {
          m_recPackagesExclude.setKeyArea(Packages.PARENT_FOLDER_ID_KEY);
          StringSubFileFilter listener = null;
          m_recPackagesExclude.addListener(listener = new StringSubFileFilter(strParentFolderID, Packages.PARENT_FOLDER_ID, null, null, null, null));
          try {
              java.util.List<String> list = new ArrayList<String>();
              m_recPackagesExclude.close();
              while (m_recPackagesExclude.hasNext())
              {
                  m_recPackagesExclude.next();
                  if (m_recPackagesExclude.getField(Packages.EXCLUDE).getState() == true)
                      sb.append("<exclude>" + this.getTree(m_recPackagesExclude) + "</exclude>\n");
                  list.add(m_recPackagesExclude.getField(Packages.ID).toString());
              }
              m_recPackagesExclude.removeListener(listener, true);
              listener = null;
              for (String strFolderID : list)
              {
                  this.scanTreeForExcludes(sb, strFolderID);
              }
          } catch (DBException ex) {
              ex.printStackTrace();
              if (listener != null)
                  m_recPackagesExclude.removeListener(listener, true);
          }
      }
docs: ScanTreeForExcludes Method.