Search in sources :

Example 26 with FolderItem

use of org.talend.core.model.properties.FolderItem in project tdq-studio-se by Talend.

the class RepositoryNodeBuilder method createRepositoryNodeSubSystemFolder.

/**
 * create repository node for sub system folder
 *
 * @param node create repository node
 * @param resConstant sub folder type
 * @return sub node
 * @throws PersistenceException
 */
public RepositoryNode createRepositoryNodeSubSystemFolder(RepositoryNode node, EResourceConstant resConstant, org.talend.core.model.general.Project currentProject) throws PersistenceException {
    IRepositoryViewObject folder = null;
    ERepositoryObjectType repositoryObjectType = retrieveRepObjectTypeByPath(resConstant.getPath());
    FolderItem folderItem = ProxyRepositoryFactory.getInstance().getFolderItem(currentProject, repositoryObjectType, Path.EMPTY);
    if (folderItem != null) {
        folder = new Folder(folderItem.getProperty(), repositoryObjectType);
    } else {
        folder = ProxyRepositoryFactory.getInstance().createFolder(retrieveRepObjectTypeByPath(getParentPath(resConstant.getPath())), Path.EMPTY, resConstant.getName());
    }
    return createRepositoryNode(folder, node, resConstant, currentProject);
}
Also used : FolderItem(org.talend.core.model.properties.FolderItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) IFolder(org.eclipse.core.resources.IFolder) Folder(org.talend.core.model.repository.Folder)

Example 27 with FolderItem

use of org.talend.core.model.properties.FolderItem in project tdq-studio-se by Talend.

the class UnitTestBuildHelper method buildRepositoryViewObjectSystemFolder.

/**
 * create a RepositoryViewObject which is a system folder.
 *
 * @param tProject
 * @param author
 * @param type
 * @return
 */
public static IRepositoryViewObject buildRepositoryViewObjectSystemFolder(org.talend.core.model.properties.Project emfProject, User author, ERepositoryObjectType type) {
    ItemState itemState = PropertiesFactory.eINSTANCE.createItemState();
    FolderItem folderItem = PropertiesFactory.eINSTANCE.createFolderItem();
    Property property = PropertiesFactory.eINSTANCE.createProperty();
    itemState.setItemRelated(folderItem);
    folderItem.setState(itemState);
    folderItem.setParent(emfProject);
    folderItem.setType(FolderType.STABLE_SYSTEM_FOLDER_LITERAL);
    folderItem.setProperty(property);
    property.setAuthor(author);
    property.setCreationDate(new Date());
    property.setId(StringUtilities.getRandomString(26));
    property.setItem(folderItem);
    property.setLabel(type.getFolder());
    property.setMaxInformationLevel(InformationLevel.DEBUG_LITERAL);
    // $NON-NLS-1$
    property.setOldStatusCode("");
    // $NON-NLS-1$
    property.setVersion("0.1");
    return new Folder(property, type);
}
Also used : FolderItem(org.talend.core.model.properties.FolderItem) ItemState(org.talend.core.model.properties.ItemState) Folder(org.talend.core.model.repository.Folder) IFolder(org.eclipse.core.resources.IFolder) Property(org.talend.core.model.properties.Property) Date(java.util.Date)

Example 28 with FolderItem

use of org.talend.core.model.properties.FolderItem in project tdq-studio-se by Talend.

the class UnitTestBuildHelper method createRealDataProfilingNode.

/**
 * create the real RepositoryNode for DataProfiling.
 *
 * @return
 */
public static RepositoryNode createRealDataProfilingNode(IProject project) {
    RepositoryNode node = null;
    RepositoryNodeBuilder instance = RepositoryNodeBuilder.getInstance();
    FolderHelper folderHelper = instance.getFolderHelper();
    IFolder iFolder = project.getFolder(Path.fromPortableString(ERepositoryObjectType.TDQ_DATA_PROFILING.getFolder()));
    IRepositoryViewObject viewObject = null;
    if (folderHelper != null) {
        IPath relativePath = iFolder.getFullPath().makeRelativeTo((project).getFullPath());
        FolderItem folder2 = folderHelper.getFolder(relativePath);
        if (folder2 != null && relativePath != null) {
            viewObject = new Folder(folder2.getProperty(), instance.retrieveRepObjectTypeByPath(relativePath.toOSString()));
        }
    } else {
        viewObject = new Folder(iFolder.getName(), iFolder.getName());
    }
    node = new RepositoryNode(viewObject, null, ENodeType.SYSTEM_FOLDER);
    viewObject.setRepositoryNode(node);
    return node;
}
Also used : FolderHelper(org.talend.core.repository.model.FolderHelper) FolderItem(org.talend.core.model.properties.FolderItem) IPath(org.eclipse.core.runtime.IPath) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) Folder(org.talend.core.model.repository.Folder) IFolder(org.eclipse.core.resources.IFolder) RepositoryNodeBuilder(org.talend.dataprofiler.core.ui.views.provider.RepositoryNodeBuilder) IFolder(org.eclipse.core.resources.IFolder)

Example 29 with FolderItem

use of org.talend.core.model.properties.FolderItem in project tdq-studio-se by Talend.

the class UpdateAfterMergeTosApiTask method deleteOldItemFile.

/**
 * DOC bZhou Comment method "deleteOldFile".
 *
 * @param file
 * @throws CoreException
 */
private void deleteOldItemFile(File file) throws CoreException {
    IFile itemFile = WorkspaceUtils.fileToIFile(file);
    IFile propFile = PropertyHelper.getPropertyFile(itemFile);
    Property property = PropertyHelper.getProperty(propFile);
    Item currentItem = property.getItem();
    if (currentItem.getParent() instanceof FolderItem) {
        ((FolderItem) currentItem.getParent()).getChildren().remove(currentItem);
    }
    itemFile.delete(true, null);
    propFile.delete(true, null);
}
Also used : Item(org.talend.core.model.properties.Item) FolderItem(org.talend.core.model.properties.FolderItem) DatabaseConnectionItem(org.talend.core.model.properties.DatabaseConnectionItem) IFile(org.eclipse.core.resources.IFile) FolderItem(org.talend.core.model.properties.FolderItem) Property(org.talend.core.model.properties.Property)

Example 30 with FolderItem

use of org.talend.core.model.properties.FolderItem in project tdq-studio-se by Talend.

the class RecycleBinRepNode method addItemToRecycleBin.

/**
 * DOC msjian Comment method "addItemToRecycleBin".
 */
private void addItemToRecycleBin(Project project) {
    List<DQRepositoryNode> foldersList = new ArrayList<DQRepositoryNode>();
    List<FolderItem> folderItems = ProjectManager.getInstance().getFolders(project.getEmfProject());
    for (FolderItem folderItem : folderItems) {
        if (isTDQOrSharedRootFolder(folderItem)) {
            addItemToRecycleBin(this, folderItem, foldersList, project);
        }
    }
}
Also used : FolderItem(org.talend.core.model.properties.FolderItem) ArrayList(java.util.ArrayList)

Aggregations

FolderItem (org.talend.core.model.properties.FolderItem)35 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)17 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)16 Item (org.talend.core.model.properties.Item)15 IFolder (org.eclipse.core.resources.IFolder)10 Folder (org.talend.core.model.repository.Folder)10 MetadataTable (org.talend.core.model.metadata.MetadataTable)7 Property (org.talend.core.model.properties.Property)6 ArrayList (java.util.ArrayList)5 IPath (org.eclipse.core.runtime.IPath)5 Path (org.eclipse.core.runtime.Path)5 PersistenceException (org.talend.commons.exception.PersistenceException)5 IFile (org.eclipse.core.resources.IFile)4 IProject (org.eclipse.core.resources.IProject)4 ConnectionItem (org.talend.core.model.properties.ConnectionItem)4 ProcessItem (org.talend.core.model.properties.ProcessItem)4 RepositoryViewObject (org.talend.core.model.repository.RepositoryViewObject)4 ContainerItem (org.talend.mdm.repository.model.mdmproperties.ContainerItem)4 URL (java.net.URL)3 EObject (org.eclipse.emf.ecore.EObject)3