use of org.talend.dq.nodes.DBColumnRepNode in project tdq-studio-se by Talend.
the class FunctionalDependencyAnalysisDetailsPage method validator.
private ReturnCode validator(List<RepositoryNode> columnASet, List<RepositoryNode> columnBSet) {
// MOD by gdbu 2011-3-21 bug 19179
ReturnCode canModRetCode = super.canSave();
if (!canModRetCode.isOk()) {
return canModRetCode;
}
if (columnASet.isEmpty() || columnBSet.isEmpty()) {
// $NON-NLS-1$
return new ReturnCode(DefaultMessagesImpl.getString("ColumnDependencyMasterDetailsPage.columnsBlankMessag"), false);
}
if (columnASet.size() != columnBSet.size()) {
// $NON-NLS-1$
return new ReturnCode(DefaultMessagesImpl.getString("ColumnsComparisonMasterDetailsPage.columnsSameMessage"), false);
}
for (int i = 0; i < columnASet.size(); i++) {
RepositoryNode columnANode = columnASet.get(i);
RepositoryNode columnBNode = columnBSet.get(i);
TdColumn tdColumnA = ((DBColumnRepNode) columnANode).getTdColumn();
TdColumn tdColumnB = ((DBColumnRepNode) columnBNode).getTdColumn();
ColumnSet ownerA = ColumnHelper.getColumnOwnerAsColumnSet(tdColumnA);
ColumnSet ownerB = ColumnHelper.getColumnOwnerAsColumnSet(tdColumnB);
String uuidA = ResourceHelper.getUUID(ownerA);
String uuidB = ResourceHelper.getUUID(ownerB);
if (!uuidA.equals(uuidB)) {
// $NON-NLS-1$
return new ReturnCode(DefaultMessagesImpl.getString("ColumnDependencyMasterDetailsPage.tableMessage"), false);
}
}
return new ReturnCode(true);
}
use of org.talend.dq.nodes.DBColumnRepNode in project tdq-studio-se by Talend.
the class RepositoryNodeHelperRealTest method testCreateOracleRepositoryNode.
/**
* Test method for
* {@link org.talend.dq.helper.RepositoryNodeHelper#createRepositoryNode(orgomg.cwm.objectmodel.core.ModelElement)}.
* oracle case
*/
@Test
public void testCreateOracleRepositoryNode() {
// $NON-NLS-1$
DatabaseConnectionItem createConnectionItem = createDataBaseConnection("conn1", null, false);
// $NON-NLS-1$
Schema addSchema = this.addSchema(createConnectionItem.getConnection(), "catalog1");
// $NON-NLS-1$
TdTable addTable = this.addTable(addSchema, "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 UnitTestBuildHelper method createModelElementIndicator.
public static ModelElementIndicator createModelElementIndicator() {
TdColumn tdColumn = RelationalFactory.eINSTANCE.createTdColumn();
TdTable createTdTable = RelationalFactory.eINSTANCE.createTdTable();
tdColumn.setOwner(createTdTable);
TdSqlDataType dataType = RelationalFactory.eINSTANCE.createTdSqlDataType();
dataType.setJavaDataType(Types.VARCHAR);
tdColumn.setSqlDataType(dataType);
MetadataColumnRepositoryObject columnObject = new MetadataColumnRepositoryObject(null, tdColumn);
IRepositoryNode columnRepNode = new DBColumnRepNode(columnObject, new RepositoryNode(null, null, null), ENodeType.REPOSITORY_ELEMENT, null);
ModelElementIndicator modelElementIndicator = new ColumnIndicatorImpl(columnRepNode);
return modelElementIndicator;
}
use of org.talend.dq.nodes.DBColumnRepNode in project tdq-studio-se by Talend.
the class SemanticDiscoveryActionProviderTest method createNewColumnRepNode.
/**
* DOC zshen Comment method "createNewColumnRepNode".
*/
private IRepositoryNode createNewColumnRepNode() {
// TODOćcreate real connection with eresource
TdColumn tdColumn = RelationalFactory.eINSTANCE.createTdColumn();
TdTable createTdTable = RelationalFactory.eINSTANCE.createTdTable();
tdColumn.setOwner(createTdTable);
TdSqlDataType dataType = RelationalFactory.eINSTANCE.createTdSqlDataType();
dataType.setJavaDataType(Types.VARCHAR);
tdColumn.setSqlDataType(dataType);
MetadataColumnRepositoryObject columnObject = new MetadataColumnRepositoryObject(null, tdColumn);
IRepositoryNode columnRepNode = new DBColumnRepNode(columnObject, new RepositoryNode(null, null, null), ENodeType.REPOSITORY_ELEMENT, null);
return columnRepNode;
}
use of org.talend.dq.nodes.DBColumnRepNode in project tdq-studio-se by Talend.
the class SelectedCompareUIProvider method fillContextMenu.
@Override
public void fillContextMenu(IMenuManager menu) {
// TDQ-9394 hide all "Reload" menu.
if (!isShowMenu()) {
return;
}
if (isShowMenu()) {
return;
}
Iterator<?> iter = ((TreeSelection) this.getContext().getSelection()).iterator();
while (iter.hasNext()) {
Object obj = iter.next();
if (!(obj instanceof RepositoryNode)) {
return;
}
}
TreeSelection treeSelection = (TreeSelection) getContext().getSelection();
if (treeSelection == null) {
return;
}
Object firstElement = treeSelection.getFirstElement();
RepositoryNode rNode = (RepositoryNode) firstElement;
IFolder folder = WorkbenchUtils.getFolder(rNode);
IFolder metadataFolder = ResourceManager.getMetadataFolder();
if (!folder.getFullPath().toOSString().startsWith(metadataFolder.getFullPath().toOSString())) {
return;
}
Object[] selectedObj = treeSelection.toArray();
if (selectedObj.length < 2) {
return;
}
List<Object> objects = new ArrayList<Object>();
for (Object obj : selectedObj) {
Connection conn = getConnection(obj);
if (!MetadataConnectionUtils.isTDQSupportDBTemplate(conn)) {
return;
}
RepositoryNode node = (RepositoryNode) obj;
if (node instanceof DBConnectionRepNode) {
Property property = ((DBConnectionRepNode) node).getObject().getProperty();
DatabaseConnectionItem databaseConnectionItem = (DatabaseConnectionItem) property.getItem();
Connection databaseConnection = databaseConnectionItem.getConnection();
objects.add(databaseConnection);
} else if (node instanceof DBCatalogRepNode) {
Catalog catalog = ((DBCatalogRepNode) node).getCatalog();
objects.add(catalog);
} else if (node instanceof DBSchemaRepNode) {
Schema schema = ((DBSchemaRepNode) node).getSchema();
objects.add(schema);
} else if (node instanceof DBTableRepNode) {
TdTable tdTable = ((DBTableRepNode) node).getTdTable();
objects.add(tdTable);
} else if (node instanceof DBColumnRepNode) {
TdColumn tdColumn = ((DBColumnRepNode) node).getTdColumn();
objects.add(tdColumn);
}
}
// MOD yyi 2011-03-22 17871:hide compare action for flat file column
if (2 == objects.size()) {
selectionCompareAction.refreshSelectedObj(objects.get(0), objects.get(1));
menu.add(selectionCompareAction);
}
}
Aggregations