use of org.talend.commons.utils.data.container.Container 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.commons.utils.data.container.Container in project tdi-studio-se by Talend.
the class DBTreeProvider method getMetadataConnection.
/**
* @return MetadataConnection
*/
@SuppressWarnings("unchecked")
private Container getMetadataConnection() {
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
ProjectManager pManager = ProjectManager.getInstance();
Container container = null;
try {
container = factory.getMetadata(pManager.getCurrentProject(), ERepositoryObjectType.METADATA_CONNECTIONS);
pManager.retrieveReferencedProjects();
for (Project p : pManager.getAllReferencedProjects()) {
RootContainer rContainer = factory.getMetadata(p, ERepositoryObjectType.METADATA_CONNECTIONS);
if (container == null) {
container = rContainer;
} else if (rContainer != null) {
Iterator iterator = rContainer.absoluteKeySet().iterator();
while (iterator.hasNext()) {
Object id = iterator.next();
container.addMember(id, rContainer.getAbsoluteMember(id));
}
}
}
} catch (PersistenceException e) {
//$NON-NLS-1$
SqlBuilderPlugin.log(Messages.getString("DBTreeProvider.logMessage"), e);
} catch (BusinessException e) {
//$NON-NLS-1$
SqlBuilderPlugin.log(Messages.getString("DBTreeProvider.logMessage"), e);
}
return container;
}
use of org.talend.commons.utils.data.container.Container in project tdi-studio-se by Talend.
the class DBTreeProvider method initialize.
private void initialize(RepositoryNode treeRoot) {
if (!connectionParameters.isRepository()) {
addNode(treeRoot, repositoryNodeManager.getRepositoryNodeByBuildIn(treeRoot, connectionParameters).getObject(), true, null);
} else {
Container metadataConnection = getMetadataConnection();
convert(metadataConnection, treeRoot, ERepositoryObjectType.METADATA_CONNECTIONS);
}
}
Aggregations