Search in sources :

Example 1 with SchemaSwitch

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

the class ConnectionEvaluator method addToConnectionIndicator.

@Override
protected void addToConnectionIndicator(Indicator indicator) {
    final ConnectionIndicator connectionIndicator = getConnectionIndicator();
    if (connectionIndicator == null) {
        return;
    }
    SchemaSwitch<Boolean> schemaSwitch = new SchemaSwitch<Boolean>() {

        /*
             * (non-Javadoc)
             * 
             * @see
             * org.talend.dataquality.indicators.schema.util.SchemaSwitch#caseCatalogIndicator(org.talend.dataquality
             * .indicators.schema.CatalogIndicator)
             */
        @Override
        public Boolean caseCatalogIndicator(CatalogIndicator object) {
            connectionIndicator.addCatalogIndicator(object);
            connectionIndicator.setCatalogCount(connectionIndicator.getCatalogCount() + 1);
            // increment schema count
            connectionIndicator.setSchemaCount(connectionIndicator.getSchemaCount() + object.getSchemaCount());
            // MOD scorreia 2009-01-16 increment other counts
            incrementCounts(connectionIndicator, object);
            return true;
        }

        private void incrementCounts(final ConnectionIndicator connIndicator, SchemaIndicator childIndicator) {
            connIndicator.setTableCount(connIndicator.getTableCount() + childIndicator.getTableCount());
            connIndicator.setTableRowCount(connIndicator.getTableRowCount() + childIndicator.getTableRowCount());
            // MOD klliu 2011-12-26 bug TDQ-4235
            connIndicator.setViewCount(connIndicator.getViewCount() + childIndicator.getViewCount());
            connIndicator.setViewRowCount(connIndicator.getViewRowCount() + childIndicator.getViewRowCount());
            connIndicator.setKeyCount(connIndicator.getKeyCount() + childIndicator.getKeyCount());
            connIndicator.setIndexCount(connIndicator.getIndexCount() + childIndicator.getIndexCount());
        }

        /*
             * (non-Javadoc)
             * 
             * @see
             * org.talend.dataquality.indicators.schema.util.SchemaSwitch#caseSchemaIndicator(org.talend.dataquality
             * .indicators.schema.SchemaIndicator)
             */
        @Override
        public Boolean caseSchemaIndicator(SchemaIndicator object) {
            connectionIndicator.addSchemaIndicator(object);
            connectionIndicator.setSchemaCount(connectionIndicator.getSchemaCount() + 1);
            // MOD scorreia 2009-01-16 increment other counts
            incrementCounts(connectionIndicator, object);
            return true;
        }
    };
    schemaSwitch.doSwitch(indicator);
}
Also used : SchemaIndicator(org.talend.dataquality.indicators.schema.SchemaIndicator) CatalogIndicator(org.talend.dataquality.indicators.schema.CatalogIndicator) SchemaSwitch(org.talend.dataquality.indicators.schema.util.SchemaSwitch) ConnectionIndicator(org.talend.dataquality.indicators.schema.ConnectionIndicator)

Aggregations

CatalogIndicator (org.talend.dataquality.indicators.schema.CatalogIndicator)1 ConnectionIndicator (org.talend.dataquality.indicators.schema.ConnectionIndicator)1 SchemaIndicator (org.talend.dataquality.indicators.schema.SchemaIndicator)1 SchemaSwitch (org.talend.dataquality.indicators.schema.util.SchemaSwitch)1