use of org.talend.core.model.repository.IExtendedRepositoryNodeHandler in project tdi-studio-se by Talend.
the class ExportItemWizardPage method exportDependenciesSelected.
/**
* DOC qwei Comment method "exportDependenciesSelected".
*/
private void exportDependenciesSelected() {
final Collection<Item> selectedItems = getSelectedItems();
// addTreeCheckedSelection();
IRunnableWithProgress runnable = new IRunnableWithProgress() {
@Override
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
//$NON-NLS-1$
monitor.beginTask("Dependencies", 100);
//
final List<IRepositoryViewObject> repositoryObjects = new ArrayList<IRepositoryViewObject>();
ProcessUtils.clearFakeProcesses();
RepositoryNodeUtilities.checkItemDependencies(selectedItems, repositoryObjects, false, true);
monitor.worked(60);
for (IRepositoryViewObject repositoryObject : repositoryObjects) {
RepositoryNode repositoryNode = RepositoryNodeUtilities.getRepositoryNode(repositoryObject, monitor);
if (repositoryNode != null) {
checkedDependency.add(repositoryNode);
} else {
implicitDependences.add(repositoryObject);
}
// check relateion ship for job -->map -->structure
for (IExtendedRepositoryNodeHandler nodeHandler : RepositoryContentManager.getExtendedNodeHandler()) {
List nodesAndDependencies = nodeHandler.getRepositoryNodeAndDependencies(repositoryObject);
if (!nodesAndDependencies.isEmpty()) {
checkedDependency.addAll(nodesAndDependencies);
}
}
}
// check relateion ship for map -->structure
for (Item item : selectedItems) {
for (IExtendedRepositoryNodeHandler nodeHandler : RepositoryContentManager.getExtendedNodeHandler()) {
List nodesAndDependencies = nodeHandler.getRepositoryNodeAndDependencies(new RepositoryObject(item.getProperty()));
if (!nodesAndDependencies.isEmpty()) {
checkedDependency.addAll(nodesAndDependencies);
}
}
}
monitor.worked(90);
ProcessUtils.clearFakeProcesses();
monitor.done();
}
};
// final ProgressMonitorJobsDialog dialog = new ProgressMonitorJobsDialog(getShell());
final ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
try {
dialog.run(true, true, runnable);
} catch (InvocationTargetException e) {
//
} catch (InterruptedException e) {
//
}
}
use of org.talend.core.model.repository.IExtendedRepositoryNodeHandler in project tdi-studio-se by Talend.
the class ExportItemWizardPage method collectNodes.
private void collectNodes(Map<String, Item> items, Object[] objects) {
for (Object object : objects) {
if (object instanceof RepositoryNode) {
RepositoryNode repositoryNode = (RepositoryNode) object;
IRepositoryViewObject repositoryObject = repositoryNode.getObject();
if (repositoryObject != null) {
if (repositoryObject.getRepositoryObjectType().isResourceItem()) {
Item item = repositoryObject.getProperty().getItem();
items.put(item.getProperty().getId(), item);
}
} else {
if (repositoryNode.getParent() != null && repositoryNode.getParent().getObject() != null) {
Item item = repositoryNode.getParent().getObject().getProperty().getItem();
items.put(item.getProperty().getId(), item);
}
}
if (filteredCheckboxTree != null && !isHadoopClusterNode(repositoryNode)) {
IContentProvider contentProvider = filteredCheckboxTree.getViewer().getContentProvider();
if (contentProvider instanceof ITreeContentProvider) {
// only check childrens of allowed items in this viewer
if (selectRepositoryNode(getItemsTreeViewer(), repositoryNode)) {
Object[] children = ((ITreeContentProvider) contentProvider).getChildren(repositoryNode);
List<Object> childrenNodes = getUnTestCaseChildren(children);
collectNodes(items, childrenNodes.toArray());
}
}
}
} else {
for (IExtendedRepositoryNodeHandler nodeHandler : RepositoryContentManager.getExtendedNodeHandler()) {
Property property = nodeHandler.getProperty(object);
if (property != null) {
items.put(property.getId(), property.getItem());
}
}
}
}
}
use of org.talend.core.model.repository.IExtendedRepositoryNodeHandler in project tdi-studio-se by Talend.
the class ExportItemWizardPage method getObjectType.
private ERepositoryObjectType getObjectType(Object nodeObject) {
ERepositoryObjectType objectType = null;
if (nodeObject instanceof RepositoryNode) {
RepositoryNode node = (RepositoryNode) nodeObject;
objectType = node.getObjectType();
// for user folders in metadata , routines , documentation
if (ERepositoryObjectType.FOLDER.equals(objectType)) {
RepositoryNode rootNode = getParentNodeNotFolder(node);
objectType = rootNode.getContentType();
}
if (objectType == null) {
objectType = node.getContentType();
}
} else {
for (IExtendedRepositoryNodeHandler nodeHandler : RepositoryContentManager.getExtendedNodeHandler()) {
objectType = nodeHandler.getObjectType(nodeObject);
if (objectType != null) {
return objectType;
}
}
}
return objectType;
}
Aggregations