public void addAssociation(TableAssociation ass) { String indexKey = null; TableNode src = ass.getSource(); TableNode target = ass.getTarget(); String index1 = src.getName().split("_")[0]; String index2 = target.getName().split("_")[0]; if (index1.equals(index2)) { indexKey = index1; if (index1.length() > 12) indexKey = index1.substring(0, 11); } else { indexKey = "MIXED"; } kettleDao.addAssociation(ass, indexKey); }
// 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); }
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(); }
public int getTableCountByIndex(String index) { return kettleDao.getTableCountByIndex(index); }
public void deleteAssociation(TableAssociation ass) { kettleDao.deleteTableAssociation(ass); }
public int addDiagram(String indexKey, String diagramName) { return kettleDao.addDiagram(indexKey, diagramName); }
public void updateColumn(List<Column> colList) { kettleDao.updateTableColumn(colList); }
public void updateAssociations(List<TableAssociation> ass) { kettleDao.updateTableAssociation(ass); }
public Set<TableAssociation> getTableAssociationsOnly(String tableName) { return kettleDao.getTableAssociations(tableName, false); }
public List<Column> getTableColumns(String tableName) { List<Column> list = kettleDao.getTableColumnByTable(tableName); return list; }
public List<Diagram> getDiagramByIndex(String index) { return kettleDao.getDiagramListByIndex(index); }
public Set<TableAssociation> getTableAssociations(String tableName) { return kettleDao.getTableAssociations(tableName, true); }
public List<String> getTablesByModule(String module) { return kettleDao.getTablesByModule(module); }
public List<String> getAllModules() { return kettleDao.getAllModules(); }
public int updateDiagram(Long id, String text) { return kettleDao.updateDigram(id, text); }
public String getDiagramScript(Long id) { return kettleDao.getDiagramScript(id); }
public int deleteDiagram(Diagram diagram) { return kettleDao.deleteDiagram(diagram.getId()); }