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