use of org.talend.dq.nodes.ReportAnalysisRepNode in project tdq-studio-se by Talend.
the class DuplicateResourceProvider method shouldShowMenu.
/**
* DOC xqliu Comment method "shouldShowMenu".
*
* @param array
* @return
*/
private boolean shouldShowMenu(Object[] array) {
List<ENodeType> nodeTypes = new ArrayList<ENodeType>();
nodeTypes.add(ENodeType.REPOSITORY_ELEMENT);
nodeTypes.add(ENodeType.TDQ_REPOSITORY_ELEMENT);
List<IRepositoryNode> repositoryNodeList = RepositoryNodeHelper.getRepositoryNodeList(array, nodeTypes);
if (repositoryNodeList.size() == 0) {
return false;
}
List<ERepositoryObjectType> objectTypes = new ArrayList<ERepositoryObjectType>();
objectTypes.add(ERepositoryObjectType.TDQ_ANALYSIS_ELEMENT);
objectTypes.add(ERepositoryObjectType.TDQ_REPORT_ELEMENT);
objectTypes.add(ERepositoryObjectType.TDQ_INDICATOR_ELEMENT);
objectTypes.add(ERepositoryObjectType.TDQ_RULES_SQL);
objectTypes.add(ERepositoryObjectType.TDQ_RULES);
objectTypes.add(ERepositoryObjectType.TDQ_RULES_PARSER);
objectTypes.add(ERepositoryObjectType.TDQ_PATTERN_ELEMENT);
objectTypes.add(ERepositoryObjectType.TDQ_JRAXML_ELEMENT);
objectTypes.add(ERepositoryObjectType.TDQ_SOURCE_FILE_ELEMENT);
objectTypes.add(ERepositoryObjectType.METADATA_CONNECTIONS);
objectTypes.add(ERepositoryObjectType.TDQ_RULES_MATCHER);
objectTypes.add(ERepositoryObjectType.CONTEXT);
for (IRepositoryNode node : repositoryNodeList) {
// MOD qiongli 2011-2-12.filter elements in recycle bin.
if (RepositoryNodeHelper.isStateDeleted(node)) {
return false;
}
ERepositoryObjectType contentType = node.getObjectType();
if (contentType == null || (!objectTypes.contains(contentType) && !ConnectionUtils.isTcompJdbc(contentType.getLabel()))) {
return false;
}
RepositoryNode parent = node.getParent();
if ((parent instanceof ReportSubFolderRepNode) && (node instanceof AnalysisRepNode)) {
return false;
}
if (node instanceof ReportFileRepNode || node instanceof ReportAnalysisRepNode) {
return false;
}
}
return true;
}
use of org.talend.dq.nodes.ReportAnalysisRepNode in project tdq-studio-se by Talend.
the class RepositoryNodeHelper method isStateDeleted.
/**
* if logical delete state is true .
*
* @param node
* @return
*/
public static boolean isStateDeleted(IRepositoryNode node) {
final IRepositoryViewObject viewObject = node.getObject();
final IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
// TDQ's ISubRepositoryObject will return a null when call getAbstractMetadataObject()
if (viewObject instanceof ISubRepositoryObject) {
ISubRepositoryObject subRepositoryObject = (ISubRepositoryObject) viewObject;
if (subRepositoryObject.getAbstractMetadataObject() == null) {
return false;
}
}
if (node instanceof ReportAnalysisRepNode || node instanceof ReportFileRepNode) {
return false;
} else {
if (viewObject != null && factory.getStatus(viewObject) == ERepositoryStatus.DELETED) {
return true;
}
}
return false;
}
use of org.talend.dq.nodes.ReportAnalysisRepNode 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.ReportAnalysisRepNode in project tdq-studio-se by Talend.
the class RemoveAnalysisAction method run.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
DQRespositoryView findView = CorePlugin.getDefault().getRepositoryView();
if (findView == null) {
return;
}
TreeSelection treeSelection = (TreeSelection) findView.getCommonViewer().getSelection();
TreePath[] paths = treeSelection.getPaths();
List<Analysis> analysisList;
Analysis analysisObj = null;
Map<TDQReportItem, List<Analysis>> removeMap = new HashMap<TDQReportItem, List<Analysis>>();
for (TreePath path : paths) {
Object lastSegment = path.getLastSegment();
if (!(lastSegment instanceof ReportAnalysisRepNode)) {
return;
}
// MOD sizhaoliu 2012-06-12 TDQ-5051 "Remove Anaysis" menu item is not in the right place
ReportAnalysisRepNode repNode = (ReportAnalysisRepNode) lastSegment;
analysisObj = repNode.getAnalysis();
TDQReportItem reportItem = repNode.getReportItem();
analysisList = removeMap.get(reportItem);
if (analysisList == null) {
analysisList = new ArrayList<Analysis>();
analysisList.add(analysisObj);
removeMap.put(reportItem, analysisList);
} else {
analysisList.add(analysisObj);
}
}
if (analysisObj == null) {
return;
}
String message = paths.length > 1 ? DefaultMessagesImpl.getString("RemoveAnalysisAction.areYouDeleteElement0", // $NON-NLS-1$
paths.length) : // $NON-NLS-1$
DefaultMessagesImpl.getString("RemoveAnalysisAction.areYouDeleteElement2", analysisObj.getName());
boolean openConfirm = MessageDialog.openConfirm(null, DefaultMessagesImpl.getString("RemoveAnalysisAction.confirmResourceDelete"), // $NON-NLS-1$
message);
if (openConfirm) {
Iterator<TDQReportItem> iterator = removeMap.keySet().iterator();
while (iterator.hasNext()) {
TDQReportItem reportItem = iterator.next();
ReportHelper.removeAnalyses((TdReport) reportItem.getReport(), removeMap.get(reportItem));
// save now modified resources (that contain the Dependency
// objects)
ElementWriterFactory.getInstance().createReportWriter().save(reportItem, true);
}
IFolder reportsFolder = ResourceManager.getReportsFolder();
try {
reportsFolder.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
log.error(e, e);
}
findView.getCommonViewer().refresh();
}
}
use of org.talend.dq.nodes.ReportAnalysisRepNode in project tdq-studio-se by Talend.
the class AnalysisEditor method performGlobalAction.
public void performGlobalAction(String id) {
if (id.equals(RunAnalysisAction.ID)) {
// TDQ-10748: make the ref project analysis can not run when press F6
IRepositoryNode currentRepNode = this.getMasterPage().getCurrentRepNode();
boolean isMainProject = false;
if (currentRepNode instanceof ReportAnalysisRepNode) {
isMainProject = ((ReportAnalysisRepNode) currentRepNode).getProject().isMainProject();
} else if (currentRepNode instanceof AnalysisRepNode) {
isMainProject = ((AnalysisRepNode) currentRepNode).getProject().isMainProject();
}
if (isMainProject) {
runAction.run();
}
// TDQ-10748~
return;
}
if (analysisType == AnalysisType.MULTIPLE_COLUMN) {
((ColumnAnalysisDetailsPage) masterPage).performGlobalAction(id);
}
if (analysisType == AnalysisType.TABLE) {
((BusinessRuleAnalysisDetailsPage) masterPage).performGlobalAction(id);
}
}
Aggregations