Search in sources :

Example 1 with Analysis

use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.

the class ColumnSetAnalysisResultPage method createSimpleTable2.

private void createSimpleTable2(final ScrolledForm form, final Composite composite, final SimpleStatIndicator simpleStatIndicator) {
    List<IndicatorUnit> units = new ArrayList<IndicatorUnit>();
    units.add(new ColumnSetIndicatorUnit(IndicatorEnum.RowCountIndicatorEnum, masterPage.getSimpleStatIndicator().getRowCountIndicator()));
    units.add(new ColumnSetIndicatorUnit(IndicatorEnum.DistinctCountIndicatorEnum, masterPage.getSimpleStatIndicator().getDistinctCountIndicator()));
    units.add(new ColumnSetIndicatorUnit(IndicatorEnum.DuplicateCountIndicatorEnum, masterPage.getSimpleStatIndicator().getDuplicateCountIndicator()));
    units.add(new ColumnSetIndicatorUnit(IndicatorEnum.UniqueIndicatorEnum, masterPage.getSimpleStatIndicator().getUniqueCountIndicator()));
    EIndicatorChartType simpleStatType = EIndicatorChartType.SIMPLE_STATISTICS;
    // create table firstly
    ITableTypeStates tableTypeState = TableTypeStatesFactory.getInstance().getTableState(simpleStatType, units);
    TableWithData chartData = new TableWithData(simpleStatType, tableTypeState.getDataEntity());
    TableViewer tableviewer = tableTypeState.getTableForm(composite);
    tableviewer.setInput(chartData);
    // MOD qiongli feature 19192.
    DataExplorer dataExplorer = tableTypeState.getDataExplorer();
    Analysis analysis = this.getAnalysisHandler().getAnalysis();
    ChartTableFactory.addMenuAndTip(tableviewer, dataExplorer, analysis);
    // create chart
    if (canShowChartForResultPage()) {
        IChartTypeStates chartTypeState = ChartTypeStatesFactory.getChartState(simpleStatType, units);
        Object chart = chartTypeState.getChart();
        TOPChartUtils.getInstance().decorateChart(chart, false);
        if (chart != null) {
            Object chartComposite2 = TOPChartUtils.getInstance().createChartComposite(composite, SWT.NONE, chart, true);
            addMenuToChartComp(chartComposite2, dataExplorer, analysis, ((ICustomerDataset) chartTypeState.getDataset()).getDataEntities());
        }
    }
}
Also used : ITableTypeStates(org.talend.dataprofiler.core.ui.editor.preview.model.states.table.ITableTypeStates) Analysis(org.talend.dataquality.analysis.Analysis) DataExplorer(org.talend.dq.analysis.explore.DataExplorer) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ColumnSetIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnSetIndicatorUnit) ArrayList(java.util.ArrayList) EIndicatorChartType(org.talend.dq.indicators.preview.EIndicatorChartType) TableWithData(org.talend.dataprofiler.core.ui.editor.preview.model.TableWithData) TableViewer(org.eclipse.jface.viewers.TableViewer) ColumnSetIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnSetIndicatorUnit) IChartTypeStates(org.talend.dataprofiler.core.ui.editor.preview.model.states.IChartTypeStates)

Example 2 with Analysis

use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.

the class CorrelationAnalysisDetailsPage method createPreviewSection.

void createPreviewSection(final ScrolledForm form, Composite parent) {
    previewSection = createSection(form, parent, DefaultMessagesImpl.getString("ColumnMasterDetailsPage.graphics"), // $NON-NLS-1$ //$NON-NLS-2$
    DefaultMessagesImpl.getString("ColumnMasterDetailsPage.space"));
    previewSection.setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite sectionClient = toolkit.createComposite(previewSection);
    sectionClient.setLayout(new GridLayout());
    sectionClient.setLayoutData(new GridData(GridData.FILL_BOTH));
    Button chartButton = new Button(sectionClient, SWT.NONE);
    // $NON-NLS-1$
    chartButton.setText(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.refreshGraphics"));
    final Label message = toolkit.createLabel(sectionClient, // $NON-NLS-1$
    DefaultMessagesImpl.getString("ColumnMasterDetailsPage.spaceWhite"));
    message.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
    message.setVisible(false);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(sectionClient);
    chartComposite = toolkit.createComposite(sectionClient);
    chartComposite.setLayout(new GridLayout());
    chartComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    final Analysis analysis = correlationAnalysisHandler.getAnalysis();
    chartButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            for (Control control : chartComposite.getChildren()) {
                control.dispose();
            }
            boolean analysisStatue = analysis.getResults().getResultMetadata() != null && analysis.getResults().getResultMetadata().getExecutionDate() != null;
            if (!analysisStatue) {
                boolean returnCode = MessageDialog.openConfirm(null, // $NON-NLS-1$
                DefaultMessagesImpl.getString("ColumnMasterDetailsPage.ViewResult"), // $NON-NLS-1$
                DefaultMessagesImpl.getString("ColumnMasterDetailsPage.RunOrSeeSampleData"));
                if (returnCode) {
                    new RunAnalysisAction().run();
                    message.setVisible(false);
                } else {
                    createPreviewCharts(form, chartComposite, false);
                    // $NON-NLS-1$
                    message.setText(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.warning"));
                    message.setVisible(true);
                }
            } else {
                createPreviewCharts(form, chartComposite, true);
            }
            chartComposite.layout();
            form.reflow(true);
        }
    });
    previewSection.setClient(sectionClient);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Control(org.eclipse.swt.widgets.Control) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) HideSeriesChartComposite(org.talend.dataprofiler.core.ui.editor.preview.HideSeriesChartComposite) Button(org.eclipse.swt.widgets.Button) Analysis(org.talend.dataquality.analysis.Analysis) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) RunAnalysisAction(org.talend.dataprofiler.core.ui.action.actions.RunAnalysisAction)

Example 3 with Analysis

use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.

the class DynamicAnalysisMasterPage method createPreviewSection.

void createPreviewSection(final ScrolledForm form1, Composite parent) {
    previewSection = createSection(form1, parent, DefaultMessagesImpl.getString("ColumnMasterDetailsPage.graphics"), // $NON-NLS-1$ //$NON-NLS-2$
    DefaultMessagesImpl.getString("ColumnMasterDetailsPage.space"));
    previewSection.setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite sectionClient = toolkit.createComposite(previewSection);
    sectionClient.setLayout(new GridLayout());
    sectionClient.setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite actionBarComp = toolkit.createComposite(sectionClient);
    GridLayout gdLayout = new GridLayout();
    gdLayout.numColumns = 3;
    actionBarComp.setLayout(gdLayout);
    createCollapseAllLink(actionBarComp);
    createExpandAllLink(actionBarComp);
    Button chartButton = new Button(actionBarComp, SWT.NONE);
    // $NON-NLS-1$
    chartButton.setText(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.refreshGraphics"));
    final Label message = toolkit.createLabel(sectionClient, // $NON-NLS-1$
    DefaultMessagesImpl.getString("ColumnMasterDetailsPage.spaceWhite"));
    message.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
    message.setVisible(false);
    chartButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            disposeChartComposite();
            Analysis analysis = getAnalysisHandler().getAnalysis();
            boolean analysisStatue = analysis.getResults().getResultMetadata() != null && analysis.getResults().getResultMetadata().getExecutionDate() != null;
            if (!analysisStatue) {
                boolean returnCode = MessageDialog.openConfirm(null, // $NON-NLS-1$
                DefaultMessagesImpl.getString("ColumnMasterDetailsPage.ViewResult"), // $NON-NLS-1$
                DefaultMessagesImpl.getString("ColumnMasterDetailsPage.RunOrSeeSampleData"));
                if (returnCode) {
                    new RunAnalysisAction().run();
                    message.setVisible(false);
                } else {
                    createPreviewCharts(form1, chartComposite);
                    // $NON-NLS-1$
                    message.setText(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.warning"));
                    message.setVisible(true);
                }
            } else {
                createPreviewCharts(form1, chartComposite);
            }
            reLayoutChartComposite();
        }
    });
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(sectionClient);
    chartComposite = toolkit.createComposite(sectionClient);
    chartComposite.setLayout(new GridLayout());
    chartComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    previewSection.setClient(sectionClient);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) Button(org.eclipse.swt.widgets.Button) Analysis(org.talend.dataquality.analysis.Analysis) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) RunAnalysisAction(org.talend.dataprofiler.core.ui.action.actions.RunAnalysisAction)

Example 4 with Analysis

use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.

the class FunctionalDependencyAnalysisResultPage method initCustomerDataset.

/**
 * DOC xqliu Comment method "initCustomerDataset".
 *
 * @return
 */
private CustomerDefaultCategoryDataset initCustomerDataset() {
    CustomerDefaultCategoryDataset dataset = new CustomerDefaultCategoryDataset();
    Analysis analysis = this.getAnalysisHandler().getAnalysis();
    for (Indicator indicator2 : analysis.getResults().getIndicators()) {
        ColumnDependencyIndicator indicator = (ColumnDependencyIndicator) indicator2;
        String label = ColumnDependencyHelper.getIndicatorName(indicator);
        if (getAnalysisHandler().getResultMetadata().getExecutionNumber() > 0) {
            Long matchCount = indicator.getDistinctACount() == null ? 0 : indicator.getDistinctACount();
            Long notMatchCount = indicator.getACount() == null ? 0 : indicator.getACount() - matchCount;
            // $NON-NLS-1$
            dataset.addValue(matchCount, DefaultMessagesImpl.getString("ColumnDependencyResultPage.Match"), label);
            // $NON-NLS-1$
            dataset.addValue(notMatchCount, DefaultMessagesImpl.getString("ColumnDependencyResultPage.NotMatch"), label);
            PatternChartDataEntity dataEntity = new PatternChartDataEntity();
            dataEntity.setLabel(label);
            dataEntity.setIndicator(indicator);
            dataEntity.setNumMatch(matchCount.toString());
            dataEntity.setNumNoMatch(notMatchCount.toString());
            dataset.addDataEntity(dataEntity);
        }
    }
    return dataset;
}
Also used : ColumnDependencyIndicator(org.talend.dataquality.indicators.columnset.ColumnDependencyIndicator) PatternChartDataEntity(org.talend.dq.indicators.preview.table.PatternChartDataEntity) Analysis(org.talend.dataquality.analysis.Analysis) CustomerDefaultCategoryDataset(org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset) Indicator(org.talend.dataquality.indicators.Indicator) ColumnDependencyIndicator(org.talend.dataquality.indicators.columnset.ColumnDependencyIndicator)

Example 5 with Analysis

use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.

the class RedundancyAnalysisResultPage method createAnalyzedColumnSetsSection.

private void createAnalyzedColumnSetsSection(Composite parent) {
    columnSetSection = createSection(form, parent, DefaultMessagesImpl.getString("ColumnsComparisonAnalysisResultPage.analyzedColumnSets"), // $NON-NLS-1$
    null);
    Composite sectionClient = toolkit.createComposite(columnSetSection);
    sectionClient.setLayout(new GridLayout());
    sectionClient.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    TableViewer elementsTableViewer = new TableViewer(sectionClient, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    Table table = elementsTableViewer.getTable();
    GridDataFactory.fillDefaults().applyTo(table);
    ((GridData) table.getLayoutData()).heightHint = 240;
    ((GridData) table.getLayoutData()).widthHint = 600;
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    table.setDragDetect(true);
    // $NON-NLS-1$
    table.setToolTipText(DefaultMessagesImpl.getString("ColumnsComparisonAnalysisResultPage.dragAndDropToolTip"));
    final TableColumn columnHeader1 = new TableColumn(table, SWT.LEAD);
    columnHeader1.setWidth(300);
    final TableColumn columnHeader2 = new TableColumn(table, SWT.LEAD);
    columnHeader2.setWidth(300);
    Analysis analysis = this.masterPage.getAnalysisHandler().getAnalysis();
    isHasDeactivatedIndicator = analysis.getParameters().getDeactivatedIndicators().size() != 0;
    EList<Indicator> indicators = analysis.getResults().getIndicators();
    if (indicators.size() != 0) {
        rowMatchingIndicatorA = (RowMatchingIndicator) indicators.get(0);
        rowMatchingIndicatorB = (RowMatchingIndicator) indicators.get(1);
        TdColumn columnA = null;
        if (rowMatchingIndicatorA.getColumnSetA().size() > 0) {
            columnA = rowMatchingIndicatorA.getColumnSetA().get(0);
            if (columnA.eIsProxy()) {
                columnA = (TdColumn) EObjectHelper.resolveObject(columnA);
            }
        }
        String columnName = rowMatchingIndicatorA.getColumnSetA().size() > 0 ? ColumnHelper.getColumnOwnerAsColumnSet(columnA).getName() : PluginConstant.EMPTY_STRING;
        columnHeader1.setText(columnName.equals(PluginConstant.EMPTY_STRING) ? columnName : DefaultMessagesImpl.getString("ColumnsComparisonAnalysisResultPage.elementsFrom", // $NON-NLS-1$
        columnName));
        TdColumn columnB = null;
        if (rowMatchingIndicatorA.getColumnSetB().size() > 0) {
            columnB = rowMatchingIndicatorA.getColumnSetB().get(0);
            if (columnB.eIsProxy()) {
                columnB = (TdColumn) EObjectHelper.resolveObject(columnB);
            }
        }
        columnName = rowMatchingIndicatorA.getColumnSetA().size() > 0 ? ColumnHelper.getColumnOwnerAsColumnSet(columnB).getName() : PluginConstant.EMPTY_STRING;
        columnHeader2.setText(columnName.equals(PluginConstant.EMPTY_STRING) ? columnName : DefaultMessagesImpl.getString("ColumnsComparisonAnalysisResultPage.elementsFrom", // $NON-NLS-1$
        columnName));
    }
    ColumnPairsViewerProvider provider = new ColumnPairsViewerProvider();
    elementsTableViewer.setContentProvider(provider);
    elementsTableViewer.setLabelProvider(provider);
    elementsTableViewer.setInput(rowMatchingIndicatorA);
    columnSetSection.setClient(sectionClient);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Table(org.eclipse.swt.widgets.Table) TdColumn(org.talend.cwm.relational.TdColumn) Composite(org.eclipse.swt.widgets.Composite) Analysis(org.talend.dataquality.analysis.Analysis) GridData(org.eclipse.swt.layout.GridData) TableViewer(org.eclipse.jface.viewers.TableViewer) TableColumn(org.eclipse.swt.widgets.TableColumn) Indicator(org.talend.dataquality.indicators.Indicator) RowMatchingIndicator(org.talend.dataquality.indicators.columnset.RowMatchingIndicator)

Aggregations

Analysis (org.talend.dataquality.analysis.Analysis)137 Test (org.junit.Test)36 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)36 AnalysisContext (org.talend.dataquality.analysis.AnalysisContext)30 ArrayList (java.util.ArrayList)28 Property (org.talend.core.model.properties.Property)28 Indicator (org.talend.dataquality.indicators.Indicator)27 TDQAnalysisItem (org.talend.dataquality.properties.TDQAnalysisItem)27 AnalysisResult (org.talend.dataquality.analysis.AnalysisResult)26 PersistenceException (org.talend.commons.exception.PersistenceException)19 Connection (org.talend.core.model.metadata.builder.connection.Connection)18 ReturnCode (org.talend.utils.sugars.ReturnCode)18 Dependency (orgomg.cwm.objectmodel.core.Dependency)18 TdColumn (org.talend.cwm.relational.TdColumn)16 IndicatorDefinition (org.talend.dataquality.indicators.definition.IndicatorDefinition)16 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)15 Pattern (org.talend.dataquality.domain.pattern.Pattern)15 IFile (org.eclipse.core.resources.IFile)14 File (java.io.File)12 IPath (org.eclipse.core.runtime.IPath)12