Search in sources :

Example 31 with TDQAnalysisItem

use of org.talend.dataquality.properties.TDQAnalysisItem in project tdq-studio-se by Talend.

the class RunAnalysisAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.ui.cheatsheets.ICheatSheetAction#run(java.lang.String[], org.eclipse.ui.cheatsheets.ICheatSheetManager)
     */
public void run(String[] params, ICheatSheetManager manager) {
    // ADD mzhao 2009-02-03 If there is no active editor opened, run
    // analysis action from cheat sheets will do nothing.
    IEditorPart activateEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    if (activateEditor == null || !(activateEditor instanceof AnalysisEditor)) {
        return;
    }
    // MOD TDQ-8117 20131008 yyin: find the analysis item from the editor
    IEditorInput editorInput = activateEditor.getEditorInput();
    if (editorInput instanceof AnalysisItemEditorInput) {
        setAnalysisItems(new TDQAnalysisItem[] { ((TDQAnalysisItem) ((AnalysisItemEditorInput) editorInput).getItem()) });
    }
    AbstractAnalysisMetadataPage masterPage = ((AnalysisEditor) activateEditor).getMasterPage();
    listener = masterPage;
    // ~
    run();
}
Also used : AbstractAnalysisMetadataPage(org.talend.dataprofiler.core.ui.editor.analysis.AbstractAnalysisMetadataPage) IEditorPart(org.eclipse.ui.IEditorPart) AnalysisItemEditorInput(org.talend.dataprofiler.core.ui.editor.analysis.AnalysisItemEditorInput) AnalysisEditor(org.talend.dataprofiler.core.ui.editor.analysis.AnalysisEditor) IEditorInput(org.eclipse.ui.IEditorInput) TDQAnalysisItem(org.talend.dataquality.properties.TDQAnalysisItem)

Example 32 with TDQAnalysisItem

use of org.talend.dataquality.properties.TDQAnalysisItem in project tdq-studio-se by Talend.

the class TDQResourceChangeHandler method create.

@Override
public Resource create(IProject project, Item item, int classID, IPath path) {
    String fileExtension = FileConstants.ITEM_EXTENSION;
    Resource itemResource = null;
    try {
        switch(classID) {
            case org.talend.dataquality.properties.PropertiesPackage.TDQ_ANALYSIS_ITEM:
                fileExtension = FileConstants.ANA_EXTENSION;
                itemResource = xmiResourceManager.createItemResourceWithExtension(project, item, path, ERepositoryObjectType.TDQ_ANALYSIS_ELEMENT, false, fileExtension);
                AnalysisWriter createAnalysisWrite = org.talend.dq.writer.impl.ElementWriterFactory.getInstance().createAnalysisWrite();
                Analysis analysis = ((TDQAnalysisItem) item).getAnalysis();
                createAnalysisWrite.addResourceContent(itemResource, analysis);
                createAnalysisWrite.addDependencies(analysis);
                break;
            case org.talend.dataquality.properties.PropertiesPackage.TDQ_REPORT_ITEM:
                fileExtension = FileConstants.REP_EXTENSION;
                itemResource = xmiResourceManager.createItemResourceWithExtension(project, item, path, ERepositoryObjectType.TDQ_REPORT_ELEMENT, false, fileExtension);
                ReportWriter createReportWriter = org.talend.dq.writer.impl.ElementWriterFactory.getInstance().createReportWriter();
                Report report = ((TDQReportItem) item).getReport();
                createReportWriter.addResourceContent(itemResource, report);
                createReportWriter.addDependencies(report);
                break;
            case org.talend.dataquality.properties.PropertiesPackage.TDQ_INDICATOR_DEFINITION_ITEM:
                fileExtension = FileConstants.DEF_EXTENSION;
                itemResource = xmiResourceManager.createItemResourceWithExtension(project, item, path, ERepositoryObjectType.TDQ_INDICATOR_ELEMENT, false, fileExtension);
                IndicatorDefinition indicatorDefinition = ((TDQIndicatorDefinitionItem) item).getIndicatorDefinition();
                IndicatorDefinitionWriter createIndicatorDefinitionWriter = org.talend.dq.writer.impl.ElementWriterFactory.getInstance().createIndicatorDefinitionWriter();
                createIndicatorDefinitionWriter.addResourceContent(itemResource, indicatorDefinition);
                break;
            case org.talend.dataquality.properties.PropertiesPackage.TDQ_PATTERN_ITEM:
                fileExtension = FileConstants.PAT_EXTENSION;
                itemResource = xmiResourceManager.createItemResourceWithExtension(project, item, path, ERepositoryObjectType.TDQ_PATTERN_ELEMENT, false, fileExtension);
                Pattern pattern = ((TDQPatternItem) item).getPattern();
                PatternWriter createPatternWriter = org.talend.dq.writer.impl.ElementWriterFactory.getInstance().createPatternWriter();
                createPatternWriter.addResourceContent(itemResource, pattern);
                break;
            case org.talend.dataquality.properties.PropertiesPackage.TDQ_BUSINESS_RULE_ITEM:
                fileExtension = FileConstants.RULE_EXTENSION;
                // MOD gdbu 2011-6-10 bug : 21823 2011-06-27 revert the error type code by klliu
                DQRule dqrule = ((TDQBusinessRuleItem) item).getDqrule();
                if (dqrule instanceof WhereRule) {
                    itemResource = xmiResourceManager.createItemResourceWithExtension(project, item, path, ERepositoryObjectType.TDQ_RULES_SQL, false, fileExtension);
                } else {
                    itemResource = xmiResourceManager.createItemResourceWithExtension(project, item, path, ERepositoryObjectType.TDQ_RULES_PARSER, false, fileExtension);
                }
                // ~21823
                DQRuleWriter createdRuleWriter = org.talend.dq.writer.impl.ElementWriterFactory.getInstance().createdRuleWriter();
                createdRuleWriter.addResourceContent(itemResource, dqrule);
                break;
            case org.talend.dataquality.properties.PropertiesPackage.TDQ_JRXML_ITEM:
                fileExtension = FileConstants.JRXML_EXTENSION;
                itemResource = xmiResourceManager.createItemResourceWithExtension(project, item, path, ERepositoryObjectType.TDQ_JRAXML_ELEMENT, true, fileExtension);
                itemResource.getContents().add(((TDQFileItem) item).getContent());
                break;
            case org.talend.dataquality.properties.PropertiesPackage.TDQ_SOURCE_FILE_ITEM:
                fileExtension = FileConstants.SQL_EXTENSION;
                itemResource = xmiResourceManager.createItemResourceWithExtension(project, item, path, ERepositoryObjectType.TDQ_SOURCE_FILE_ELEMENT, true, fileExtension);
                itemResource.getContents().add(((TDQFileItem) item).getContent());
                break;
            case org.talend.dataquality.properties.PropertiesPackage.TDQ_MATCH_RULE_ITEM:
                fileExtension = FileConstants.RULE_EXTENSION;
                itemResource = xmiResourceManager.createItemResourceWithExtension(project, item, path, ERepositoryObjectType.TDQ_RULES_MATCHER, false, fileExtension);
                MatchRuleDefinition matchRuleDefinition = ((TDQMatchRuleItem) item).getMatchRule();
                MatchRuleDefinitionWriter matchRuleDefinitionWriter = org.talend.dq.writer.impl.ElementWriterFactory.getInstance().createdMatchRuleWriter();
                matchRuleDefinitionWriter.addResourceContent(itemResource, matchRuleDefinition);
                break;
            default:
        }
    } catch (PersistenceException e) {
        log.error(e, e);
    }
    return itemResource;
}
Also used : Pattern(org.talend.dataquality.domain.pattern.Pattern) TDQIndicatorDefinitionItem(org.talend.dataquality.properties.TDQIndicatorDefinitionItem) Report(orgomg.cwmx.analysis.informationreporting.Report) TDQMatchRuleItem(org.talend.dataquality.properties.TDQMatchRuleItem) DQRuleWriter(org.talend.dq.writer.impl.DQRuleWriter) Resource(org.eclipse.emf.ecore.resource.Resource) IResource(org.eclipse.core.resources.IResource) PatternWriter(org.talend.dq.writer.impl.PatternWriter) MatchRuleDefinition(org.talend.dataquality.rules.MatchRuleDefinition) TDQPatternItem(org.talend.dataquality.properties.TDQPatternItem) IndicatorDefinition(org.talend.dataquality.indicators.definition.IndicatorDefinition) DQRule(org.talend.dataquality.rules.DQRule) ReportWriter(org.talend.dq.writer.impl.ReportWriter) WhereRule(org.talend.dataquality.rules.WhereRule) Analysis(org.talend.dataquality.analysis.Analysis) IndicatorDefinitionWriter(org.talend.dq.writer.impl.IndicatorDefinitionWriter) PersistenceException(org.talend.commons.exception.PersistenceException) TDQBusinessRuleItem(org.talend.dataquality.properties.TDQBusinessRuleItem) MatchRuleDefinitionWriter(org.talend.dq.writer.impl.MatchRuleDefinitionWriter) AnalysisWriter(org.talend.dq.writer.impl.AnalysisWriter) TDQReportItem(org.talend.dataquality.properties.TDQReportItem) TDQAnalysisItem(org.talend.dataquality.properties.TDQAnalysisItem)

Example 33 with TDQAnalysisItem

use of org.talend.dataquality.properties.TDQAnalysisItem in project tdq-studio-se by Talend.

the class AnalysisSubFolderRepNode method getChildren.

/*
     * (non-Jsdoc)
     * 
     * @see org.talend.dq.nodes.AnalysisFolderRepNode#getChildren()
     */
@Override
public List<IRepositoryNode> getChildren() {
    IRepositoryViewObject anaViewObject = this.getObject();
    anaElement = new ArrayList<IRepositoryNode>();
    if (anaViewObject == null) {
        anaViewObject = this.getParent().getObject();
        TDQAnalysisItem item = (TDQAnalysisItem) anaViewObject.getProperty().getItem();
        Analysis analysis = item.getAnalysis();
        AnalysisContext context = analysis.getContext();
        EList<ModelElement> analysedElements = context.getAnalysedElements();
        // EList<Indicator> indicators = results.getIndicators();
        for (ModelElement analyzedElement : analysedElements) {
            // ModelElement analyzedElement = indicator.getAnalyzedElement();
            IRepositoryNode elementNode = doSwichNode(analyzedElement, this);
            if (null == elementNode) {
                // just when filtering 'elementNode' could be null
                continue;
            }
            if (elementNode instanceof DBConnectionRepNode) {
                List<IRepositoryNode> children = elementNode.getChildren();
                anaElement.addAll(children);
            } else {
                anaElement.add(elementNode);
            }
        }
        // MOD gdbu 2011-7-1 bug : 22204
        return filterResultsIfAny(anaElement);
    }
    return filterResultsIfAny(super.getChildren());
// ~22204
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) IRepositoryNode(org.talend.repository.model.IRepositoryNode) Analysis(org.talend.dataquality.analysis.Analysis) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) AnalysisContext(org.talend.dataquality.analysis.AnalysisContext) TDQAnalysisItem(org.talend.dataquality.properties.TDQAnalysisItem)

Aggregations

TDQAnalysisItem (org.talend.dataquality.properties.TDQAnalysisItem)33 Analysis (org.talend.dataquality.analysis.Analysis)26 PersistenceException (org.talend.commons.exception.PersistenceException)17 Property (org.talend.core.model.properties.Property)14 AnalysisResult (org.talend.dataquality.analysis.AnalysisResult)14 Item (org.talend.core.model.properties.Item)11 ItemState (org.talend.core.model.properties.ItemState)11 Path (org.eclipse.core.runtime.Path)9 Test (org.junit.Test)9 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)9 TDQIndicatorDefinitionItem (org.talend.dataquality.properties.TDQIndicatorDefinitionItem)9 TDQReportItem (org.talend.dataquality.properties.TDQReportItem)9 IPath (org.eclipse.core.runtime.IPath)7 IndicatorDefinition (org.talend.dataquality.indicators.definition.IndicatorDefinition)7 TDQPatternItem (org.talend.dataquality.properties.TDQPatternItem)7 AnalysisContext (org.talend.dataquality.analysis.AnalysisContext)6 ReturnCode (org.talend.utils.sugars.ReturnCode)6 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)6 TDQBusinessRuleItem (org.talend.dataquality.properties.TDQBusinessRuleItem)5 TdReport (org.talend.dataquality.reports.TdReport)5