Search in sources :

Example 1 with RootContainer

use of org.talend.commons.utils.data.container.RootContainer in project tdi-studio-se by Talend.

the class DBTreeProvider method getMetadataConnection.

/**
     * @return MetadataConnection
     */
@SuppressWarnings("unchecked")
private Container getMetadataConnection() {
    ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
    ProjectManager pManager = ProjectManager.getInstance();
    Container container = null;
    try {
        container = factory.getMetadata(pManager.getCurrentProject(), ERepositoryObjectType.METADATA_CONNECTIONS);
        pManager.retrieveReferencedProjects();
        for (Project p : pManager.getAllReferencedProjects()) {
            RootContainer rContainer = factory.getMetadata(p, ERepositoryObjectType.METADATA_CONNECTIONS);
            if (container == null) {
                container = rContainer;
            } else if (rContainer != null) {
                Iterator iterator = rContainer.absoluteKeySet().iterator();
                while (iterator.hasNext()) {
                    Object id = iterator.next();
                    container.addMember(id, rContainer.getAbsoluteMember(id));
                }
            }
        }
    } catch (PersistenceException e) {
        //$NON-NLS-1$
        SqlBuilderPlugin.log(Messages.getString("DBTreeProvider.logMessage"), e);
    } catch (BusinessException e) {
        //$NON-NLS-1$
        SqlBuilderPlugin.log(Messages.getString("DBTreeProvider.logMessage"), e);
    }
    return container;
}
Also used : Project(org.talend.core.model.general.Project) Container(org.talend.commons.utils.data.container.Container) RootContainer(org.talend.commons.utils.data.container.RootContainer) BusinessException(org.talend.commons.exception.BusinessException) ProxyRepositoryFactory(org.talend.core.repository.model.ProxyRepositoryFactory) Iterator(java.util.Iterator) PersistenceException(org.talend.commons.exception.PersistenceException) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RepositoryObject(org.talend.core.model.repository.RepositoryObject) RepositoryViewObject(org.talend.core.model.repository.RepositoryViewObject) RootContainer(org.talend.commons.utils.data.container.RootContainer) ProjectManager(org.talend.repository.ProjectManager)

Aggregations

Iterator (java.util.Iterator)1 BusinessException (org.talend.commons.exception.BusinessException)1 PersistenceException (org.talend.commons.exception.PersistenceException)1 Container (org.talend.commons.utils.data.container.Container)1 RootContainer (org.talend.commons.utils.data.container.RootContainer)1 Project (org.talend.core.model.general.Project)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 ProjectManager (org.talend.repository.ProjectManager)1