/* * 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(); }
private boolean hasChildrenInFile() { IRepositoryViewObject object = this.getParent().getObject(); if (object instanceof MetadataCatalogRepositoryObject) { Catalog catalogInFile = ((MetadataCatalogRepositoryObject) object).getCatalog(); List<TdView> views = PackageHelper.getViews(catalogInFile); if (views.isEmpty()) { return false; } else { return true; } } else if (object instanceof MetadataSchemaRepositoryObject) { Schema schemaInFile = ((MetadataSchemaRepositoryObject) object).getSchema(); List<TdView> views = PackageHelper.getViews(schemaInFile); if (views.isEmpty()) { return false; } else { return true; } } return false; }
/** * Create TableFolderNodeRepositoryNode. * * @param node parent RepositoryNode * @param metadataObject parent CatalogViewObject or SchemaViewObject */ private void createRepositoryNodeViewFolderNode( List<IRepositoryNode> node, IRepositoryViewObject metadataObject) { List<TdView> views = new ArrayList<TdView>(); String filterCharacter = null; try { if (metadataObject instanceof MetadataCatalogRepositoryObject) { viewObject = ((MetadataCatalogRepositoryObject) metadataObject).getViewObject(); 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(); item = (ConnectionItem) viewObject.getProperty().getItem(); views = PackageHelper.getViews(catalog); filterCharacter = RepositoryNodeHelper.getViewFilter(catalog, schema); // MOD gdbu 2011-6-29 bug : 22204 // MOD TDQ-8718 20140505 yyin --the repository view cares about if use the filter or not, // the column // select dialog cares about if connect to DB or not. if (views.isEmpty()) { connection = item.getConnection(); if (isCallingFromColumnDialog()) { views = DqRepositoryViewService.getViews(connection, catalog, null, isLoadDBFromDialog()); } else if (!isOnFilterring()) { // MOD gdbu 2011-7-21 bug 23220 views = DqRepositoryViewService.getViews(connection, catalog, null, true); } if (views != null && views.size() > 0) { ProxyRepositoryFactory.getInstance().save(item, false); } } ConnectionUtils.retrieveColumn(views); // ~22204 } else if (metadataObject instanceof MetadataSchemaRepositoryObject) { viewObject = ((MetadataSchemaRepositoryObject) metadataObject).getViewObject(); 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(); item = (ConnectionItem) viewObject.getProperty().getItem(); 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()) { connection = item.getConnection(); if (isCallingFromColumnDialog()) { views = DqRepositoryViewService.getViews(connection, schema, null, isLoadDBFromDialog()); } else if (!isOnFilterring()) { // MOD gdbu 2011-7-21 bug 23220 views = DqRepositoryViewService.getViews(connection, schema, null, true); } if (views != null && views.size() > 0) { ProxyRepositoryFactory.getInstance().save(item, false); } } else { ConnectionUtils.retrieveColumn(views); } // ~22204 } } catch (Exception e) { log.error(e, e); } if (filterCharacter != null && !filterCharacter.equals(PluginConstant.EMPTY_STRING)) { views = RepositoryNodeHelper.filterViews(views, filterCharacter); } createViewRepositoryNode(views, node); }