use of org.talend.dataquality.indicators.CompositeIndicator in project tdq-studio-se by Talend.
the class CorrelationAnalysisDetailsPage method initializeIndicator.
private void initializeIndicator(Indicator indicator) {
if (indicator.getIndicatorDefinition() == null) {
DefinitionHandler.getInstance().setDefaultIndicatorDefinition(indicator);
}
// MOD xqliu 2010-04-06 bug 12161
if (indicator instanceof CountAvgNullIndicator) {
if (((CountAvgNullIndicator) indicator).getChildIndicators().size() == 0) {
CountAvgNullIndicator countAvgNullIndicator = (CountAvgNullIndicator) indicator;
fillSimpleIndicators(countAvgNullIndicator);
}
for (Indicator child : ((CompositeIndicator) indicator).getChildIndicators()) {
// recurse
initializeIndicator(child);
}
} else if (indicator instanceof CompositeIndicator) {
// MOD qiongli 2012-5-14 TDQ-5256 should initialize children
for (Indicator child : ((CompositeIndicator) indicator).getChildIndicators()) {
initializeIndicator(child);
}
}
}
use of org.talend.dataquality.indicators.CompositeIndicator in project tdq-studio-se by Talend.
the class CompositeIndicatorImpl method getLeafIndicators.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT getLeafIndicators()
*/
public EList<Indicator> getLeafIndicators() {
EList<Indicator> leafIndicators = new BasicEList<Indicator>();
EList<Indicator> childIndicators = getChildIndicators();
for (Indicator indicator : childIndicators) {
if (indicator instanceof CompositeIndicator) {
leafIndicators.addAll(((CompositeIndicator) indicator).getLeafIndicators());
} else {
leafIndicators.add(indicator);
}
}
return leafIndicators;
}
use of org.talend.dataquality.indicators.CompositeIndicator in project tdq-studio-se by Talend.
the class AnalysisColumnTreeViewer method createTree.
/**
* @param parent
*/
private Tree createTree(Composite parent) {
final Tree newTree = new TooltipTree(parent, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION) {
@Override
protected boolean isValidItem(TreeItem item) {
if (item == null) {
return false;
}
Object itemData = item.getData(INDICATOR_UNIT_KEY);
Object columnItemData = item.getData(MODELELEMENT_INDICATOR_KEY);
if (itemData != null) {
IndicatorUnit indicatorUnit = (IndicatorUnit) item.getData(INDICATOR_UNIT_KEY);
if (indicatorUnit != null && !(indicatorUnit.getIndicator() instanceof CompositeIndicator)) {
return true;
}
return false;
} else {
if (columnItemData != null) {
ModelElementIndicator modelElementIndicator = (ModelElementIndicator) columnItemData;
IRepositoryNode modelElementRepositoryNode = modelElementIndicator.getModelElementRepositoryNode();
return modelElementRepositoryNode == null ? false : true;
}
return false;
}
}
@Override
protected String getItemTooltipText(TreeItem item) {
String expCont = isExpressionNull(item);
if (expCont == null) {
// $NON-NLS-1$
return DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.queryNotGen");
}
return expCont;
}
};
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(newTree);
newTree.setHeaderVisible(true);
// $NON-NLS-1$
createTreeItem(newTree, 300, "AnalysisColumnTreeViewer.analyzedColumns");
createTreeDataminingItem(newTree);
// $NON-NLS-1$
createTreeItem(newTree, 80, "AnalysisColumnTreeViewer.pattern");
// $NON-NLS-1$
createTreeItem(newTree, 80, "AnalysisColumnTreeViewer.udi");
// $NON-NLS-1$
createTreeItem(newTree, 80, "AnalysisColumnTreeViewer.operation");
// TDQ-11622 : add a column here, let the width = 1 and text = EMPTY_STRING TODO need to find a better solution!
TreeColumn blankColumn = new TreeColumn(newTree, SWT.CENTER);
blankColumn.setWidth(1);
// ~ TDQ-11622
parent.layout();
AbstractAnalysisActionHandler actionHandler = new AbstractAnalysisActionHandler(parent) {
@Override
protected void handleRemove() {
removeSelectedElements(newTree);
}
};
parent.setData(AbstractMetadataFormPage.ACTION_HANDLER, actionHandler);
ColumnViewerDND.installDND(newTree);
this.addTreeListener(newTree);
newTree.setData(this);
return newTree;
}
use of org.talend.dataquality.indicators.CompositeIndicator in project tdq-studio-se by Talend.
the class AnalysisTableTreeViewer method createTree.
private Tree createTree(Composite parent) {
final Tree newTree = new TooltipTree(parent, SWT.MULTI | SWT.BORDER) {
@Override
protected boolean isValidItem(TreeItem item) {
if (item == null) {
return false;
}
Object itemData = item.getData(INDICATOR_UNIT_KEY);
if (itemData != null) {
TableIndicatorUnit indicatorUnit = (TableIndicatorUnit) item.getData(INDICATOR_UNIT_KEY);
if (indicatorUnit != null && !(indicatorUnit.getIndicator() instanceof CompositeIndicator)) {
return true;
}
return false;
} else {
return false;
}
}
@Override
protected String getItemTooltipText(TreeItem item) {
String expCont = isExpressionNull(item);
if (expCont == null) {
// $NON-NLS-1$
return DefaultMessagesImpl.getString("AnalysisTableTreeViewer.queryNotGen");
}
return expCont;
}
};
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(newTree);
newTree.setHeaderVisible(true);
// $NON-NLS-1$
createTreeItem(newTree, 190, "AnalysisTableTreeViewer.analyzedTables");
// $NON-NLS-1$
createTreeItem(newTree, 80, "AnalysisTableTreeViewer.dqrule");
// $NON-NLS-1$
createTreeItem(newTree, 80, "AnalysisColumnTreeViewer.operation");
parent.layout();
AbstractAnalysisActionHandler actionHandler = new AbstractAnalysisActionHandler(parent) {
@Override
protected void handleRemove() {
removeSelectedElements(newTree);
}
};
parent.setData(AbstractMetadataFormPage.ACTION_HANDLER, actionHandler);
TableViewerDND.installDND(newTree);
this.addTreeListener(newTree);
newTree.setData(this);
return newTree;
}
use of org.talend.dataquality.indicators.CompositeIndicator in project tdq-studio-se by Talend.
the class ColumnAnalysisSqlParallelExecutor method run.
/**
* run analysis when SqlParallelExecutor.
*
* @return true if successfull , false otherwise.
*/
public Boolean run() {
Expression query = null;
try {
if (!continueRun()) {
return Boolean.FALSE;
}
// skip composite indicators that do not require a sql execution
if (indicator instanceof CompositeIndicator) {
// options of composite indicators are handled elsewhere
return Boolean.TRUE;
}
synchronized (schemata) {
// set the connection's catalog
if (belongToSameSchemata(indicator.getAnalyzedElement())) {
if (needChangeCatalog(connection)) {
String catalogName = getCatalogOrSchemaName(indicator.getAnalyzedElement());
if (catalogName != null) {
// check whether null argument can be given
changeCatalog(catalogName, connection);
}
}
}
}
// add mapping of analyzed elements to their indicators
synchronized (elementToIndicator) {
addElements2IndicatorsMapping(elementToIndicator, indicator);
}
query = dbms().getInstantiatedExpression(indicator);
if (query == null) {
traceError(getErrorMessageForQuery(query));
return Boolean.FALSE;
}
try {
boolean execStatus = executeQuery(indicator, connection, query.getBody());
if (!execStatus) {
traceError(getErrorMessageForQuery(query));
return Boolean.FALSE;
}
} catch (SQLException e) {
log.error(e, e);
traceError(getErrorMessageForQuery(query));
return Boolean.FALSE;
}
// set computation done
indicator.setComputed(true);
} finally {
// return the connection after run
if (POOLED_CONNECTION) {
TdqAnalysisConnectionPool.returnPooledConnection(cachedAnalysis, connection);
}
}
return Boolean.TRUE;
}
Aggregations