use of org.talend.dataquality.indicators.schema.CatalogIndicator in project tdq-studio-se by Talend.
the class ConnectionAnalysisDetailsPage method getCatalogIndicators.
@Override
public List<OverviewIndUIElement> getCatalogIndicators() {
ConnectionIndicator conIndicator = (ConnectionIndicator) getCurrentModelElement().getResults().getIndicators().get(0);
Connection analyzedElement = (Connection) conIndicator.getAnalyzedElement();
EList<CatalogIndicator> catalogIndicators = conIndicator.getCatalogIndicators();
List<OverviewIndUIElement> cataUIEleList = new ArrayList<OverviewIndUIElement>();
RepositoryNode connNode = RepositoryNodeHelper.recursiveFind(analyzedElement);
for (Indicator indicator : catalogIndicators) {
if (connNode != null) {
for (IRepositoryNode catalogNode : connNode.getChildren()) {
Catalog catalog = ((MetadataCatalogRepositoryObject) catalogNode.getObject()).getCatalog();
String connUuid = ResourceHelper.getUUID(catalog);
String anaUuid = ResourceHelper.getUUID(indicator.getAnalyzedElement());
if (connUuid.equals(anaUuid)) {
OverviewIndUIElement cataUIEle = new OverviewIndUIElement();
cataUIEle.setNode(catalogNode);
cataUIEle.setOverviewIndicator(indicator);
cataUIEleList.add(cataUIEle);
break;
}
}
}
}
return cataUIEleList;
}
use of org.talend.dataquality.indicators.schema.CatalogIndicator in project tdq-studio-se by Talend.
the class AbstractSchemaEvaluatorTest method testAddToConnectionIndicator2Parameters.
@Test
public /**
* No mock. using java reflect mechanism to set private variable.
* @throws SQLException
* @throws InstantiationException
* @throws IllegalAccessException
* @throws NoSuchFieldException
* @throws SecurityException
* @throws NoSuchMethodException
* @throws IllegalArgumentException
* @throws InvocationTargetException
*/
void testAddToConnectionIndicator2Parameters() throws SQLException, InstantiationException, IllegalAccessException, NoSuchFieldException, SecurityException, NoSuchMethodException, IllegalArgumentException, InvocationTargetException {
//
Connection dataProvider = ConnectionFactory.eINSTANCE.createConnection();
ConnectionIndicator connectionIndicator = SchemaFactory.eINSTANCE.createConnectionIndicator();
List<Indicator> indicators = new ArrayList<Indicator>();
indicators.add(connectionIndicator);
Class<ConnectionEvaluator> connEval = ConnectionEvaluator.class;
ConnectionEvaluator instance = connEval.newInstance();
// $NON-NLS-1$
Field field = connEval.getDeclaredField("dataProvider");
field.setAccessible(true);
field.set(instance, dataProvider);
// $NON-NLS-1$
Field field2 = connEval.getDeclaredField("elementIndics");
field2.setAccessible(true);
field2.set(instance, indicators);
SchemaIndicator schemaIndic1 = SchemaFactory.eINSTANCE.createSchemaIndicator();
schemaIndic1.setTableCount(3);
schemaIndic1.setViewCount(1);
schemaIndic1.setTableRowCount(100L);
SchemaIndicator schemaIndic2 = SchemaFactory.eINSTANCE.createSchemaIndicator();
schemaIndic2.setTableCount(2);
schemaIndic2.setViewCount(2);
schemaIndic2.setTableRowCount(95L);
CatalogIndicator catalogIndic = SchemaFactory.eINSTANCE.createCatalogIndicator();
catalogIndic.setSchemaCount(2);
for (int i = 0; i < 2; i++) {
if (i == 0) {
instance.addToConnectionIndicator(catalogIndic, schemaIndic1);
} else {
instance.addToConnectionIndicator(catalogIndic, schemaIndic2);
}
}
assertEquals(connectionIndicator.getCatalogCount(), 1);
assertEquals(connectionIndicator.getSchemaCount(), 2);
assertEquals(connectionIndicator.getTableCount(), 5);
assertEquals(connectionIndicator.getViewCount(), 3);
assertEquals(connectionIndicator.getTableRowCount(), 195);
}
use of org.talend.dataquality.indicators.schema.CatalogIndicator in project tdq-studio-se by Talend.
the class ConnectionAnalysisWizard method initCWMResourceBuilder.
@Override
public ModelElement initCWMResourceBuilder() {
Analysis analysis = (Analysis) super.initCWMResourceBuilder();
if (getAnalysisBuilder() != null) {
IRepositoryNode connectionRepNode = getParameter().getConnectionRepNode();
ConnectionItem item = (ConnectionItem) connectionRepNode.getObject().getProperty().getItem();
Connection tdProvider = item.getConnection();
getAnalysisBuilder().setAnalysisConnection(tdProvider);
ConnectionIndicator indicator = SchemaFactory.eINSTANCE.createConnectionIndicator();
// MOD xqliu 2009-1-21 feature 4715
DefinitionHandler.getInstance().setDefaultIndicatorDefinition(indicator);
indicator.setAnalyzedElement(tdProvider);
List<Schema> tdSchemas = ConnectionHelper.getSchema(tdProvider);
if (tdSchemas.size() != 0) {
addSchemaIndicator(tdSchemas, indicator);
}
List<Catalog> tdCatalogs = ConnectionHelper.getCatalogs(tdProvider);
for (Catalog tdCatalog : tdCatalogs) {
CatalogIndicator createCatalogIndicator = SchemaFactory.eINSTANCE.createCatalogIndicator();
// MOD xqliu 2009-1-21 feature 4715
DefinitionHandler.getInstance().setDefaultIndicatorDefinition(createCatalogIndicator);
createCatalogIndicator.setAnalyzedElement(tdCatalog);
// MOD xqliu 2009-11-30 bug 9114
indicator.addCatalogIndicator(createCatalogIndicator);
// ~
addSchemaIndicator(CatalogHelper.getSchemas(tdCatalog), indicator);
}
getAnalysisBuilder().addElementToAnalyze(tdProvider, indicator);
}
return analysis;
}
use of org.talend.dataquality.indicators.schema.CatalogIndicator in project tdq-studio-se by Talend.
the class CatalogAnalysisWizard method initCWMResourceBuilder.
@Override
public ModelElement initCWMResourceBuilder() {
Analysis analysis = (Analysis) super.initCWMResourceBuilder();
if (getAnalysisBuilder() != null) {
// DOC klliu 15750 2011-1-05 add the repnode on parameter
PackagesAnalyisParameter packageParameter = getParameter();
IRepositoryNode connectionRepNode = getParameter().getConnectionRepNode();
ConnectionItem item = (ConnectionItem) connectionRepNode.getObject().getProperty().getItem();
Connection tdProvider = item.getConnection();
getAnalysisBuilder().setAnalysisConnection(tdProvider);
Indicator[] indicators = new Indicator[packageParameter.getPackages().size()];
ModelElement[] modelElement = new ModelElement[packageParameter.getPackages().size()];
int i = 0;
for (IRepositoryNode node : packageParameter.getPackages()) {
CatalogIndicator createCatalogIndicator = SchemaFactory.eINSTANCE.createCatalogIndicator();
// MOD xqliu 2009-1-21 feature 4715
DefinitionHandler.getInstance().setDefaultIndicatorDefinition(createCatalogIndicator);
Catalog catalog = ((MetadataCatalogRepositoryObject) node.getObject()).getCatalog();
modelElement[i] = catalog;
createCatalogIndicator.setAnalyzedElement(catalog);
indicators[i] = createCatalogIndicator;
i++;
}
getAnalysisBuilder().addElementsToAnalyze(modelElement, indicators);
}
return analysis;
}
Aggregations