Search in sources :

Example 11 with SchemaIndicator

use of org.talend.dataquality.indicators.schema.SchemaIndicator in project tdq-studio-se by Talend.

the class AnalysisFilterWizard method addSchemaIndicator.

protected void addSchemaIndicator(List<Schema> tdSchemas, CatalogIndicator catalogIndicator) {
    for (Schema schema : tdSchemas) {
        SchemaIndicator createSchemaIndicator = SchemaFactory.eINSTANCE.createSchemaIndicator();
        // MOD xqliu 2009-1-21 feature 4715
        DefinitionHandler.getInstance().setDefaultIndicatorDefinition(createSchemaIndicator);
        createSchemaIndicator.setAnalyzedElement(schema);
        catalogIndicator.addSchemaIndicator(createSchemaIndicator);
    }
}
Also used : SchemaIndicator(org.talend.dataquality.indicators.schema.SchemaIndicator) Schema(orgomg.cwm.resource.relational.Schema)

Example 12 with SchemaIndicator

use of org.talend.dataquality.indicators.schema.SchemaIndicator in project tdq-studio-se by Talend.

the class SchemaEvaluator method executeSqlQuery.

@Override
protected ReturnCode executeSqlQuery(String sqlStatement) throws SQLException {
    ReturnCode ok = new ReturnCode(true);
    // --- preconditions
    DataProvider dataProvider = this.getDataManager();
    if (this.elementToIndicators.values().isEmpty()) {
        // $NON-NLS-1$
        String msg = Messages.getString("Evaluator.NoInidcator1");
        log.error(msg);
        ok.setReturnCode(msg, false);
        return ok;
    }
    Indicator[] indics = this.getAllIndicators();
    if (indics.length == 0) {
        // $NON-NLS-1$
        String msg = Messages.getString("Evaluator.NoInidcator2", dataProvider);
        log.error(msg);
        ok.setReturnCode(msg, false);
        return ok;
    }
    for (Indicator indicator : indics) {
        SchemaIndicator schemaIndicator = DataqualitySwitchHelper.SCHEMA_SWITCH.doSwitch(indicator);
        if (schemaIndicator == null) {
            continue;
        }
        Schema schema = (Schema) schemaIndicator.getAnalyzedElement();
        String catName = schema.getName();
        // MOD yyi 2009-11-30 10187
        if (!checkSchema(schema)) {
            // $NON-NLS-1$
            ok.setReturnCode(Messages.getString("Evaluator.schemaNotExist", catName), false);
            return ok;
        }
        // ~
        // ADD xqliu 2010-01-06 bug 10919
        EObject container = schema.eContainer();
        if (container != null) {
            Catalog catalog = SwitchHelpers.CATALOG_SWITCH.doSwitch(container);
            if (catalog != null) {
                catName = catalog.getName();
                // MOD gdbu 2011-4-21 bug : 20578
                if (!ConnectionUtils.isOdbcProgress(connection) && !ConnectionUtils.isOdbcOracle(connection) && StringUtils.isNotEmpty(catName) && dbms().supportCatalogSelection()) {
                    connection.setCatalog(catName);
                }
            // ~20578
            }
        }
        // ~
        evalSchemaIndicLow(null, schemaIndicator, null, schema, ok);
    }
    return ok;
}
Also used : DataProvider(orgomg.cwm.foundation.softwaredeployment.DataProvider) SchemaIndicator(org.talend.dataquality.indicators.schema.SchemaIndicator) ReturnCode(org.talend.utils.sugars.ReturnCode) Schema(orgomg.cwm.resource.relational.Schema) EObject(org.eclipse.emf.ecore.EObject) SchemaIndicator(org.talend.dataquality.indicators.schema.SchemaIndicator) Indicator(org.talend.dataquality.indicators.Indicator) Catalog(orgomg.cwm.resource.relational.Catalog)

Aggregations

SchemaIndicator (org.talend.dataquality.indicators.schema.SchemaIndicator)12 Indicator (org.talend.dataquality.indicators.Indicator)6 CatalogIndicator (org.talend.dataquality.indicators.schema.CatalogIndicator)6 Schema (orgomg.cwm.resource.relational.Schema)6 ConnectionIndicator (org.talend.dataquality.indicators.schema.ConnectionIndicator)4 Catalog (orgomg.cwm.resource.relational.Catalog)4 ArrayList (java.util.ArrayList)3 Connection (org.talend.core.model.metadata.builder.connection.Connection)3 OverviewIndUIElement (org.talend.dataprofiler.core.model.OverviewIndUIElement)3 IRepositoryNode (org.talend.repository.model.IRepositoryNode)3 ReturnCode (org.talend.utils.sugars.ReturnCode)3 RepositoryNode (org.talend.repository.model.RepositoryNode)2 DataProvider (orgomg.cwm.foundation.softwaredeployment.DataProvider)2 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)2 Field (java.lang.reflect.Field)1 SQLException (java.sql.SQLException)1 List (java.util.List)1 EList (org.eclipse.emf.common.util.EList)1 EObject (org.eclipse.emf.ecore.EObject)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1