Ejemplo n.º 1
0
 // build a TreeModel base on a table and its columns
 public TreeModel getTableColumnByModel(String module) {
   List<Column> list = kettleDao.getTableColumnByModule(module);
   DefaultMutableTreeNode root = new DefaultMutableTreeNode(module);
   DefaultMutableTreeNode parent = null;
   String previous = null;
   for (Column col : list) {
     // new table, add the table to the root
     if (!col.getTable().equals(previous)) {
       parent = new DefaultMutableTreeNode(col.getTable());
       previous = col.getTable();
       root.add(parent);
     }
     parent.add(new DefaultMutableTreeNode(col));
   }
   return new DefaultTreeModel(root);
 }
Ejemplo n.º 2
0
 public String getSelectClause(String table) {
   StringBuffer sb = new StringBuffer();
   String module = table.split("_")[0];
   List<Column> list = kettleDao.getQueryableColumn(module, table);
   int i = 0;
   for (Column col : list) {
     i++;
     sb.append(col.getColName()).append(" AS ");
     if (col.getLabel().indexOf("\"") > -1) {
       sb.append(col.getLabel());
     } else {
       sb.append("\"").append(col.getLabel()).append("\"");
     }
     if (i < list.size()) {
       sb.append(",").append(token);
     }
   }
   return sb.toString();
 }