use of org.talend.core.repository.model.repositoryObject.TdTableRepositoryObject in project tdq-studio-se by Talend.
the class AbstractCommonActionProviderRealProjectTest method testGetConnectionCase8.
/**
* Test method for
* {@link org.talend.dataprofiler.core.ui.action.provider.AbstractCommonActionProvider#getConnection(java.lang.Object)}
* . case8 :input parameter is DBColumnFolderRepNode
*/
@Test
public void testGetConnectionCase8() {
// create FileConnection
// connection
IRepositoryViewObject lastVersion = null;
String propertyID = createConnectionItem(connectionName, null, null);
TdTable createTdTable = RelationalFactoryImpl.eINSTANCE.createTdTable();
RepositoryNode dbCatalogRepNode = null;
// $NON-NLS-1$
createTdTable.setName("table1");
try {
lastVersion = factory.getLastVersion(propertyID);
dbCatalogRepNode = DQRepNodeCreateFactory.createDBCatalogRepNode(lastVersion, null, ENodeType.TDQ_REPOSITORY_ELEMENT, null);
lastVersion = new TdTableRepositoryObject(lastVersion, createTdTable);
} catch (PersistenceException e) {
log.error(e, e);
Assert.fail(e.getMessage());
}
// ~connection data
// ~FileConnection
// create DFColumnFolderRepNode
Assert.assertFalse(lastVersion == null);
DBTableRepNode dbTableRepNode = new DBTableRepNode(lastVersion, dbCatalogRepNode, ENodeType.TDQ_REPOSITORY_ELEMENT, null);
DBColumnFolderRepNode dbColumnFolderRepNode = new DBColumnFolderRepNode(null, dbTableRepNode, null, null);
// ~DFColumnFolderRepNode
AbstractCommonActionProvider provider = new AbstractCommonActionProvider();
Connection connection = provider.getConnection(dbColumnFolderRepNode);
Assert.assertTrue(connection != null);
}
use of org.talend.core.repository.model.repositoryObject.TdTableRepositoryObject in project tdq-studio-se by Talend.
the class DBColumnRepNode method getParentViewObject.
/*
* (non-Javadoc)
*
* @see
* org.talend.dq.nodes.DQRepositoryNode#getParentViewObject(org.talend.core.model.repository.IRepositoryViewObject)
*/
@Override
protected IRepositoryViewObject getParentViewObject() {
IRepositoryViewObject returnViewObject = null;
MetadataTable columnOwnerAsMetadataTable = ColumnHelper.getColumnOwnerAsMetadataTable(getTdColumn());
if (columnOwnerAsMetadataTable instanceof TdTable) {
returnViewObject = new TdTableRepositoryObject(metadataColumnRepositoryObject.getViewObject(), (TdTable) columnOwnerAsMetadataTable);
} else if (columnOwnerAsMetadataTable instanceof TdView) {
returnViewObject = new TdViewRepositoryObject(metadataColumnRepositoryObject.getViewObject(), (TdView) columnOwnerAsMetadataTable);
}
return returnViewObject;
}
use of org.talend.core.repository.model.repositoryObject.TdTableRepositoryObject in project tdq-studio-se by Talend.
the class DBColumnFolderRepNode method getChildren.
@Override
public List<IRepositoryNode> getChildren() {
if (!this.isReload() && !children.isEmpty()) {
// MOD gdbu 2011-6-29 bug : 22204
return filterResultsIfAny(children);
}
children.clear();
String filterCharater = null;
IRepositoryViewObject meataColumnSetObject = this.getParent().getObject();
EList<MetadataColumn> columns = null;
if (meataColumnSetObject instanceof TdTableRepositoryObject) {
TdTableRepositoryObject tdTableRepositoryObject = (TdTableRepositoryObject) meataColumnSetObject;
// MOD klliu 2011-09-06 bug TDQ-3414
setItem((ConnectionItem) tdTableRepositoryObject.getViewObject().getProperty().getItem());
if (tdTableRepositoryObject.getTdTable().eIsProxy()) {
// reload the connection to make sure the connection(and all it's owned elements) is not proxy
reloadConnectionViewObject();
}
tdTable = tdTableRepositoryObject.getTdTable();
columns = tdTable.getColumns();
filterCharater = ColumnHelper.getColumnFilter(tdTable);
} else if (meataColumnSetObject instanceof TdViewRepositoryObject) {
TdViewRepositoryObject tdViewRepositoryObject = (TdViewRepositoryObject) meataColumnSetObject;
// MOD klliu 2011-09-06 bug TDQ-3414
setItem((ConnectionItem) tdViewRepositoryObject.getViewObject().getProperty().getItem());
if (tdViewRepositoryObject.getTdView().eIsProxy()) {
// reload the connection to make sure the connection(and all it's owned elements) is not proxy
reloadConnectionViewObject();
}
tdView = tdViewRepositoryObject.getTdView();
columns = tdView.getColumns();
filterCharater = ColumnHelper.getColumnFilter(tdView);
}
setConnection(getItem().getConnection());
// MOD TDQ-8718 20140430 the repository view cares about if use the filter or not, the column select dialog
// cares about if connect to DB or not.
List<TdColumn> tdcolumns = null;
if (columns.size() <= 0) {
if (isCallingFromColumnDialog()) {
tdcolumns = loadColumns(isLoadDBFromDialog());
} else if (!isOnFilterring()) {
// MOD gdbu 2011-6-28 bug : 22204
tdcolumns = loadColumns(true);
}
} else {
tdcolumns = new ArrayList<TdColumn>();
for (MetadataColumn mec : columns) {
tdcolumns.add((TdColumn) mec);
}
}
if (tdcolumns != null && filterCharater != null && !filterCharater.equals("")) {
// $NON-NLS-1$
tdcolumns = RepositoryNodeHelper.filterColumns(tdcolumns, filterCharater);
}
createTdcolumnsNode(tdcolumns, children);
this.setReload(false);
// MOD gdbu 2011-6-28 bug : 22204
return filterResultsIfAny(children);
// return children;
}
use of org.talend.core.repository.model.repositoryObject.TdTableRepositoryObject in project tdq-studio-se by Talend.
the class DBColumnFolderRepNode method createParentNode.
/**
* create the node of parent.
*
* @param object
* @return
*/
private RepositoryNode createParentNode(IRepositoryViewObject object) {
RepositoryNode dbParentRepNode = null;
if (object instanceof TdTableRepositoryObject) {
dbParentRepNode = new DBTableRepNode(object, null, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
} else if (object instanceof TdViewRepositoryObject) {
dbParentRepNode = new DBViewRepNode(object, null, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
}
object.setRepositoryNode(dbParentRepNode);
return dbParentRepNode;
}
use of org.talend.core.repository.model.repositoryObject.TdTableRepositoryObject in project tdq-studio-se by Talend.
the class AbstractPredefinedTableActionProvider method fillContextMenu.
@Override
public void fillContextMenu(IMenuManager menu) {
// MOD mzhao user readonly role on svn repository mode.
if (!isShowMenu()) {
return;
}
TreeSelection currentSelection = ((TreeSelection) this.getContext().getSelection());
Object fe = currentSelection.getFirstElement();
if (fe instanceof IRepositoryNode) {
IRepositoryViewObject object = ((IRepositoryNode) fe).getObject();
if (object instanceof TdTableRepositoryObject || object instanceof TdViewRepositoryObject) {
action.setSelection(currentSelection);
if (action.isAllowed()) {
menu.add(action);
}
}
}
}
Aggregations