use of org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject in project tdq-studio-se by Talend.
the class DBTableFolderRepNode method createRepositoryNodeTableFolderNode.
/**
* Create TableFolderNodeRepositoryNode.
*
* @param metadataObject parent CatalogViewObject or SchemaViewObject
*/
private void createRepositoryNodeTableFolderNode(IRepositoryViewObject metadataObject) {
List<TdTable> tables = new ArrayList<TdTable>();
String filterCharacter = null;
try {
if (metadataObject instanceof MetadataCatalogRepositoryObject) {
viewObject = ((MetadataCatalogRepositoryObject) metadataObject).getViewObject();
setItem((ConnectionItem) viewObject.getProperty().getItem());
setConnection(getItem().getConnection());
if (((MetadataCatalogRepositoryObject) metadataObject).getCatalog().eIsProxy()) {
// reload the connection to make sure the connection(and all it's owned elements) is not proxy
reloadConnectionViewObject();
}
catalog = ((MetadataCatalogRepositoryObject) metadataObject).getCatalog();
tables = PackageHelper.getTables(catalog);
filterCharacter = RepositoryNodeHelper.getTableFilter(catalog, schema);
// select dialog cares about if connect to DB or not.
if (tables.isEmpty()) {
if (isCallingFromColumnDialog()) {
tables = DqRepositoryViewService.getTables(getConnection(), catalog, null, isLoadDBFromDialog(), true);
} else if (!isOnFilterring()) {
// MOD mzhao 0022204 : when the tree is rendering with a filter, do not loading from db.
tables = DqRepositoryViewService.getTables(getConnection(), catalog, null, true, true);
}
if (tables != null && tables.size() > 0) {
ProxyRepositoryFactory.getInstance().save(getItem(), false);
}
}
} else {
viewObject = ((MetadataSchemaRepositoryObject) metadataObject).getViewObject();
setItem((ConnectionItem) viewObject.getProperty().getItem());
setConnection(getItem().getConnection());
if (((MetadataSchemaRepositoryObject) metadataObject).getSchema().eIsProxy()) {
// reload the connection to make sure the connection(and all it's owned elements) is not proxy
reloadConnectionViewObject();
}
schema = ((MetadataSchemaRepositoryObject) metadataObject).getSchema();
tables = PackageHelper.getTables(schema);
filterCharacter = RepositoryNodeHelper.getTableFilter(catalog, schema);
RepositoryNode parent = metadataObject.getRepositoryNode().getParent();
IRepositoryViewObject object = parent.getObject();
if (object instanceof MetadataCatalogRepositoryObject && filterCharacter.equals(PluginConstant.EMPTY_STRING)) {
filterCharacter = RepositoryNodeHelper.getTableFilter(((MetadataCatalogRepositoryObject) object).getCatalog(), null);
}
if (tables.isEmpty()) {
if (isCallingFromColumnDialog()) {
tables = DqRepositoryViewService.getTables(getConnection(), schema, null, isLoadDBFromDialog(), true);
} else if (!isOnFilterring()) {
// MOD mzhao 0022204 : when the tree is rendering with a filter, do not loading from db.
tables = DqRepositoryViewService.getTables(getConnection(), schema, null, true, true);
}
if (tables != null && tables.size() > 0) {
ProxyRepositoryFactory.getInstance().save(getItem(), false);
}
}
}
ConnectionUtils.retrieveColumn(tables);
} catch (Exception e) {
log.error(e, e);
}
if (filterCharacter != null && !filterCharacter.equals(PluginConstant.EMPTY_STRING)) {
tables = RepositoryNodeHelper.filterTables(tables, filterCharacter);
}
createTableRepositoryNode(tables, children);
}
use of org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject in project tdq-studio-se by Talend.
the class DBViewFolderRepNode method createParentNode.
/**
* create the node of parent.
*
* @return
*/
private RepositoryNode createParentNode() {
RepositoryNode dbParentRepNode = null;
if (viewObject instanceof MetadataCatalogRepositoryObject) {
dbParentRepNode = DQRepNodeCreateFactory.createDBCatalogRepNode(viewObject, null, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
} else if (viewObject instanceof MetadataSchemaRepositoryObject) {
dbParentRepNode = new DBSchemaRepNode(viewObject, null, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
}
viewObject.setRepositoryNode(dbParentRepNode);
return dbParentRepNode;
}
use of org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject in project tdq-studio-se by Talend.
the class DBViewFolderRepNode method createRepositoryNodeViewFolderNode.
/**
* Create ViewFolderNodeRepositoryNode.
*
* @param metadataObject parent CatalogViewObject or SchemaViewObject
*/
private void createRepositoryNodeViewFolderNode(IRepositoryViewObject metadataObject) {
List<TdView> views = new ArrayList<TdView>();
String filterCharacter = null;
try {
if (metadataObject instanceof MetadataCatalogRepositoryObject) {
viewObject = ((MetadataCatalogRepositoryObject) metadataObject).getViewObject();
setItem((ConnectionItem) viewObject.getProperty().getItem());
setConnection(getItem().getConnection());
if (((MetadataCatalogRepositoryObject) metadataObject).getCatalog().eIsProxy()) {
// reload the connection to make sure the connection(and all it's owned elements) is not proxy
reloadConnectionViewObject();
}
catalog = ((MetadataCatalogRepositoryObject) metadataObject).getCatalog();
views = PackageHelper.getViews(catalog);
filterCharacter = RepositoryNodeHelper.getViewFilter(catalog, schema);
// select dialog cares about if connect to DB or not.
if (views.isEmpty()) {
if (isCallingFromColumnDialog()) {
views = DqRepositoryViewService.getViews(getConnection(), catalog, null, isLoadDBFromDialog(), true);
} else if (!isOnFilterring()) {
// MOD gdbu 2011-7-21 bug 23220
views = DqRepositoryViewService.getViews(getConnection(), catalog, null, true, true);
}
if (views != null && views.size() > 0) {
ProxyRepositoryFactory.getInstance().save(getItem(), false);
}
}
} else {
viewObject = ((MetadataSchemaRepositoryObject) metadataObject).getViewObject();
setItem((ConnectionItem) viewObject.getProperty().getItem());
setConnection(getItem().getConnection());
if (((MetadataSchemaRepositoryObject) metadataObject).getSchema().eIsProxy()) {
// reload the connection to make sure the connection(and all it's owned elements) is not proxy
reloadConnectionViewObject();
}
schema = ((MetadataSchemaRepositoryObject) metadataObject).getSchema();
views = PackageHelper.getViews(schema);
filterCharacter = RepositoryNodeHelper.getViewFilter(catalog, schema);
RepositoryNode parent = metadataObject.getRepositoryNode().getParent();
IRepositoryViewObject object = parent.getObject();
if (object instanceof MetadataCatalogRepositoryObject && filterCharacter.equals(PluginConstant.EMPTY_STRING)) {
filterCharacter = RepositoryNodeHelper.getViewFilter(((MetadataCatalogRepositoryObject) object).getCatalog(), null);
}
// MOD gdbu 2011-6-29 bug : 22204
if (views.isEmpty()) {
if (isCallingFromColumnDialog()) {
views = DqRepositoryViewService.getViews(getConnection(), schema, null, isLoadDBFromDialog(), true);
} else if (!isOnFilterring()) {
// MOD gdbu 2011-7-21 bug 23220
views = DqRepositoryViewService.getViews(getConnection(), schema, null, true, true);
}
if (views != null && views.size() > 0) {
ProxyRepositoryFactory.getInstance().save(getItem(), false);
}
}
// ~22204
}
ConnectionUtils.retrieveColumn(views);
} catch (Exception e) {
log.error(e, e);
}
if (filterCharacter != null && !filterCharacter.equals(PluginConstant.EMPTY_STRING)) {
views = RepositoryNodeHelper.filterViews(views, filterCharacter);
}
createViewRepositoryNode(views, children);
}
use of org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject in project tdq-studio-se by Talend.
the class DBViewFolderRepNode method getChildrenCount.
/*
* ADD gdbu 2011-7-25 bug : 23220
*
* children count : only read from the file
*/
private int getChildrenCount() {
List<TdView> tables = new ArrayList<TdView>();
IRepositoryViewObject object = this.getParent().getObject();
if (object instanceof MetadataCatalogRepositoryObject) {
catalog = ((MetadataCatalogRepositoryObject) object).getCatalog();
tables = PackageHelper.getViews(catalog);
} else {
schema = ((MetadataSchemaRepositoryObject) object).getSchema();
tables = PackageHelper.getViews(schema);
}
return tables.size();
}
use of org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject in project tdq-studio-se by Talend.
the class DBTableRepNode method getParentViewObject.
/*
* (non-Javadoc)
*
* @see org.talend.dq.nodes.DQRepositoryNode#getParentViewObject()
*/
@Override
protected IRepositoryViewObject getParentViewObject() {
IRepositoryViewObject packageViewObject = null;
Package parentPackage = PackageHelper.getParentPackage(this.tdTableRepositoryObject.getTdTable());
if (parentPackage instanceof Catalog) {
packageViewObject = new MetadataCatalogRepositoryObject(tdTableRepositoryObject.getViewObject(), (Catalog) parentPackage);
} else if (parentPackage instanceof Schema) {
packageViewObject = new MetadataSchemaRepositoryObject(tdTableRepositoryObject.getViewObject(), (Schema) parentPackage);
}
return packageViewObject;
}
Aggregations