Search in sources :

Example 56 with ModelElementIndicator

use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.

the class ColumnWizard method openEditor.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.dataprofiler.core.ui.wizard.analysis.AbstractAnalysisWizard#openEditor(org.talend.repository.model.IRepositoryNode
     * )
     */
@Override
public void openEditor(IRepositoryNode repNode) {
    super.openEditor(repNode);
    if (this.selectionPage != null) {
        AnalysisEditor editor = (AnalysisEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
        if (editor != null) {
            AbstractAnalysisMetadataPage masterPage = editor.getMasterPage();
            List<IRepositoryNode> nodes = this.selectionPage.nodes;
            if (nodes != null && nodes.size() > 0) {
                // MOD msjian TDQ-6665 2013-1-7: after the wizard, make the editor is saved status
                if (masterPage instanceof ColumnAnalysisDetailsPage) {
                    ((ColumnAnalysisDetailsPage) masterPage).setTreeViewInput(nodes.toArray(new RepositoryNode[nodes.size()]));
                    ModelElementIndicator[] predefinedColumnIndicator = this.getPredefinedColumnIndicator();
                    if (predefinedColumnIndicator != null) {
                        ((ColumnAnalysisDetailsPage) masterPage).refreshPreviewTable(predefinedColumnIndicator, false);
                        ((ColumnAnalysisDetailsPage) masterPage).refreshTheTree(predefinedColumnIndicator);
                    }
                    // TDQ-12349: when the database can not support PatternFrequency, set to java engine automatically
                    if (this instanceof PatternFrequencyWizard && !RepNodeUtils.isSupportPatternFrequency(nodes)) {
                        masterPage.changeExecuteLanguageToJava(true);
                    }
                // TDQ-12349~
                } else if (masterPage instanceof ColumnSetAnalysisDetailsPage) {
                    ((ColumnSetAnalysisDetailsPage) masterPage).setTreeViewInput(nodes.toArray(new RepositoryNode[nodes.size()]));
                } else {
                    masterPage.getTreeViewer().setInput(nodes.toArray(new RepositoryNode[nodes.size()]));
                }
                masterPage.doSave(new NullProgressMonitor());
            // TDQ-6665~
            }
        }
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ColumnSetAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.ColumnSetAnalysisDetailsPage) AbstractAnalysisMetadataPage(org.talend.dataprofiler.core.ui.editor.analysis.AbstractAnalysisMetadataPage) AnalysisEditor(org.talend.dataprofiler.core.ui.editor.analysis.AnalysisEditor) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ColumnAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.ColumnAnalysisDetailsPage) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 57 with ModelElementIndicator

use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.

the class ColumnWizard method composePredefinedColumnIndicator.

protected ModelElementIndicator[] composePredefinedColumnIndicator(IndicatorEnum[] allowedEnum) {
    List<IRepositoryNode> nodes;
    // from the right menu
    if (selectionPage == null) {
        nodes = Arrays.asList(((AnalysisLabelParameter) parameter).getColumnNodes());
    } else {
        // TDQ-11240: get all the column nodes
        nodes = Arrays.asList(RepositoryNodeHelper.getAllColumnNodes(selectionPage.nodes.toArray(new IRepositoryNode[selectionPage.nodes.size()])));
    }
    ModelElementIndicator[] predefinedColumnIndicator = new ModelElementIndicator[nodes.size()];
    for (int i = 0; i < nodes.size(); i++) {
        IRepositoryNode columnNode = nodes.get(i);
        ModelElementIndicator columnIndicator = ModelElementIndicatorHelper.createModelElementIndicator(columnNode);
        for (IndicatorEnum oneEnum : allowedEnum) {
            columnIndicator.addTempIndicatorEnum(oneEnum);
            if (oneEnum.getChildren() != null) {
                for (IndicatorEnum childEnum : oneEnum.getChildren()) {
                    // MOD by zshen:need language to decide DatePatternFrequencyIndicator whether can be choose by
                    // user.
                    IRepositoryViewObject object = columnNode.getObject();
                    ModelElement element = null;
                    if (object instanceof MetadataColumnRepositoryObject) {
                        element = ((MetadataColumnRepositoryObject) object).getTdColumn();
                    } else if (object instanceof MetadataXmlElementTypeRepositoryObject) {
                        element = ((MetadataXmlElementTypeRepositoryObject) object).getModelElement();
                    }
                    if (element != null && ModelElementIndicatorRule.patternRule(childEnum, element, ExecutionLanguage.SQL)) {
                        columnIndicator.addTempIndicatorEnum(childEnum);
                    }
                }
            }
        }
        columnIndicator.storeTempIndicator();
        predefinedColumnIndicator[i] = columnIndicator;
    }
    return predefinedColumnIndicator;
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) IRepositoryNode(org.talend.repository.model.IRepositoryNode) IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) MetadataXmlElementTypeRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataXmlElementTypeRepositoryObject) AnalysisLabelParameter(org.talend.dq.analysis.parameters.AnalysisLabelParameter) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 58 with ModelElementIndicator

use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.

the class CreateDateAnalysisAction method getPredefinedColumnIndicator.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataprofiler.core.ui.action.AbstractPredefinedAnalysisAction#getPredefinedColumnIndicator()
     */
@Override
protected ModelElementIndicator[] getPredefinedColumnIndicator() {
    int count = 5;
    if (isTimeType()) {
        count = 3;
    }
    IndicatorEnum[] allwedEnumes = new IndicatorEnum[count];
    allwedEnumes[0] = IndicatorEnum.CountsIndicatorEnum;
    allwedEnumes[1] = IndicatorEnum.MinValueIndicatorEnum;
    allwedEnumes[2] = IndicatorEnum.MaxValueIndicatorEnum;
    if (count == 5) {
        allwedEnumes[3] = IndicatorEnum.LowFrequencyIndicatorEnum;
        allwedEnumes[4] = IndicatorEnum.FrequencyIndicatorEnum;
    }
    ModelElementIndicator[] returnColumnIndicator = composePredefinedColumnIndicator(allwedEnumes);
    if (parameters != null) {
        for (ModelElementIndicator columnIndicator : returnColumnIndicator) {
            for (Indicator indicator : columnIndicator.getIndicators()) {
                if (indicator instanceof FrequencyIndicator) {
                    if (indicator.getParameters().getDateParameters() != null) {
                        // TODO If we will never use the
                        // "parameters" parameter, why we
                        // add TimeSliceOptionPage and have
                        // this loop
                        indicator.getParameters().getDateParameters().setDateAggregationType(parameters.getDateParameters().getDateAggregationType());
                    }
                }
            }
        }
    }
    return returnColumnIndicator;
}
Also used : IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) FrequencyIndicator(org.talend.dataquality.indicators.FrequencyIndicator) Indicator(org.talend.dataquality.indicators.Indicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) FrequencyIndicator(org.talend.dataquality.indicators.FrequencyIndicator)

Aggregations

ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)58 IRepositoryNode (org.talend.repository.model.IRepositoryNode)22 ArrayList (java.util.ArrayList)16 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)16 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)16 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)15 Indicator (org.talend.dataquality.indicators.Indicator)13 IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)12 TreeItem (org.eclipse.swt.widgets.TreeItem)11 RepositoryNode (org.talend.repository.model.RepositoryNode)10 IndicatorEnum (org.talend.dq.nodes.indicator.type.IndicatorEnum)9 MetadataXmlElementTypeRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataXmlElementTypeRepositoryObject)7 Connection (org.talend.core.model.metadata.builder.connection.Connection)6 CompositeIndicator (org.talend.dataquality.indicators.CompositeIndicator)6 MetadataTableRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject)5 TreeEditor (org.eclipse.swt.custom.TreeEditor)4 MouseAdapter (org.eclipse.swt.events.MouseAdapter)4 MouseEvent (org.eclipse.swt.events.MouseEvent)4 Composite (org.eclipse.swt.widgets.Composite)4 Label (org.eclipse.swt.widgets.Label)4