Search in sources :

Example 16 with NamedColumnSet

use of orgomg.cwm.resource.relational.NamedColumnSet in project tdq-studio-se by Talend.

the class AnalysisTableTreeViewer method canDrop.

@Override
public boolean canDrop(NamedColumnSet set) {
    Connection tdProvider = ConnectionHelper.getTdDataProvider(TableHelper.getParentCatalogOrSchema(set));
    if (tdProvider == null) {
        return false;
    } else if (this.getAnalysis().getContext().getConnection() != null && !tdProvider.equals(this.getAnalysis().getContext().getConnection())) {
        return false;
    }
    List<NamedColumnSet> existSets = new ArrayList<NamedColumnSet>();
    for (TableIndicator tableIndicator : getTableIndicator()) {
        existSets.add(tableIndicator.getColumnSet());
    }
    if (existSets.contains(set)) {
        return false;
    }
    return true;
}
Also used : TableIndicator(org.talend.dataprofiler.core.model.TableIndicator) Connection(org.talend.core.model.metadata.builder.connection.Connection) ArrayList(java.util.ArrayList) NamedColumnSet(orgomg.cwm.resource.relational.NamedColumnSet)

Example 17 with NamedColumnSet

use of orgomg.cwm.resource.relational.NamedColumnSet in project tdq-studio-se by Talend.

the class AnalysisTableTreeViewer method dropTables.

@Override
public void dropTables(List<NamedColumnSet> sets, int index) {
    int size = sets.size();
    TableIndicator[] tIndicators = new TableIndicator[size];
    for (int i = 0; i < size; i++) {
        NamedColumnSet set = sets.get(i);
        TableIndicator tableIndicator = TableIndicator.createTableIndicatorWithRowCountIndicator(set);
        tIndicators[i] = tableIndicator;
    }
    this.addElements(tIndicators);
}
Also used : TableIndicator(org.talend.dataprofiler.core.model.TableIndicator) NamedColumnSet(orgomg.cwm.resource.relational.NamedColumnSet)

Example 18 with NamedColumnSet

use of orgomg.cwm.resource.relational.NamedColumnSet in project tdq-studio-se by Talend.

the class AnalysisTableTreeViewer method isExpressionNull.

private String isExpressionNull(TreeItem item) {
    String expressContent = null;
    TableIndicatorUnit indicatorUnit = (TableIndicatorUnit) item.getData(INDICATOR_UNIT_KEY);
    TableIndicator tableIndicator = (TableIndicator) item.getData(TABLE_INDICATOR_KEY);
    NamedColumnSet set = tableIndicator.getColumnSet();
    Connection dataprovider = ConnectionHelper.getTdDataProvider(ColumnSetHelper.getParentCatalogOrSchema(set));
    DbmsLanguage dbmsLang = DbmsLanguageFactory.createDbmsLanguage(dataprovider);
    Expression expression = dbmsLang.getInstantiatedExpression(indicatorUnit.getIndicator());
    if (expression != null) {
        expressContent = expression.getBody();
    }
    return expressContent;
}
Also used : DbmsLanguage(org.talend.dq.dbms.DbmsLanguage) TableIndicator(org.talend.dataprofiler.core.model.TableIndicator) Expression(orgomg.cwm.objectmodel.core.Expression) Connection(org.talend.core.model.metadata.builder.connection.Connection) TableIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit) NamedColumnSet(orgomg.cwm.resource.relational.NamedColumnSet)

Example 19 with NamedColumnSet

use of orgomg.cwm.resource.relational.NamedColumnSet in project tdq-studio-se by Talend.

the class AbstractPredefinedTableAnalysisAction method composePredefinedTableIndicator.

protected TableIndicator[] composePredefinedTableIndicator(IndicatorEnum[] allowedEnum) {
    NamedColumnSet[] tablesAndViews = getTablesAndViews();
    TableIndicator[] predefinedTableIndicator = new TableIndicator[tablesAndViews.length];
    for (int i = 0; i < tablesAndViews.length; i++) {
        NamedColumnSet tableOrView = tablesAndViews[i];
        TableIndicator tableIndicator = new TableIndicator(tableOrView);
        predefinedTableIndicator[i] = tableIndicator;
    }
    return predefinedTableIndicator;
}
Also used : TableIndicator(org.talend.dataprofiler.core.model.TableIndicator) NamedColumnSet(orgomg.cwm.resource.relational.NamedColumnSet)

Example 20 with NamedColumnSet

use of orgomg.cwm.resource.relational.NamedColumnSet in project tdq-studio-se by Talend.

the class TableAnalysisWizard method initCWMResourceBuilder.

@Override
public ModelElement initCWMResourceBuilder() {
    Analysis analysis = (Analysis) super.initCWMResourceBuilder();
    NamedColumnSet[] ncss = getNamedColumnSet();
    Connection tdp = getTdDataProvider();
    if (ncss != null && getAnalysisBuilder() != null) {
        List<Indicator> indicatorList = new ArrayList<Indicator>();
        WhereRule[] whereRules = getWhereRules(dqruleSelectPage.getCViewer().getCheckedElements());
        for (NamedColumnSet ncs : ncss) {
            // add RowCountIndicator
            RowCountIndicator rowCountIndicator = IndicatorsFactory.eINSTANCE.createRowCountIndicator();
            DefinitionHandler.getInstance().setDefaultIndicatorDefinition(rowCountIndicator);
            rowCountIndicator.setAnalyzedElement(ncs);
            indicatorList.add(rowCountIndicator);
            // add user selected WhereRuleIndicator
            if (whereRules != null) {
                for (WhereRule whereRule : whereRules) {
                    WhereRuleIndicator[] compositeWhereRuleIndicator = DQRuleUtilities.createCompositeWhereRuleIndicator(ncs, whereRule);
                    indicatorList.addAll(Arrays.asList(compositeWhereRuleIndicator));
                }
            }
        }
        getAnalysisBuilder().addElementsToAnalyze(ncss, indicatorList.toArray(new Indicator[indicatorList.size()]));
        getAnalysisBuilder().setAnalysisConnection(tdp);
    }
    return analysis;
}
Also used : WhereRule(org.talend.dataquality.rules.WhereRule) WhereRuleIndicator(org.talend.dataquality.indicators.sql.WhereRuleIndicator) Analysis(org.talend.dataquality.analysis.Analysis) Connection(org.talend.core.model.metadata.builder.connection.Connection) ArrayList(java.util.ArrayList) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) NamedColumnSet(orgomg.cwm.resource.relational.NamedColumnSet) Indicator(org.talend.dataquality.indicators.Indicator) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) WhereRuleIndicator(org.talend.dataquality.indicators.sql.WhereRuleIndicator)

Aggregations

NamedColumnSet (orgomg.cwm.resource.relational.NamedColumnSet)20 ArrayList (java.util.ArrayList)12 TableIndicator (org.talend.dataprofiler.core.model.TableIndicator)8 Connection (org.talend.core.model.metadata.builder.connection.Connection)5 Indicator (org.talend.dataquality.indicators.Indicator)5 DBTableRepNode (org.talend.dq.nodes.DBTableRepNode)4 List (java.util.List)3 TdTable (org.talend.cwm.relational.TdTable)3 CompositeIndicator (org.talend.dataprofiler.core.ui.editor.preview.CompositeIndicator)3 TableIndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit)3 WhereRule (org.talend.dataquality.rules.WhereRule)3 DBViewRepNode (org.talend.dq.nodes.DBViewRepNode)3 Expression (orgomg.cwm.objectmodel.core.Expression)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Map (java.util.Map)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)2 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2