Search in sources :

Example 11 with AnalysisMap

use of org.talend.dataquality.reports.AnalysisMap in project tdq-studio-se by Talend.

the class TdReportImpl method removeAnalysis.

/**
 * <!-- begin-user-doc --> Remove the analysis. Return true if the analysis is removed from the report and from its
 * internal map, false otherwise. <!-- end-user-doc -->
 *
 * @generated NOT removeAnalysis(Analysis analysis)
 */
@Override
public boolean removeAnalysis(Analysis analysis) {
    EList<AnalysisMap> anMaps = this.getAnalysisMap();
    boolean removedFromMap = false;
    for (AnalysisMap anMap : anMaps) {
        if (ResourceHelper.areSame(analysis, anMap.getAnalysis())) {
            anMaps.remove(anMap);
            removedFromMap = true;
            break;
        }
    }
    // MOD yyin 20120530 TDQ-5050
    return removedFromMap;
}
Also used : AnalysisMap(org.talend.dataquality.reports.AnalysisMap)

Example 12 with AnalysisMap

use of org.talend.dataquality.reports.AnalysisMap in project tdq-studio-se by Talend.

the class EObjectHelper method getDependedReportOfJrxml.

/**
 * Go throught all reports in the project and return all which used the current jrxml.
 *
 * @param node the Jrxml node
 * @return list of reports who used this jrxml as user defined template
 */
public static List<ModelElement> getDependedReportOfJrxml(IRepositoryNode node) {
    List<ModelElement> dependedReport = new ArrayList<ModelElement>();
    if (node.getObject().getProperty() == null) {
        return dependedReport;
    }
    IPath path = PropertyHelper.getItemPath(node.getObject().getProperty());
    // check if it has depended Report
    // get all reports
    List<ReportRepNode> repNodes = RepositoryNodeHelper.getReportRepNodes(RepositoryNodeHelper.getDataProfilingFolderNode(EResourceConstant.REPORTS), true, true);
    // go through every report to find if any one used current jrxml
    for (ReportRepNode report : repNodes) {
        EList<AnalysisMap> analysisMap = ((TdReport) report.getReport()).getAnalysisMap();
        for (AnalysisMap anaMap : analysisMap) {
            if (isUsedByDeletedJrxml(path, anaMap)) {
                dependedReport.add(report.getReport());
                break;
            }
        }
    }
    return dependedReport;
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) IPath(org.eclipse.core.runtime.IPath) ReportRepNode(org.talend.dq.nodes.ReportRepNode) TdReport(org.talend.dataquality.reports.TdReport) ArrayList(java.util.ArrayList) AnalysisMap(org.talend.dataquality.reports.AnalysisMap)

Example 13 with AnalysisMap

use of org.talend.dataquality.reports.AnalysisMap in project tdq-studio-se by Talend.

the class TdReportImpl method setMustRefresh.

/**
 * <!-- begin-user-doc --> Returns true is the boolean has been set correctly, false otherwise. False could mean
 * that the given analysis does not appear in this report. <!-- end-user-doc -->
 *
 * @generated NOT boolean setMustRefresh(Analysis analysis, boolean mustRefresh)
 */
@Override
public boolean setMustRefresh(Analysis analysis, boolean mustRefresh) {
    boolean ok = false;
    EList<AnalysisMap> anMaps = this.getAnalysisMap();
    // checkbox.
    for (AnalysisMap anMap : anMaps) {
        if (ResourceHelper.areSame(analysis, anMap.getAnalysis())) {
            ok = true;
            anMap.setMustRefresh(mustRefresh);
            break;
        }
    }
    if (!ok) {
        // MOD yyin 20120530 TDQ-5050
        AnalysisMap createAnalysisMap = ReportsFactory.eINSTANCE.createAnalysisMap();
        createAnalysisMap.setAnalysis(analysis);
        createAnalysisMap.setMustRefresh(mustRefresh);
        createAnalysisMap.setReportType(ReportType.getReportType(analysis, ReportHelper.BASIC).getLabel());
        this.getAnalysisMap().add(createAnalysisMap);
        ok = true;
    }
    return ok;
}
Also used : AnalysisMap(org.talend.dataquality.reports.AnalysisMap)

Example 14 with AnalysisMap

use of org.talend.dataquality.reports.AnalysisMap in project tdq-studio-se by Talend.

the class TdReportImpl method mustRefresh.

/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 *
 * @generated NOT mustRefresh(Analysis analysis)
 */
@Override
public boolean mustRefresh(Analysis analysis) {
    boolean yes = true;
    EList<AnalysisMap> anMaps = this.getAnalysisMap();
    for (AnalysisMap anMap : anMaps) {
        if (ResourceHelper.areSame(analysis, anMap.getAnalysis())) {
            yes = anMap.isMustRefresh();
            break;
        }
    }
    return yes;
}
Also used : AnalysisMap(org.talend.dataquality.reports.AnalysisMap)

Example 15 with AnalysisMap

use of org.talend.dataquality.reports.AnalysisMap in project tdq-studio-se by Talend.

the class DQRepositoryViewLabelProvider method addWarnIconIfNeeded.

/**
 * if it is needed,add a over warning icon..eg., it is empty analysis or report; imported a MDM analysis or report.
 *
 * @param image
 * @param node
 * @param originalImageName
 * @return
 */
private Image addWarnIconIfNeeded(IRepositoryNode node, String originalImageName) {
    ModelElement modEle = RepositoryNodeHelper.getResourceModelElement(node);
    ERepositoryObjectType objectType = node.getObjectType();
    if (modEle != null) {
        if (ERepositoryObjectType.TDQ_ANALYSIS_ELEMENT == objectType) {
            Analysis analysis = (Analysis) modEle;
            AnalysisContext context = analysis.getContext();
            if (context == null) {
                return ImageLib.createInvalidIcon(originalImageName);
            }
            EList<ModelElement> analysedElements = context.getAnalysedElements();
            DataManager connection = context.getConnection();
            if (analysedElements.isEmpty() || connection instanceof MDMConnection) {
                return ImageLib.createInvalidIcon(originalImageName);
            }
        } else if (ERepositoryObjectType.TDQ_REPORT_ELEMENT == objectType) {
            TdReport report = (TdReport) modEle;
            EList<AnalysisMap> analysisMap = report.getAnalysisMap();
            if (analysisMap.isEmpty()) {
                return ImageLib.createInvalidIcon(originalImageName);
            }
            for (AnalysisMap anaMap : report.getAnalysisMap()) {
                Analysis analysis = anaMap.getAnalysis();
                if (analysis == null || analysis.getContext() == null) {
                    continue;
                }
                DataManager connection = analysis.getContext().getConnection();
                if (connection instanceof MDMConnection) {
                    return ImageLib.createInvalidIcon(originalImageName);
                }
            }
        }
    }
    return ImageLib.getImage(originalImageName);
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) EList(org.eclipse.emf.common.util.EList) Analysis(org.talend.dataquality.analysis.Analysis) TdReport(org.talend.dataquality.reports.TdReport) AnalysisMap(org.talend.dataquality.reports.AnalysisMap) DataManager(orgomg.cwm.foundation.softwaredeployment.DataManager) AnalysisContext(org.talend.dataquality.analysis.AnalysisContext) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) MDMConnection(org.talend.core.model.metadata.builder.connection.MDMConnection)

Aggregations

AnalysisMap (org.talend.dataquality.reports.AnalysisMap)18 TdReport (org.talend.dataquality.reports.TdReport)8 IPath (org.eclipse.core.runtime.IPath)5 Analysis (org.talend.dataquality.analysis.Analysis)5 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)5 ArrayList (java.util.ArrayList)4 Path (org.eclipse.core.runtime.Path)4 EList (org.eclipse.emf.common.util.EList)3 ReportType (org.talend.dataquality.helpers.ReportHelper.ReportType)3 ReportRepNode (org.talend.dq.nodes.ReportRepNode)3 IRepositoryNode (org.talend.repository.model.IRepositoryNode)3 IFile (org.eclipse.core.resources.IFile)2 Project (org.talend.core.model.general.Project)2 Connection (org.talend.core.model.metadata.builder.connection.Connection)2 Item (org.talend.core.model.properties.Item)2 Property (org.talend.core.model.properties.Property)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 TDQReportItem (org.talend.dataquality.properties.TDQReportItem)2 ReturnCode (org.talend.utils.sugars.ReturnCode)2 File (java.io.File)1