Search in sources :

Example 1 with ReportAnalysisRepNode

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;
}
Also used : ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode) AnalysisRepNode(org.talend.dq.nodes.AnalysisRepNode) ReportFileRepNode(org.talend.dq.nodes.ReportFileRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ArrayList(java.util.ArrayList) ENodeType(org.talend.repository.model.IRepositoryNode.ENodeType) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) ReportSubFolderRepNode(org.talend.dq.nodes.ReportSubFolderRepNode) ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode)

Example 2 with ReportAnalysisRepNode

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;
}
Also used : ReportFileRepNode(org.talend.dq.nodes.ReportFileRepNode) ISubRepositoryObject(org.talend.core.model.repository.ISubRepositoryObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 3 with ReportAnalysisRepNode

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;
}
Also used : DBConnectionRepNode(org.talend.dq.nodes.DBConnectionRepNode) DBColumnRepNode(org.talend.dq.nodes.DBColumnRepNode) SourceFileRepNode(org.talend.dq.nodes.SourceFileRepNode) DBViewFolderRepNode(org.talend.dq.nodes.DBViewFolderRepNode) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) ReportRepNode(org.talend.dq.nodes.ReportRepNode) ExchangeComponentRepNode(org.talend.dataprofiler.core.ui.exchange.ExchangeComponentRepNode) SysIndicatorDefinitionRepNode(org.talend.dq.nodes.SysIndicatorDefinitionRepNode) DFTableRepNode(org.talend.dq.nodes.DFTableRepNode) DBConnectionFolderRepNode(org.talend.dq.nodes.DBConnectionFolderRepNode) DBViewRepNode(org.talend.dq.nodes.DBViewRepNode) PatternRepNode(org.talend.dq.nodes.PatternRepNode) DBTableFolderRepNode(org.talend.dq.nodes.DBTableFolderRepNode) DFColumnFolderRepNode(org.talend.dq.nodes.DFColumnFolderRepNode) DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) RuleRepNode(org.talend.dq.nodes.RuleRepNode) JrxmlTempleteRepNode(org.talend.dq.nodes.JrxmlTempleteRepNode) RecycleBinRepNode(org.talend.dq.nodes.RecycleBinRepNode) DBColumnFolderRepNode(org.talend.dq.nodes.DBColumnFolderRepNode) DFColumnRepNode(org.talend.dq.nodes.DFColumnRepNode) DBTableRepNode(org.talend.dq.nodes.DBTableRepNode) ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode) AnalysisRepNode(org.talend.dq.nodes.AnalysisRepNode) ExchangeCategoryRepNode(org.talend.dataprofiler.core.ui.exchange.ExchangeCategoryRepNode) DFConnectionRepNode(org.talend.dq.nodes.DFConnectionRepNode) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ENodeType(org.talend.repository.model.IRepositoryNode.ENodeType) ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode)

Example 4 with ReportAnalysisRepNode

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();
    }
}
Also used : HashMap(java.util.HashMap) TreePath(org.eclipse.jface.viewers.TreePath) CoreException(org.eclipse.core.runtime.CoreException) TreeSelection(org.eclipse.jface.viewers.TreeSelection) Analysis(org.talend.dataquality.analysis.Analysis) ArrayList(java.util.ArrayList) List(java.util.List) DQRespositoryView(org.talend.dataprofiler.core.ui.views.DQRespositoryView) ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode) TDQReportItem(org.talend.dataquality.properties.TDQReportItem) IFolder(org.eclipse.core.resources.IFolder)

Example 5 with ReportAnalysisRepNode

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);
    }
}
Also used : ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode) AnalysisRepNode(org.talend.dq.nodes.AnalysisRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode)

Aggregations

ReportAnalysisRepNode (org.talend.dq.nodes.ReportAnalysisRepNode)9 AnalysisRepNode (org.talend.dq.nodes.AnalysisRepNode)6 IRepositoryNode (org.talend.repository.model.IRepositoryNode)4 ENodeType (org.talend.repository.model.IRepositoryNode.ENodeType)4 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)3 ReportRepNode (org.talend.dq.nodes.ReportRepNode)3 ArrayList (java.util.ArrayList)2 TreeSelection (org.eclipse.jface.viewers.TreeSelection)2 ExchangeCategoryRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeCategoryRepNode)2 ExchangeComponentRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeComponentRepNode)2 Analysis (org.talend.dataquality.analysis.Analysis)2 TDQReportItem (org.talend.dataquality.properties.TDQReportItem)2 DBCatalogRepNode (org.talend.dq.nodes.DBCatalogRepNode)2 DBColumnFolderRepNode (org.talend.dq.nodes.DBColumnFolderRepNode)2 DBColumnRepNode (org.talend.dq.nodes.DBColumnRepNode)2 DBConnectionFolderRepNode (org.talend.dq.nodes.DBConnectionFolderRepNode)2 DBConnectionRepNode (org.talend.dq.nodes.DBConnectionRepNode)2 DBSchemaRepNode (org.talend.dq.nodes.DBSchemaRepNode)2 DBTableFolderRepNode (org.talend.dq.nodes.DBTableFolderRepNode)2 DBTableRepNode (org.talend.dq.nodes.DBTableRepNode)2