Search in sources :

Example 1 with Folder

use of org.talend.core.model.repository.Folder 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 2 with Folder

use of org.talend.core.model.repository.Folder in project tdq-studio-se by Talend.

the class RepositoryNodeHelper method getIFolder.

/**
 * get the IFolder according to the RepositoryNode, if the RepositoryNode is not a folder, return null.
 *
 * @param node
 * @return an IFolder or null
 */
public static IFolder getIFolder(IRepositoryNode node) {
    IFolder folder = null;
    if (node != null) {
        IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
        Project currentProject = ProjectManager.getInstance().getCurrentProject();
        IRepositoryViewObject object = node.getObject();
        if (object instanceof Folder) {
            IPath path = getPath(node);
            folder = root.getFolder(new Path(currentProject.getTechnicalLabel() + IPath.SEPARATOR + path.toString()));
        }
    }
    return folder;
}
Also used : Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) Project(org.talend.core.model.general.Project) IWorkspaceRoot(org.eclipse.core.resources.IWorkspaceRoot) IPath(org.eclipse.core.runtime.IPath) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) Folder(org.talend.core.model.repository.Folder) IFolder(org.eclipse.core.resources.IFolder) IFolder(org.eclipse.core.resources.IFolder)

Example 3 with Folder

use of org.talend.core.model.repository.Folder in project tdq-studio-se by Talend.

the class ResourceViewContentProvider method createNewRepNode.

private DQRepositoryNode createNewRepNode(ERepositoryObjectType type, org.talend.core.model.general.Project inWhichProject) {
    IRepositoryViewObject viewObject = null;
    FolderItem folderItem = ProxyRepositoryFactory.getInstance().getFolderItem(inWhichProject, type, Path.EMPTY);
    if (folderItem == null) {
        String folderName = ERepositoryObjectType.getFolderName(type);
        viewObject = new Folder(folderName, folderName);
    } else {
        viewObject = new Folder(folderItem.getProperty(), type);
    }
    DQRepositoryNode node = new DQRepositoryNode(viewObject, null, ENodeType.SYSTEM_FOLDER, inWhichProject);
    if (ERepositoryObjectType.CONTEXT == type) {
        node = new ContextFolderRepNode(viewObject, null, ENodeType.SYSTEM_FOLDER, inWhichProject);
    }
    viewObject.setRepositoryNode(node);
    return node;
}
Also used : DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) FolderItem(org.talend.core.model.properties.FolderItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) Folder(org.talend.core.model.repository.Folder) IFolder(org.eclipse.core.resources.IFolder) ContextFolderRepNode(org.talend.dq.nodes.ContextFolderRepNode)

Example 4 with Folder

use of org.talend.core.model.repository.Folder in project tdq-studio-se by Talend.

the class RepositoryNodeBuilder method getObjectFolder.

public Folder getObjectFolder(EResourceConstant resConstant) {
    Project currentProject = ProjectManager.getInstance().getCurrentProject();
    ERepositoryObjectType repositoryObjectType = retrieveRepObjectTypeByPath(resConstant.getPath());
    FolderItem folderItem = ProxyRepositoryFactory.getInstance().getFolderItem(currentProject, repositoryObjectType, Path.EMPTY);
    Folder folder = new Folder(folderItem.getProperty(), retrieveRepObjectTypeByPath(resConstant.getPath()));
    return folder;
}
Also used : Project(org.talend.core.model.general.Project) FolderItem(org.talend.core.model.properties.FolderItem) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) IFolder(org.eclipse.core.resources.IFolder) Folder(org.talend.core.model.repository.Folder)

Example 5 with Folder

use of org.talend.core.model.repository.Folder in project tdq-studio-se by Talend.

the class RepositoryNodeBuilder method createRepositoryNodeSystemFolder.

/**
 * DOC klliu Comment method "createSystemFolder".
 *
 * @param node
 * @param resConstant
 * @return
 * @throws PersistenceException
 * @deprecated instead of it ues {@link #createRepositoryNodeSubSystemFolder(RepositoryNode, EResourceConstant)}
 */
@Deprecated
public RepositoryNode createRepositoryNodeSystemFolder(FolderHelper folderHelper, RepositoryNode node, EResourceConstant resConstant) throws PersistenceException {
    IRepositoryViewObject folder = null;
    if (folderHelper != null) {
        FolderItem folder2 = folderHelper.getFolder(resConstant.getPath());
        folder = new Folder(folder2.getProperty(), retrieveRepObjectTypeByPath(resConstant.getPath()));
    } else {
        folder = ProxyRepositoryFactory.getInstance().createFolder(retrieveRepObjectTypeByPath(resConstant.getPath()), Path.EMPTY, resConstant.getName());
    }
    return createRepositoryNode(folder, node, resConstant, null);
}
Also used : FolderItem(org.talend.core.model.properties.FolderItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IFolder(org.eclipse.core.resources.IFolder) Folder(org.talend.core.model.repository.Folder)

Aggregations

Folder (org.talend.core.model.repository.Folder)45 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)34 IFolder (org.eclipse.core.resources.IFolder)16 FolderItem (org.talend.core.model.properties.FolderItem)10 ArrayList (java.util.ArrayList)9 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)9 RepositoryNode (org.talend.repository.model.RepositoryNode)9 IPath (org.eclipse.core.runtime.IPath)7 IRepositoryNode (org.talend.repository.model.IRepositoryNode)7 PersistenceException (org.talend.commons.exception.PersistenceException)5 File (java.io.File)4 IContainer (org.eclipse.core.resources.IContainer)4 IProject (org.eclipse.core.resources.IProject)4 Path (org.eclipse.core.runtime.Path)4 Item (org.talend.core.model.properties.Item)4 IFile (org.eclipse.core.resources.IFile)3 Project (org.talend.core.model.general.Project)3 ItemState (org.talend.core.model.properties.ItemState)3 Property (org.talend.core.model.properties.Property)3 IOException (java.io.IOException)2