private boolean hasChildrenInDataBase() {

    boolean hasChildrenInDB = false;

    IRepositoryViewObject object = this.getParent().getObject();
    if (object instanceof MetadataCatalogRepositoryObject) {
      viewObject = ((MetadataCatalogRepositoryObject) object).getViewObject();
      item = (ConnectionItem) viewObject.getProperty().getItem();
      connection = item.getConnection();
      catalog = ((MetadataCatalogRepositoryObject) object).getCatalog();
      try {
        hasChildrenInDB =
            DqRepositoryViewService.isCatalogHasChildren(
                connection, catalog, null, DqRepositoryViewService.VIEW_TYPES);
      } catch (Exception e) {
        log.error(e.toString());
      }

    } else {
      viewObject = ((MetadataSchemaRepositoryObject) object).getViewObject();
      item = (ConnectionItem) viewObject.getProperty().getItem();
      connection = item.getConnection();
      schema = ((MetadataSchemaRepositoryObject) object).getSchema();
      try {
        hasChildrenInDB =
            DqRepositoryViewService.isSchemaHasChildren(
                connection, schema, null, DqRepositoryViewService.VIEW_TYPES);
      } catch (MissingDriverException e) {
        throw e;
      } catch (Exception e) {
        log.error(e.toString());
      }
    }

    return hasChildrenInDB;
  }
  /**
   * 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);
  }