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);
}
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);
}
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;
}
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);
}
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);
}
}
}
Aggregations