use of org.talend.dq.nodes.DBSchemaRepNode in project tdq-studio-se by Talend.
the class ImageLib method getImageNameByRepositoryNode.
public static String getImageNameByRepositoryNode(IRepositoryNode node) {
String imageName = null;
IRepositoryViewObject viewObject = node.getObject();
ENodeType type = node.getType();
if (node instanceof ReportAnalysisRepNode) {
imageName = ImageLib.ANALYSIS_OBJECT;
} else if (node instanceof RecycleBinRepNode) {
imageName = ImageLib.RECYCLEBIN_EMPTY;
} else if (type.equals(ENodeType.SYSTEM_FOLDER)) {
String label = viewObject.getLabel();
if (label.equals(EResourceConstant.DATA_PROFILING.getName())) {
imageName = ImageLib.DATA_PROFILING;
} else if (label.equals(EResourceConstant.METADATA.getName())) {
imageName = ImageLib.METADATA;
} else if (node instanceof DBConnectionFolderRepNode) {
imageName = ImageLib.CONNECTION;
} else if (label.equals(EResourceConstant.FILEDELIMITED.getName())) {
imageName = ImageLib.FILE_DELIMITED;
} else if (label.equals(EResourceConstant.HADOOP_CLUSTER.getName())) {
imageName = ImageLib.HADOOP_CLUSTER;
} else if (label.equals(EResourceConstant.LIBRARIES.getName())) {
imageName = ImageLib.LIBRARIES;
} else if (label.equals(EResourceConstant.EXCHANGE.getName())) {
imageName = ImageLib.EXCHANGE;
} else {
imageName = ImageLib.FOLDERNODE_IMAGE;
}
} else if (type.equals(ENodeType.SIMPLE_FOLDER)) {
imageName = ImageLib.FOLDERNODE_IMAGE;
} else if (type.equals(ENodeType.REPOSITORY_ELEMENT)) {
if (node instanceof DBConnectionRepNode) {
imageName = ImageLib.TD_DATAPROVIDER;
} else if (node instanceof DFConnectionRepNode) {
imageName = ImageLib.FILE_DELIMITED;
} else if (node instanceof AnalysisRepNode) {
imageName = ImageLib.ANALYSIS_OBJECT;
} else if (node instanceof ReportRepNode) {
imageName = ImageLib.REPORT_OBJECT;
} else if (node instanceof SysIndicatorDefinitionRepNode) {
imageName = ImageLib.IND_DEFINITION;
} else if (node instanceof PatternRepNode) {
imageName = ImageLib.PATTERN_REG;
} else if (node instanceof RuleRepNode) {
imageName = ImageLib.DQ_RULE;
} else if (node instanceof SourceFileRepNode) {
imageName = ImageLib.SOURCE_FILE;
} else if (node instanceof ExchangeCategoryRepNode || node instanceof ExchangeComponentRepNode) {
imageName = ImageLib.EXCHANGE;
} else if (node instanceof JrxmlTempleteRepNode) {
imageName = ImageLib.JRXML_ICON;
}
} else if (type.equals(ENodeType.TDQ_REPOSITORY_ELEMENT)) {
if (node instanceof DBCatalogRepNode) {
imageName = ImageLib.CATALOG;
} else if (node instanceof DBSchemaRepNode) {
imageName = ImageLib.SCHEMA;
} else if (node instanceof DBTableFolderRepNode) {
imageName = ImageLib.FOLDERNODE_IMAGE;
} else if (node instanceof DBViewFolderRepNode) {
imageName = ImageLib.FOLDERNODE_IMAGE;
} else if (node instanceof DBTableRepNode || node instanceof DFTableRepNode) {
imageName = ImageLib.TABLE;
} else if (node instanceof DBViewRepNode) {
imageName = ImageLib.VIEW;
} else if (node instanceof DBColumnRepNode) {
if (((DBColumnRepNode) node).isKey()) {
imageName = ImageLib.PK_COLUMN;
} else {
imageName = ImageLib.TD_COLUMN;
}
} else if (node instanceof DFColumnRepNode) {
imageName = ImageLib.TD_COLUMN;
} else if (node instanceof DBColumnFolderRepNode || node instanceof DFColumnFolderRepNode) {
imageName = ImageLib.FOLDERNODE_IMAGE;
}
}
return imageName;
}
use of org.talend.dq.nodes.DBSchemaRepNode in project tdq-studio-se by Talend.
the class OverviewAnalysisAction method run.
@Override
public void run() {
PackagesAnalyisParameter packaFilterParameter = new PackagesAnalyisParameter();
catalogs.clear();
for (IRepositoryNode node : nodes) {
if (node instanceof DBConnectionRepNode) {
packaFilterParameter.setConnectionRepNode((DBConnectionRepNode) node);
connNode = (DBConnectionRepNode) node;
} else if (node instanceof DBCatalogRepNode) {
IRepositoryNode parent = ((DBCatalogRepNode) node).getParent();
packaFilterParameter.setConnectionRepNode((DBConnectionRepNode) parent);
catalogs.add(node);
packaFilterParameter.setPackages(catalogs);
cataNode = (DBCatalogRepNode) node;
} else if (node instanceof DBSchemaRepNode) {
IRepositoryNode parent = ((DBSchemaRepNode) node).getParent();
schemaNode = (DBSchemaRepNode) node;
if (parent instanceof DBCatalogRepNode) {
IRepositoryNode connNode = ((DBCatalogRepNode) parent).getParent();
packaFilterParameter.setConnectionRepNode((DBConnectionRepNode) connNode);
catalogs.add(schemaNode);
packaFilterParameter.setPackages(catalogs);
} else {
catalogs.add(schemaNode);
packaFilterParameter.setConnectionRepNode((DBConnectionRepNode) parent);
packaFilterParameter.setPackages(catalogs);
}
}
}
Wizard wizard = null;
if (connNode != null) {
packaFilterParameter.setConnectionRepNode(connNode);
wizard = WizardFactory.createAnalysisWizard(AnalysisType.CONNECTION, packaFilterParameter);
} else if (cataNode != null) {
wizard = WizardFactory.createAnalysisWizard(AnalysisType.CATALOG, packaFilterParameter);
} else if (schemaNode != null) {
wizard = WizardFactory.createAnalysisWizard(AnalysisType.SCHEMA, packaFilterParameter);
}
WizardDialog dialog = new WizardDialog(null, wizard);
dialog.setPageSize(WIDTH, HEIGHT);
dialog.open();
}
use of org.talend.dq.nodes.DBSchemaRepNode in project tdq-studio-se by Talend.
the class RepositoryNodeHelper method recursiveFindSchema.
public static DBSchemaRepNode recursiveFindSchema(Schema schema) {
if (schema == null) {
return null;
}
String uuidSchema = getUUID(schema);
if (uuidSchema == null) {
return null;
}
Catalog catalog = CatalogHelper.getParentCatalog(schema);
// Schema's parent is catalog (MS SQL Server)
if (catalog != null) {
DBCatalogRepNode catalogNode = recursiveFindCatalog(catalog);
List<IRepositoryNode> children = catalogNode.getChildren();
if (children.size() > 0) {
IRepositoryNode iRepositoryNode = children.get(0);
if (iRepositoryNode != null && iRepositoryNode instanceof DBSchemaRepNode) {
for (IRepositoryNode childNode : children) {
if (childNode != null && childNode instanceof DBSchemaRepNode) {
DBSchemaRepNode dbSchemaRepNode = (DBSchemaRepNode) childNode;
if (uuidSchema.equals(getUUID(dbSchemaRepNode.getSchema()))) {
return dbSchemaRepNode;
}
}
}
}
}
}
// schema's parent is connection (e.g Oracle)
IRepositoryNode connNode = recursiveFind(ConnectionHelper.getTdDataProvider(schema));
if (connNode != null) {
List<IRepositoryNode> children = connNode.getChildren();
if (children.size() > 0) {
IRepositoryNode iRepositoryNode = children.get(0);
if (iRepositoryNode != null && iRepositoryNode instanceof DBSchemaRepNode) {
for (IRepositoryNode childNode : children) {
if (childNode != null && childNode instanceof DBSchemaRepNode) {
DBSchemaRepNode dbSchemaRepNode = (DBSchemaRepNode) childNode;
if (uuidSchema.equals(getUUID(dbSchemaRepNode.getSchema()))) {
return dbSchemaRepNode;
}
}
}
}
}
}
return null;
}
use of org.talend.dq.nodes.DBSchemaRepNode in project tdq-studio-se by Talend.
the class ExportConnecitonActionProvider method fillContextMenu.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
*/
@Override
public void fillContextMenu(IMenuManager menu) {
// MOD mzhao user readonly role on svn repository mode.
if (!isShowMenu()) {
return;
}
List<Object> selectionList = ((TreeSelection) this.getContext().getSelection()).toList();
List<Package> packList = new ArrayList<Package>();
boolean showMenu = false;
for (Object obj : selectionList) {
if (obj instanceof DBCatalogRepNode || obj instanceof DBSchemaRepNode) {
// MOD gdbu 2011-12-29 TDQ-4281 Remove the "create a new connection" menu under
// AnalysisSubFolderRepNode.
RepositoryNode node = (RepositoryNode) obj;
if (node.getParent() instanceof AnalysisSubFolderRepNode) {
return;
}
// ~TDQ-4281
ModelElement me = RepositoryNodeHelper.getModelElementFromRepositoryNode(node);
if (me != null && me instanceof Package) {
Package pack = (Package) me;
packList.add(pack);
showMenu = true;
}
}
}
if (showMenu) {
ExportConnectionToTOSAction action = new ExportConnectionToTOSAction(packList);
menu.add(action);
}
}
use of org.talend.dq.nodes.DBSchemaRepNode in project tdq-studio-se by Talend.
the class DQRepositoryViewLabelProvider method getImage.
@Override
public Image getImage(Object element) {
Image image = super.getImage(element);
if (element instanceof IRepositoryNode) {
IRepositoryNode node = (IRepositoryNode) element;
if (node instanceof ReportAnalysisRepNode) {
image = ImageLib.getImage(ImageLib.ANALYSIS_OBJECT);
} else if (node instanceof ExchangeCategoryRepNode || node instanceof ExchangeComponentRepNode) {
image = ImageLib.getImage(ImageLib.EXCHANGE);
} else if (node instanceof RecycleBinRepNode) {
image = ImageLib.getImage(ImageLib.RECYCLEBIN_EMPTY);
} else {
IRepositoryViewObject viewObject = node.getObject();
ENodeType type = node.getType();
if (type.equals(ENodeType.SYSTEM_FOLDER)) {
if (EResourceConstant.REFERENCED_PROJECT.getName().equals(node.getProperties(EProperties.LABEL))) {
image = ImageLib.getImage(ImageLib.REFERENCED_PROJECT);
} else {
String label = viewObject.getLabel();
if (label.equals(EResourceConstant.DATA_PROFILING.getName())) {
image = ImageLib.getImage(ImageLib.DATA_PROFILING);
} else if (label.equals(EResourceConstant.METADATA.getName())) {
image = ImageLib.getImage(ImageLib.METADATA);
} else if (node instanceof DBConnectionFolderRepNode) {
image = ImageLib.getImage(ImageLib.CONNECTION);
} else if (label.equals(EResourceConstant.FILEDELIMITED.getName())) {
image = ImageLib.getImage(ImageLib.FILE_DELIMITED);
} else if (label.equals(EResourceConstant.LIBRARIES.getName())) {
image = ImageLib.getImage(ImageLib.LIBRARIES);
} else if (label.equals(EResourceConstant.EXCHANGE.getName())) {
image = ImageLib.getImage(ImageLib.EXCHANGE);
} else if (label.equals(EResourceConstant.HADOOP_CLUSTER.getName())) {
image = ImageLib.getImage(ImageLib.HADOOP_CLUSTER);
} else if (label.equals(EResourceConstant.CONTEXT.getName())) {
image = ImageLib.getImage(ImageLib.CONTEXT);
} else {
image = ImageLib.getImage(ImageLib.FOLDERNODE_IMAGE);
}
}
} else if (type.equals(ENodeType.SIMPLE_FOLDER)) {
image = ImageLib.getImage(ImageLib.FOLDERNODE_IMAGE);
} else if (type.equals(ENodeType.REFERENCED_PROJECT)) {
image = ImageLib.getImage(ImageLib.REFERENCED_PROJECT);
} else if (type.equals(ENodeType.REPOSITORY_ELEMENT)) {
// TDQ-7560 when the image is a overlay image,use originalImageName to get the corresponding one.
String originalImageName = null;
if (node instanceof DBConnectionRepNode) {
originalImageName = ImageLib.TD_DATAPROVIDER;
if (!RepositoryNodeHelper.isSupportedConnection(node) || isNeedAddDriverConnection(node)) {
image = ImageLib.createErrorIcon(originalImageName);
} else if (isInvalidJDBCConnection(node)) {
image = ImageLib.createInvalidIcon(originalImageName);
} else {
image = ImageLib.getImage(originalImageName);
}
} else if (node instanceof DFConnectionRepNode) {
originalImageName = ImageLib.FILE_DELIMITED;
} else if (node instanceof AnalysisRepNode) {
originalImageName = ImageLib.ANALYSIS_OBJECT;
image = addWarnIconIfNeeded(node, originalImageName);
} else if (node instanceof ReportRepNode) {
originalImageName = ImageLib.REPORT_OBJECT;
image = addWarnIconIfNeeded(node, originalImageName);
} else if (node instanceof SysIndicatorDefinitionRepNode) {
originalImageName = ImageLib.IND_DEFINITION;
} else if (node instanceof PatternRepNode) {
originalImageName = ImageLib.PATTERN_REG;
} else if (node instanceof RuleRepNode) {
if (((RuleRepNode) node).getRule() instanceof MatchRuleDefinition) {
originalImageName = ImageLib.MATCH_RULE_ICON;
} else {
originalImageName = ImageLib.DQ_RULE;
}
} else if (node instanceof SourceFileRepNode) {
originalImageName = ImageLib.SOURCE_FILE;
} else if (node instanceof HadoopClusterConnectionRepNode) {
originalImageName = ImageLib.HADOOP_CLUSTER;
} else if (node instanceof HDFSOfHCConnectionNode) {
originalImageName = ImageLib.HDFS;
} else if (node instanceof HiveOfHCConnectionNode) {
originalImageName = ImageLib.HIVE_LINK;
} else if (node instanceof ExchangeCategoryRepNode || node instanceof ExchangeComponentRepNode) {
originalImageName = ImageLib.EXCHANGE;
} else if (node instanceof ContextRepNode) {
originalImageName = ImageLib.CONTEXT;
} else if (node instanceof RepositoryNode) {
// MOD qiongli 2011-1-18 get image for nodes in recycle bin
Image imageNode = getImageByContentType((RepositoryNode) node);
if (image != null) {
image = imageNode;
}
}
if (originalImageName != null && !(node instanceof DBConnectionRepNode || node instanceof AnalysisRepNode || node instanceof ReportRepNode)) {
image = ImageLib.getImage(originalImageName);
}
// exchange folder did not contain viewObject.
if (viewObject != null) {
// MOD yyi 2011-04-07 19696: "Lock element"
ERepositoryStatus status = ProxyRepositoryFactory.getInstance().getStatus(viewObject);
Context ctx = CoreRuntimePlugin.getInstance().getContext();
RepositoryContext rc = (RepositoryContext) ctx.getProperty(Context.REPOSITORY_CONTEXT_KEY);
// will be enhanced later by TDI-29265.
if (rc.isEditableAsReadOnly()) {
if (status == ERepositoryStatus.LOCK_BY_USER) {
status = ERepositoryStatus.DEFAULT;
}
}
if (ERepositoryStatus.DEFAULT != status && originalImageName != null) {
if (ERepositoryStatus.LOCK_BY_USER == status) {
image = ImageLib.createLockedByOwnIcon(originalImageName);
} else if (ERepositoryStatus.LOCK_BY_OTHER == status) {
image = ImageLib.createLockedByOtherIcon(originalImageName);
}
}
}
} else if (type.equals(ENodeType.TDQ_REPOSITORY_ELEMENT)) {
if (node instanceof DBCatalogRepNode) {
image = ImageLib.getImage(ImageLib.CATALOG);
} else if (node instanceof DBSchemaRepNode) {
image = ImageLib.getImage(ImageLib.SCHEMA);
} else if (node instanceof DBTableFolderRepNode) {
image = ImageLib.getImage(ImageLib.FOLDERNODE_IMAGE);
} else if (node instanceof DBViewFolderRepNode) {
image = ImageLib.getImage(ImageLib.FOLDERNODE_IMAGE);
} else if (node instanceof DBTableRepNode || node instanceof DFTableRepNode) {
image = ImageLib.getImage(ImageLib.TABLE);
} else if (node instanceof DBViewRepNode) {
image = ImageLib.getImage(ImageLib.VIEW);
} else if (node instanceof DBColumnRepNode) {
if (((DBColumnRepNode) node).isKey()) {
image = ImageLib.getImage(ImageLib.PK_COLUMN);
} else {
image = ImageLib.getImage(ImageLib.TD_COLUMN);
}
} else if (node instanceof DFColumnRepNode) {
image = ImageLib.getImage(ImageLib.TD_COLUMN);
} else if (node instanceof DBColumnFolderRepNode || node instanceof DFColumnFolderRepNode) {
image = ImageLib.getImage(ImageLib.FOLDERNODE_IMAGE);
} else if (node instanceof JrxmlTempleteRepNode) {
image = ImageLib.getImage(ImageLib.JRXML_ICON);
}
}
}
}
return image;
}
Aggregations