use of org.talend.cwm.relational.TdView in project tdq-studio-se by Talend.
the class ViewFolderNode method loadChildren.
/*
* (non-Javadoc)
*
* @see org.talend.dataprofiler.core.model.nodes.AbstractFolderNode#loadChildren()
*/
@Override
public void loadChildren() {
// MODSCA 2008-03-14 load children also when no catalog is given, but a schema exists (e.g. for DB2 database)
Catalog catalog = SwitchHelpers.CATALOG_SWITCH.doSwitch((EObject) getParent());
if (catalog != null) {
loadChildrenLow(catalog, catalog, null, new ArrayList<TdView>());
} else {
Schema schema = SwitchHelpers.SCHEMA_SWITCH.doSwitch((EObject) getParent());
if (schema != null) {
loadChildrenLow(schema, null, schema, new ArrayList<TdView>());
}
}
super.loadChildren();
}
use of org.talend.cwm.relational.TdView in project tdq-studio-se by Talend.
the class RepositoryNodeHelperRealTest method addView.
public TdView addView(Catalog catalog, String tableName) {
TdView createTdView = RelationalFactory.eINSTANCE.createTdView();
createTdView.setName(tableName);
List<TdView> tables = new ArrayList<TdView>();
tables.add(createTdView);
CatalogHelper.addViews(tables, catalog);
return createTdView;
}
use of org.talend.cwm.relational.TdView in project tdq-studio-se by Talend.
the class DrillDownEditorInputRealTest method testGetColumnsByTdColumnCase2.
/**
* Test method for
* {@link org.talend.dataprofiler.core.ui.editor.analysis.drilldown.DrillDownEditorInput#getColumnsByTdColumn(org.talend.cwm.relational.TdColumn)}
* . case2 :for view case
*/
@Test
public void testGetColumnsByTdColumnCase2() {
TdColumn currentTdColumn = RelationalFactory.eINSTANCE.createTdColumn();
TdColumn secondTdColumn = RelationalFactory.eINSTANCE.createTdColumn();
TdView createTdView = RelationalFactory.eINSTANCE.createTdView();
List<TdColumn> tdColumns = new ArrayList<TdColumn>();
tdColumns.add(currentTdColumn);
tdColumns.add(secondTdColumn);
ViewHelper.addColumns(createTdView, tdColumns);
DrillDownEditorInput drillDownEditorInput = new DrillDownEditorInput();
List<TdColumn> allofTdColumn = drillDownEditorInput.getColumnsByTdColumn(currentTdColumn);
Assert.assertEquals(createTdView.getColumns().size(), allofTdColumn.size());
}
use of org.talend.cwm.relational.TdView in project tdq-studio-se by Talend.
the class ChartTableFactoryTest method testIsDqRule_5.
// test for the analyzed element is not a table
@Test
public void testIsDqRule_5() {
TdView createTdView = RelationalFactory.eINSTANCE.createTdView();
dqRule.setAnalyzedElement(createTdView);
Assert.assertFalse(ChartTableFactory.isDqRule(dqRule));
}
use of org.talend.cwm.relational.TdView in project tdq-studio-se by Talend.
the class ReadItemConnectionFile method test.
@Test
public void test() {
EMFUtil emfUtil = new EMFUtil();
File file = new File("data/my_0.1.item");
System.out.println("Loading file " + file.getAbsolutePath());
ResourceSet rs = emfUtil.getResourceSet();
Resource r = rs.getResource(URI.createFileURI(file.getAbsolutePath()), true);
// TreeIterator<EObject> allContents = r.getAllContents();
// while (allContents.hasNext()) {
// EObject metadata = allContents.next();
// System.out.println(metadata);
// }
// should contain the connection, then catalog/schema, then tables, then columns
EList<EObject> contents = r.getContents();
// switch class that returns a connection when it finds one.
ConnectionSwitch<Connection> connectionFinder = new ConnectionSwitch<Connection>() {
/*
* (non-Javadoc)
*
* @see
* org.talend.core.model.metadata.builder.connection.util.ConnectionSwitch#caseConnection(org.talend.core
* .model.metadata.builder.connection.Connection)
*/
@Override
public Connection caseConnection(Connection object) {
return object;
}
};
// loop on all the content of the resource
for (EObject eObject : contents) {
Connection connection = connectionFinder.doSwitch(eObject);
if (connection != null) {
Set<Catalog> allCatalogs = ConnectionHelper.getAllCatalogs(connection);
for (Catalog catalog : allCatalogs) {
System.out.println("## Catalog: " + catalog.getName());
System.out.println("\t## Tables");
List<TdTable> tables = CatalogHelper.getTables(catalog);
for (TdTable tdTable : tables) {
System.out.println("\t\t" + tdTable.getName());
List<TdColumn> columns = TableHelper.getColumns(tdTable);
if (!columns.isEmpty()) {
System.out.println("\t\t\t## Columns");
}
for (TdColumn tdColumn : columns) {
System.out.println("\t\t\t\t" + tdColumn.getName());
}
}
System.out.println("\t## Views");
List<TdView> views = CatalogHelper.getViews(catalog);
for (TdView tdView : views) {
System.out.println("\t\t" + tdView.getName());
List<TdColumn> columns = ViewHelper.getColumns(tdView);
if (!columns.isEmpty()) {
System.out.println("\t\t\t## Columns");
}
for (TdColumn tdColumn : columns) {
System.out.println("\t\t\t\t" + tdColumn.getName());
}
}
}
}
}
}
Aggregations