Search in sources :

Example 76 with Analysis

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

the class AnalysisEditor method initContext.

/**
 * init the context for the analysis.
 */
private void initContext() {
    Analysis analysis = getMasterPage().getCurrentModelElement();
    contextManager = new JobContextManager(analysis.getContextType(), analysis.getDefaultContext());
    this.setLastRunContextGroupName(AnalysisHelper.getContextGroupName(analysis));
}
Also used : Analysis(org.talend.dataquality.analysis.Analysis) JobContextManager(org.talend.core.model.context.JobContextManager)

Example 77 with Analysis

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

the class FunctionalDependencyAnalysisResultPage method createResultSection.

@Override
protected void createResultSection(Composite parent) {
    resultSection = createSection(form, parent, DefaultMessagesImpl.getString("ColumnsComparisonAnalysisResultPage.analysisResults"), // $NON-NLS-1$ //$NON-NLS-2$
    "");
    Composite sectionClient = toolkit.createComposite(resultSection);
    sectionClient.setLayout(new GridLayout(2, false));
    sectionClient.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    resultSection.setClient(sectionClient);
    Analysis analysis = this.masterPage.getAnalysisHandler().getAnalysis();
    EList<Indicator> indicators = analysis.getResults().getIndicators();
    if (indicators.size() > 0) {
        columnDependencyIndicator = (ColumnDependencyIndicator) indicators.get(0);
    }
    createTable(sectionClient);
    if (canShowChartForResultPage()) {
        createChart(sectionClient, analysis);
    }
    resultSection.layout();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Analysis(org.talend.dataquality.analysis.Analysis) GridData(org.eclipse.swt.layout.GridData) Indicator(org.talend.dataquality.indicators.Indicator) ColumnDependencyIndicator(org.talend.dataquality.indicators.columnset.ColumnDependencyIndicator)

Example 78 with Analysis

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

the class RedundancyAnalysisResultPage method createResultSection.

@Override
protected void createResultSection(Composite parent) {
    resultSection = createSection(form, parent, DefaultMessagesImpl.getString("ColumnsComparisonAnalysisResultPage.analysisResults"), // $NON-NLS-1$ //$NON-NLS-2$
    "");
    Composite sectionClient = toolkit.createComposite(resultSection);
    sectionClient.setLayout(new GridLayout(2, false));
    sectionClient.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    resultSection.setClient(sectionClient);
    if (executeData == null || executeData.equals(PluginConstant.EMPTY_STRING)) {
        return;
    }
    Table resultTable = new Table(sectionClient, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    resultTable.setLinesVisible(true);
    resultTable.setHeaderVisible(true);
    final TableColumn columnHeader0 = new TableColumn(resultTable, SWT.LEAD);
    columnHeader0.setWidth(100);
    final TableColumn columnHeader1 = new TableColumn(resultTable, SWT.LEAD);
    columnHeader1.setWidth(150);
    // add by hcheng for 6503:change the "set A" and "set B" labels
    Analysis analysis = this.masterPage.getAnalysisHandler().getAnalysis();
    EList<Indicator> indicators = analysis.getResults().getIndicators();
    rowMatchingIndicatorA = (RowMatchingIndicator) indicators.get(0);
    rowMatchingIndicatorB = (RowMatchingIndicator) indicators.get(1);
    // MOD yyi 2009-10-27 9100: not save when remove element in comparison analysis
    int sizeA = rowMatchingIndicatorA.getColumnSetA().size();
    int sizeB = rowMatchingIndicatorA.getColumnSetB().size();
    if (sizeA > 0 && sizeB > 0) {
        TdColumn columnA = rowMatchingIndicatorA.getColumnSetA().get(0);
        if (columnA.eIsProxy()) {
            columnA = (TdColumn) EObjectHelper.resolveObject(columnA);
        }
        String tableNameA = ColumnHelper.getColumnOwnerAsColumnSet(columnA).getName();
        TdColumn columnB = rowMatchingIndicatorA.getColumnSetB().get(0);
        if (columnB.eIsProxy()) {
            columnB = (TdColumn) EObjectHelper.resolveObject(columnB);
        }
        String tableNameB = ColumnHelper.getColumnOwnerAsColumnSet(columnB).getName();
        // MOD zshen 11136: the chart of result lose one table
        if (tableNameA.equals(tableNameB)) {
            // $NON-NLS-1$
            tableNameB = tableNameB + "(*)";
        }
        // ~11136
        columnHeader1.setText(tableNameA);
        if (!isHasDeactivatedIndicator) {
            final TableColumn columnHeader2 = new TableColumn(resultTable, SWT.LEAD);
            columnHeader2.setWidth(150);
            columnHeader2.setText(tableNameB);
        }
        createTableItems(resultTable);
        if (canShowChartForResultPage()) {
            creatChart(sectionClient, tableNameA, tableNameB);
        }
        StringBuilder description = new StringBuilder();
        description.append(DefaultMessagesImpl.getString("ColumnsComparisonAnalysisResultPage.ASetFoundInB", setAMatchPercent, tableNameA, // $NON-NLS-1$
        tableNameB));
        if (!isHasDeactivatedIndicator) {
            // $NON-NLS-1$
            description.append("\n");
            description.append(DefaultMessagesImpl.getString("ColumnsComparisonAnalysisResultPage.BSetFoundInA", setBMatchPercent, tableNameB, // $NON-NLS-1$
            tableNameA));
        }
        resultSection.setDescription(description.toString());
    }
    resultSection.layout();
}
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) TableColumn(org.eclipse.swt.widgets.TableColumn) Indicator(org.talend.dataquality.indicators.Indicator) RowMatchingIndicator(org.talend.dataquality.indicators.columnset.RowMatchingIndicator)

Example 79 with Analysis

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

the class UnitTestBuildHelper method createAndInitAnalysis.

public static Analysis createAndInitAnalysis() {
    Analysis ana = UnitTestBuildHelper.createRealAnalysis("anaA", null, false);
    AnalysisParameters parameters = AnalysisFactory.eINSTANCE.createAnalysisParameters();
    parameters.setExecutionLanguage(ExecutionLanguage.SQL);
    ana.setParameters(parameters);
    AnalysisContext context = AnalysisFactory.eINSTANCE.createAnalysisContext();
    ana.setContext(context);
    Connection createConnection = ConnectionFactory.eINSTANCE.createConnection();
    createConnection.setName("MySQL");
    context.setConnection(createConnection);
    return ana;
}
Also used : Analysis(org.talend.dataquality.analysis.Analysis) AnalysisParameters(org.talend.dataquality.analysis.AnalysisParameters) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) DelimitedFileConnection(org.talend.core.model.metadata.builder.connection.DelimitedFileConnection) Connection(org.talend.core.model.metadata.builder.connection.Connection) AnalysisContext(org.talend.dataquality.analysis.AnalysisContext)

Example 80 with Analysis

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

the class UnitTestBuildHelper method createRealAnalysis.

/**
 * DOC qiongli Comment method "createRealAnalysis".
 *
 * @param name
 * @param folder
 * @param isDelete
 * @return
 */
public static Analysis createRealAnalysis(String name, IFolder folder, Boolean isDelete) {
    IPath createPath = Path.EMPTY;
    if (folder != null) {
        createPath = new Path(folder.getFullPath().lastSegment());
    }
    Analysis analysis1 = AnalysisHelper.createAnalysis(name);
    TDQAnalysisItem item1 = PropertiesFactoryImpl.eINSTANCE.createTDQAnalysisItem();
    org.talend.core.model.properties.Property property1 = PropertiesFactory.eINSTANCE.createProperty();
    property1.setId(EcoreUtil.generateUUID());
    property1.setItem(item1);
    property1.setLabel(analysis1.getName());
    item1.setProperty(property1);
    item1.setAnalysis(analysis1);
    ItemState itemState = org.talend.core.model.properties.PropertiesFactory.eINSTANCE.createItemState();
    itemState.setDeleted(isDelete);
    item1.setState(itemState);
    AnalysisResult analysisResult1 = AnalysisFactory.eINSTANCE.createAnalysisResult();
    analysis1.setResults(analysisResult1);
    try {
        ProxyRepositoryFactory.getInstance().create(item1, createPath, false);
    } catch (PersistenceException e) {
        Assert.fail(e.getMessage());
    }
    return analysis1;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) Analysis(org.talend.dataquality.analysis.Analysis) ItemState(org.talend.core.model.properties.ItemState) PersistenceException(org.talend.commons.exception.PersistenceException) Property(org.talend.core.model.properties.Property) AnalysisResult(org.talend.dataquality.analysis.AnalysisResult) TDQAnalysisItem(org.talend.dataquality.properties.TDQAnalysisItem)

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