use of org.talend.dq.nodes.DBColumnRepNode in project tdq-studio-se by Talend.
the class RepositoryNodeHelperRealTest method testCreateMysqlColumnRepositoryNode.
/**
* Test method for
* {@link org.talend.dq.helper.RepositoryNodeHelper#createRepositoryNode(orgomg.cwm.objectmodel.core.ModelElement)}.
* mysql case find column node
*/
@Test
public void testCreateMysqlColumnRepositoryNode() {
// $NON-NLS-1$
DatabaseConnectionItem createConnectionItem = createDataBaseConnection("conn1", null, false);
// $NON-NLS-1$
Catalog addCatalog = this.addCatalog(createConnectionItem.getConnection(), "catalog1");
// $NON-NLS-1$
TdTable addTable = this.addTable(addCatalog, "table1");
// $NON-NLS-1$
TdColumn addColumn = this.addColumn(addTable, "column1");
try {
ProxyRepositoryFactory.getInstance().save(createConnectionItem, null);
} catch (PersistenceException e) {
log.error(e, e);
Assert.fail(e.getMessage());
}
RepositoryNode createRepositoryNode = RepositoryNodeHelper.createRepositoryNode(addColumn);
if (createRepositoryNode != null) {
IRepositoryViewObject object = createRepositoryNode.getObject();
Assert.assertTrue(createRepositoryNode instanceof DBColumnRepNode);
Assert.assertTrue(object != null);
Assert.assertTrue(object instanceof MetadataColumnRepositoryObject);
Assert.assertTrue(object.getId().equals(addColumn.getName()));
Assert.assertTrue(object.getLabel().equals(addColumn.getName()));
Assert.assertTrue(object.getRepositoryNode() != null);
Assert.assertTrue(createRepositoryNode.getProperties(EProperties.LABEL).equals(ERepositoryObjectType.METADATA_CON_COLUMN));
Assert.assertTrue(createRepositoryNode.getProperties(EProperties.CONTENT_TYPE).equals(ERepositoryObjectType.METADATA_CON_COLUMN));
Assert.assertTrue(createRepositoryNode.getParent().getParent().getParent().getParent().getParent() != null);
}
}
use of org.talend.dq.nodes.DBColumnRepNode in project tdq-studio-se by Talend.
the class AbstractColumnDropTree method translateSelectedNodeIntoIndicator.
// translate the selected nodes into related indicators, without set the values to this.modelElementIndicators
// directly
protected ModelElementIndicator[] translateSelectedNodeIntoIndicator(Object[] objs) {
List<IRepositoryNode> reposList = RepNodeUtils.translateSelectedToStandardReposityoryNode(objs);
if (reposList.size() == 0) {
// this.modelElementIndicators = new ModelElementIndicator[0];
return new ModelElementIndicator[0];
}
// MOD qiongli 2011-1-7 feature 16796.
boolean isDelimitedFile = false;
if (objs != null && objs.length != 0) {
// MOD klliu 2011-02-16 feature 15387
isDelimitedFile = RepNodeUtils.isDelimitedFile(objs[0]);
if (!(reposList.get(0) instanceof DBColumnRepNode || isDelimitedFile)) {
return null;
}
}
List<ModelElementIndicator> modelElementIndicatorList = new ArrayList<ModelElementIndicator>();
for (ModelElementIndicator modelElementIndicator : getAllTheElementIndicator()) {
if (reposList.contains(modelElementIndicator.getModelElementRepositoryNode())) {
modelElementIndicatorList.add(modelElementIndicator);
reposList.remove(modelElementIndicator.getModelElementRepositoryNode());
}
}
for (IRepositoryNode repObj : reposList) {
ModelElementIndicator temp = isDelimitedFile ? ModelElementIndicatorHelper.createDFColumnIndicator(repObj) : ModelElementIndicatorHelper.createColumnIndicator(repObj);
modelElementIndicatorList.add(temp);
}
return modelElementIndicatorList.toArray(new ModelElementIndicator[modelElementIndicatorList.size()]);
}
use of org.talend.dq.nodes.DBColumnRepNode in project tdq-studio-se by Talend.
the class AnalysisColumnCompareTreeViewer method openColumnsSelectionDialog.
/**
* MOD mzhao 2009-02-03,remove the first parameter, extract it to class property filed for the convenience of
* invoking this method from cheat sheets.
*/
public void openColumnsSelectionDialog(TableViewer columnsElementViewer, List<RepositoryNode> columnsOfSectionPart, boolean isLeftPart) {
RepositoryNode connNode = masterPage.getConnComboSelectNode();
ColumnsSelectionDialog dialog = new ColumnsSelectionDialog(masterPage, null, // $NON-NLS-1$
DefaultMessagesImpl.getString("ColumnMasterDetailsPage.columnSelection"), // $NON-NLS-1$
columnsOfSectionPart, // $NON-NLS-1$
connNode, // $NON-NLS-1$
DefaultMessagesImpl.getString("ColumnMasterDetailsPage.columnSelections"));
if (dialog.open() == Window.OK) {
Object[] columns = dialog.getResult();
List<RepositoryNode> columnSet = new ArrayList<RepositoryNode>();
for (Object obj : columns) {
if (obj instanceof DBColumnRepNode) {
columnSet.add((RepositoryNode) obj);
}
}
columnsElementViewer.setInput(columnSet);
columnsOfSectionPart.clear();
columnsOfSectionPart.addAll(columnSet);
computeRefreshDataPreviewPart(isLeftPart, columnSet, columnsElementViewer);
updateBindConnection(masterPage, tableViewerPosStack);
}
}
use of org.talend.dq.nodes.DBColumnRepNode in project tdq-studio-se by Talend.
the class AnalysisColumnNominalIntervalTreeViewer method columns2Nodes.
public static List<DBColumnRepNode> columns2Nodes(List<TdColumn> tdColumns) {
List<DBColumnRepNode> nodes = new ArrayList<DBColumnRepNode>();
for (TdColumn tdColumn : tdColumns) {
RepositoryNode recursiveFind = RepositoryNodeHelper.recursiveFind(tdColumn);
if (recursiveFind == null) {
recursiveFind = RepositoryNodeHelper.createRepositoryNode(tdColumn);
}
RepositoryNode repNode = recursiveFind;
if (repNode != null && repNode instanceof DBColumnRepNode) {
nodes.add((DBColumnRepNode) repNode);
}
}
return nodes;
}
use of org.talend.dq.nodes.DBColumnRepNode in project tdq-studio-se by Talend.
the class AnalyzeColumnCorrelationAction method checkSelectedColumn.
private void checkSelectedColumn() {
if (!selection.isEmpty()) {
Iterator it = selection.iterator();
while (it.hasNext()) {
Object theObject = it.next();
TdColumn column = null;
if (theObject instanceof DBColumnRepNode) {
column = ((DBColumnRepNode) theObject).getTdColumn();
}
if (Java2SqlType.isNumbericInSQL(column.getSqlDataType().getJavaDataType())) {
hasNumberColumn = true;
} else if (Java2SqlType.isDateInSQL(column.getSqlDataType().getJavaDataType()) || Java2SqlType.isDateTimeSQL(column.getSqlDataType().getJavaDataType())) {
hasDateColumn = true;
}
}
}
}
Aggregations