use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.
the class DBTreeProvider method getParent.
public Object getParent(Object element) {
RepositoryNode node = (RepositoryNode) element;
final RepositoryNode parent = node.getParent();
if (parent != null) {
return parent;
} else {
return node;
}
}
use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.
the class DBTreeProvider method createQuery.
private void createQuery(RepositoryNode queriesConnectionNode, IRepositoryViewObject repObj, QueriesConnection queriesConnection) {
displayQueries.clear();
for (Iterator iter = queriesConnection.getQuery().iterator(); iter.hasNext(); ) {
Query query = (Query) iter.next();
boolean isDelete = SubItemHelper.isDeleted(query);
boolean isReadOnly = connectionParameters.isNodeReadOnly();
if (isDelete && !isReadOnly) {
continue;
}
// if (!TableHelper.isDeleted(query)) {
QueryRepositoryObject repositoryObject = new QueryRepositoryObject(repObj, query);
repositoryObject.setImage(IMAGES_SQL_EDITOR_ICON);
repositoryObject.setSourceName(query.getLabel());
RepositoryNode node = new RepositoryNodeExt(repositoryObject, queriesConnectionNode, ENodeType.REPOSITORY_ELEMENT);
node.setProperties(EProperties.CONTENT_TYPE, RepositoryNodeType.QUERY);
queriesConnectionNode.getChildren().add(node);
if (connectionParameters.getQueryObject() != null && query.getLabel().equals(connectionParameters.getQueryObject().getLabel())) {
this.selectedExtReposiotryNode = node;
}
displayQueries.add(query);
// }
}
}
use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.
the class DBTreeProvider method createQueries.
private void createQueries(RepositoryNode node, final IRepositoryViewObject repObj, DatabaseConnection metadataConnection, boolean isBuildIn) {
QueriesConnection queriesConnection = metadataConnection.getQueries();
if (queriesConnection != null) {
QueriesConnectionRepositoryObject repositoryObject = new QueriesConnectionRepositoryObject(repObj, queriesConnection);
repositoryObject.setImage(IMAGES_APPEND_TO_EDITOR);
//$NON-NLS-1$
repositoryObject.setSourceName(Messages.getString("DBTreeProvider.sourceName"));
RepositoryNode queriesConnectionNode = new RepositoryNodeExt(repositoryObject, node, ENodeType.REPOSITORY_ELEMENT);
queriesConnectionNode.setProperties(EProperties.CONTENT_TYPE, RepositoryNodeType.QUERIESCONNECTION);
node.getChildren().add(queriesConnectionNode);
createQuery(queriesConnectionNode, repObj, queriesConnection);
}
}
use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.
the class DBTreeProvider method getColumnImage.
public Image getColumnImage(Object element, int columnIndex) {
RepositoryNode node = (RepositoryNode) element;
SqlBuilderRepositoryObject repositoryObject = (SqlBuilderRepositoryObject) node.getObject();
if (columnIndex == 1) {
return null;
} else if (columnIndex == 2) {
if ((repositoryObject).getDiffImage() == null) {
return null;
}
return ImageUtil.getImage((repositoryObject).getDiffImage());
}
return ImageUtil.getImage((repositoryObject).getImage());
}
use of org.talend.repository.model.RepositoryNode 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);
}
}
Aggregations