/**
  * DOC klliu MDMConnectionRepNode constructor comment.
  *
  * @param object
  * @param parent
  * @param type
  */
 public MDMConnectionRepNode(IRepositoryViewObject object, RepositoryNode parent, ENodeType type) {
   super(object, parent, type);
   RepositoryNodeHelper.restoreCorruptedConn(object.getProperty());
   if (object != null && object.getProperty() != null) {
     Item item = object.getProperty().getItem();
     if (item != null && item instanceof MDMConnectionItem) {
       this.mdmConnection = (MDMConnection) ((MDMConnectionItem) item).getConnection();
     }
   }
 }
  /**
   * 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);
  }