Search in sources :

Example 71 with RepositoryNode

use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.

the class DBTreeProvider method getParent.

public Object getParent(Object element) {
    RepositoryNode node = (RepositoryNode) element;
    final RepositoryNode parent = node.getParent();
    if (parent != null) {
        return parent;
    } else {
        return node;
    }
}
Also used : RepositoryNode(org.talend.repository.model.RepositoryNode)

Example 72 with RepositoryNode

use of org.talend.repository.model.RepositoryNode 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 73 with RepositoryNode

use of org.talend.repository.model.RepositoryNode 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 74 with RepositoryNode

use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.

the class DBTreeProvider method getColumnImage.

public Image getColumnImage(Object element, int columnIndex) {
    RepositoryNode node = (RepositoryNode) element;
    SqlBuilderRepositoryObject repositoryObject = (SqlBuilderRepositoryObject) node.getObject();
    if (columnIndex == 1) {
        return null;
    } else if (columnIndex == 2) {
        if ((repositoryObject).getDiffImage() == null) {
            return null;
        }
        return ImageUtil.getImage((repositoryObject).getDiffImage());
    }
    return ImageUtil.getImage((repositoryObject).getImage());
}
Also used : RepositoryNode(org.talend.repository.model.RepositoryNode)

Example 75 with RepositoryNode

use of org.talend.repository.model.RepositoryNode 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)

Aggregations

RepositoryNode (org.talend.repository.model.RepositoryNode)250 IRepositoryNode (org.talend.repository.model.IRepositoryNode)94 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)74 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)44 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)44 ProjectRepositoryNode (org.talend.core.repository.model.ProjectRepositoryNode)42 Item (org.talend.core.model.properties.Item)38 ArrayList (java.util.ArrayList)33 PersistenceException (org.talend.commons.exception.PersistenceException)27 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)27 ProcessItem (org.talend.core.model.properties.ProcessItem)23 RepositoryObject (org.talend.core.model.repository.RepositoryObject)22 ISelection (org.eclipse.jface.viewers.ISelection)20 ConnectionItem (org.talend.core.model.properties.ConnectionItem)20 IProjectRepositoryNode (org.talend.repository.model.nodes.IProjectRepositoryNode)20 List (java.util.List)18 Property (org.talend.core.model.properties.Property)18 DatabaseConnectionItem (org.talend.core.model.properties.DatabaseConnectionItem)17 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)16 WizardDialog (org.eclipse.jface.wizard.WizardDialog)13