Search in sources :

Example 1 with RepositoryNodeExt

use of org.talend.sqlbuilder.RepositoryNodeExt in project tdi-studio-se by Talend.

the class DBTreeProvider method createQuery.

private void createQuery(RepositoryNode queriesConnectionNode, IRepositoryViewObject repObj, QueriesConnection queriesConnection) {
    displayQueries.clear();
    for (Iterator iter = queriesConnection.getQuery().iterator(); iter.hasNext(); ) {
        Query query = (Query) iter.next();
        boolean isDelete = SubItemHelper.isDeleted(query);
        boolean isReadOnly = connectionParameters.isNodeReadOnly();
        if (isDelete && !isReadOnly) {
            continue;
        }
        // if (!TableHelper.isDeleted(query)) {
        QueryRepositoryObject repositoryObject = new QueryRepositoryObject(repObj, query);
        repositoryObject.setImage(IMAGES_SQL_EDITOR_ICON);
        repositoryObject.setSourceName(query.getLabel());
        RepositoryNode node = new RepositoryNodeExt(repositoryObject, queriesConnectionNode, ENodeType.REPOSITORY_ELEMENT);
        node.setProperties(EProperties.CONTENT_TYPE, RepositoryNodeType.QUERY);
        queriesConnectionNode.getChildren().add(node);
        if (connectionParameters.getQueryObject() != null && query.getLabel().equals(connectionParameters.getQueryObject().getLabel())) {
            this.selectedExtReposiotryNode = node;
        }
        displayQueries.add(query);
    // }
    }
}
Also used : Query(org.talend.core.model.metadata.builder.connection.Query) Iterator(java.util.Iterator) RepositoryNode(org.talend.repository.model.RepositoryNode) RepositoryNodeExt(org.talend.sqlbuilder.RepositoryNodeExt)

Example 2 with RepositoryNodeExt

use of org.talend.sqlbuilder.RepositoryNodeExt in project tdi-studio-se by Talend.

the class DBTreeProvider method createQueries.

private void createQueries(RepositoryNode node, final IRepositoryViewObject repObj, DatabaseConnection metadataConnection, boolean isBuildIn) {
    QueriesConnection queriesConnection = metadataConnection.getQueries();
    if (queriesConnection != null) {
        QueriesConnectionRepositoryObject repositoryObject = new QueriesConnectionRepositoryObject(repObj, queriesConnection);
        repositoryObject.setImage(IMAGES_APPEND_TO_EDITOR);
        //$NON-NLS-1$
        repositoryObject.setSourceName(Messages.getString("DBTreeProvider.sourceName"));
        RepositoryNode queriesConnectionNode = new RepositoryNodeExt(repositoryObject, node, ENodeType.REPOSITORY_ELEMENT);
        queriesConnectionNode.setProperties(EProperties.CONTENT_TYPE, RepositoryNodeType.QUERIESCONNECTION);
        node.getChildren().add(queriesConnectionNode);
        createQuery(queriesConnectionNode, repObj, queriesConnection);
    }
}
Also used : QueriesConnection(org.talend.core.model.metadata.builder.connection.QueriesConnection) RepositoryNode(org.talend.repository.model.RepositoryNode) RepositoryNodeExt(org.talend.sqlbuilder.RepositoryNodeExt)

Example 3 with RepositoryNodeExt

use of org.talend.sqlbuilder.RepositoryNodeExt in project tdi-studio-se by Talend.

the class DBTreeProvider method convert.

private void convert(Container fromModel, RepositoryNode parent, ERepositoryObjectType type) {
    if (fromModel.isEmpty()) {
        return;
    }
    for (Object obj : fromModel.getSubContainer()) {
        Container container = (Container) obj;
        Folder folderRepositoryObject = new Folder(container.getId(), container.getLabel());
        FolderRepositoryObject oFolder = new FolderRepositoryObject(folderRepositoryObject);
        oFolder.setImage(IMAGES_CLOSED_FOLDER);
        oFolder.setSourceName(oFolder.getLabel());
        oFolder.setRepositoryName(null);
        RepositoryNode folder = new RepositoryNodeExt(oFolder, parent, ENodeType.SIMPLE_FOLDER);
        folder.setProperties(EProperties.LABEL, container.getLabel());
        // ERepositoryObjectType.FOLDER);
        folder.setProperties(EProperties.CONTENT_TYPE, RepositoryNodeType.FOLDER);
        parent.getChildren().add(folder);
        convert(container, folder, type);
    }
    if (!isCleared) {
        maps.clear();
        isCleared = true;
    }
    for (Object obj : fromModel.getMembers()) {
        RepositoryObject obj2 = (RepositoryObject) obj;
        if (!connectionParameters.getRepositoryId().equals(obj2.getProperty().getId())) {
            continue;
        }
        RepositoryViewObject viewObject = new RepositoryViewObject(obj2.getProperty());
        maps.put((obj2).getId(), viewObject);
        addNode(parent, viewObject, false, null);
    }
}
Also used : Container(org.talend.commons.utils.data.container.Container) RootContainer(org.talend.commons.utils.data.container.RootContainer) RepositoryObject(org.talend.core.model.repository.RepositoryObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RepositoryObject(org.talend.core.model.repository.RepositoryObject) RepositoryViewObject(org.talend.core.model.repository.RepositoryViewObject) Folder(org.talend.core.model.repository.Folder) RepositoryNode(org.talend.repository.model.RepositoryNode) RepositoryNodeExt(org.talend.sqlbuilder.RepositoryNodeExt) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RepositoryViewObject(org.talend.core.model.repository.RepositoryViewObject)

Example 4 with RepositoryNodeExt

use of org.talend.sqlbuilder.RepositoryNodeExt in project tdi-studio-se by Talend.

the class DBTreeProvider method createMetacolumn.

private RepositoryNode createMetacolumn(RepositoryNode tableNode, IRepositoryViewObject repObj, MetadataColumn metadataColumn, boolean isBuildIn) {
    MetadataColumnRepositoryObject modelObj = new MetadataColumnRepositoryObject(repObj, metadataColumn);
    modelObj.setRepositoryName(metadataColumn.getLabel());
    // statusCode use for source table name
    modelObj.setSourceName(metadataColumn.getOriginalField());
    // purpose use for Image text.
    if (metadataColumn.isSynchronised()) {
        modelObj.setImage(IMAGES_REFRESH_ICON);
    } else {
        modelObj.setImage(IMAGES_COLUMN_NODE_ICON);
    }
    // description use for color.
    if (modelObj.getColumn().isDivergency() && !isBuildIn) {
        modelObj.setColor(COLOR_RED);
    }
    if (modelObj.getRepositoryName() == null || modelObj.getRepositoryName().trim().equals("")) {
        //$NON-NLS-1$
        modelObj.setColor(COLOR_GRAY);
    }
    modelObj.setBuildIn(isBuildIn);
    RepositoryNode columnNode = new RepositoryNodeExt(modelObj, tableNode, ENodeType.REPOSITORY_ELEMENT);
    columnNode.setProperties(EProperties.LABEL, metadataColumn.getLabel());
    columnNode.setProperties(EProperties.CONTENT_TYPE, RepositoryNodeType.COLUMN);
    return columnNode;
}
Also used : RepositoryNode(org.talend.repository.model.RepositoryNode) RepositoryNodeExt(org.talend.sqlbuilder.RepositoryNodeExt)

Example 5 with RepositoryNodeExt

use of org.talend.sqlbuilder.RepositoryNodeExt in project tdi-studio-se by Talend.

the class DBTreeProvider method createMetatable.

/**
     * tguiu Comment method "createMetatable".
     * 
     * @param node
     * @param iMetadataFileDelimited
     * @param table
     * @return
     */
private RepositoryNode createMetatable(RepositoryNode node, IRepositoryViewObject repObj, final org.talend.core.model.metadata.builder.connection.MetadataTable table, boolean isBuildIn) {
    MetadataTableRepositoryObject modelObj = new MetadataTableRepositoryObject(repObj, table);
    if (table instanceof MetadataTableImpl) {
        modelObj.setRepositoryName(((MetadataTableImpl) table).getOriginalLabel());
    } else {
        modelObj.setRepositoryName(table.getLabel());
    }
    // statusCode use for source table name
    modelObj.setSourceName(table.getSourceName());
    // purpose use for Image text.
    modelObj.setImage(IMAGES_TABLE_NODE_ICON);
    // description use for color.
    if (modelObj.getTable().isDivergency() && !isBuildIn && !modelObj.getTable().isSynchronised()) {
        modelObj.setColor(COLOR_RED);
    }
    if (modelObj.getRepositoryName() == null || modelObj.getRepositoryName().trim().equals("")) {
        //$NON-NLS-1$
        modelObj.setColor(COLOR_GRAY);
    }
    modelObj.setBuildIn(isBuildIn);
    RepositoryNode tableNode = new RepositoryNodeExt(modelObj, node, ENodeType.REPOSITORY_ELEMENT);
    tableNode.setProperties(EProperties.LABEL, table.getLabel());
    tableNode.setProperties(EProperties.CONTENT_TYPE, RepositoryNodeType.TABLE);
    boolean[] isDiffs = repositoryNodeManager.isDiff(tableNode);
    if (isDiffs[0]) {
        modelObj.setDiffImage(IMAGES_GRAY_ICON);
    }
    if (isDiffs[1]) {
        modelObj.setDiffImage(IMAGES_RED_ICON);
    }
    if (isDiffs[2]) {
        modelObj.setDiffImage(IMAGES_REFRESH_ICON);
    }
    return tableNode;
}
Also used : MetadataTableImpl(org.talend.core.model.metadata.builder.connection.impl.MetadataTableImpl) RepositoryNode(org.talend.repository.model.RepositoryNode) RepositoryNodeExt(org.talend.sqlbuilder.RepositoryNodeExt)

Aggregations

RepositoryNode (org.talend.repository.model.RepositoryNode)6 RepositoryNodeExt (org.talend.sqlbuilder.RepositoryNodeExt)6 Iterator (java.util.Iterator)1 Container (org.talend.commons.utils.data.container.Container)1 RootContainer (org.talend.commons.utils.data.container.RootContainer)1 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)1 QueriesConnection (org.talend.core.model.metadata.builder.connection.QueriesConnection)1 Query (org.talend.core.model.metadata.builder.connection.Query)1 MetadataTableImpl (org.talend.core.model.metadata.builder.connection.impl.MetadataTableImpl)1 Folder (org.talend.core.model.repository.Folder)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 RepositoryObject (org.talend.core.model.repository.RepositoryObject)1 RepositoryViewObject (org.talend.core.model.repository.RepositoryViewObject)1 ProxyRepositoryFactory (org.talend.core.repository.model.ProxyRepositoryFactory)1