use of org.talend.dataquality.indicators.CompositeIndicator in project tdq-studio-se by Talend.
the class CompositeIndicatorImpl method getAllChildIndicators.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT getAllChildIndicators()
*/
public EList<Indicator> getAllChildIndicators() {
EList<Indicator> allChildIndicators = new BasicEList<Indicator>();
EList<Indicator> childIndicators = getChildIndicators();
for (Indicator indicator : childIndicators) {
if (indicator instanceof CompositeIndicator) {
allChildIndicators.addAll(((CompositeIndicator) indicator).getAllChildIndicators());
} else {
allChildIndicators.add(indicator);
}
}
return allChildIndicators;
}
use of org.talend.dataquality.indicators.CompositeIndicator in project tdq-studio-se by Talend.
the class ColumnAnalysisSqlExecutor method runAnalysisIndicators.
/**
* DOC xqliu Comment method "runAnalysisIndicators".
*
* @param connection
* @param elementToIndicator
* @param indicators
* @return
* @throws SQLException
*/
private boolean runAnalysisIndicators(Connection connection, Map<ModelElement, List<Indicator>> elementToIndicator, Collection<Indicator> indicators) throws SQLException {
boolean runStatus = Boolean.TRUE;
for (Indicator indicator : indicators) {
// skip composite indicators that do not require a sql execution
if (indicator instanceof CompositeIndicator) {
// options of composite indicators are handled elsewhere
continue;
}
// set the connection's catalog
if (needChangeCatalog(connection)) {
String catalogName = getCatalogOrSchemaName(indicator.getAnalyzedElement());
if (catalogName != null) {
// check whether null argument can be given
changeCatalog(catalogName, connection);
}
}
Expression query = dbms().getInstantiatedExpression(indicator);
if (query == null || !executeQuery(indicator, connection, query.getBody())) {
traceError(// $NON-NLS-1$//$NON-NLS-2$
"Query not executed for indicator: \"" + AnalysisExecutorHelper.getIndicatorName(indicator) + "\" " + // $NON-NLS-1$//$NON-NLS-2$
((query == null) ? "query is null" : "SQL query: " + query.getBody()));
runStatus = Boolean.FALSE;
} else {
// set computation done
indicator.setComputed(true);
}
// add mapping of analyzed elements to their indicators
addElements2IndicatorsMapping(elementToIndicator, indicator);
}
return runStatus;
}
use of org.talend.dataquality.indicators.CompositeIndicator in project tdq-studio-se by Talend.
the class SplitSysIndicatorTask method doExecute.
@Override
protected boolean doExecute() throws Exception {
boolean ok = true;
// Copy system indicators.
DQStructureManager manager = DQStructureManager.getInstance();
IFolder systemIndicatorFolder = ResourceManager.getSystemIndicatorFolder();
if (!systemIndicatorFolder.exists()) {
systemIndicatorFolder = manager.createNewFolder(ResourceManager.getIndicatorFolder(), EResourceConstant.SYSTEM_INDICATORS);
}
manager.copyFilesToFolder(CorePlugin.getDefault(), DQStructureManager.SYSTEM_INDICATOR_PATH, true, systemIndicatorFolder, null, true);
DefinitionHandler.getInstance().reloadIndicatorsDefinitions();
// Migration for analyses (indicator definition)
Collection<Analysis> analyses = (Collection<Analysis>) AnaResourceFileHelper.getInstance().getAllElement();
for (Analysis ana : analyses) {
try {
for (Indicator ind : ana.getResults().getIndicators()) {
updateIndDefinition(ind);
if (ind instanceof CompositeIndicator) {
for (Indicator indLeave : IndicatorHelper.getIndicatorLeavesBySingleNode(ind)) {
updateIndDefinition(indLeave);
}
}
}
EMFSharedResources.getInstance().saveResource(ana.eResource());
} catch (Exception e) {
log.warn(e, e);
ok = false;
}
}
// MOD qiongli 2011-11-16 TDQ-3694,should relaod definitions and all categories after changing the definition
// file.
// Copy system indicator categories.
IFile file = ResourceManager.getLibrariesFolder().getFile(DefinitionHandler.FILENAME);
file.delete(true, new NullProgressMonitor());
DefinitionHandler.getInstance().copyDefinitionsIntoFolder(ResourceManager.getLibrariesFolder());
URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), false);
EMFSharedResources.getInstance().reloadResource(uri);
DefinitionHandler.getInstance().reloadIndicatorsDefinitions();
return ok;
}
use of org.talend.dataquality.indicators.CompositeIndicator in project tdq-studio-se by Talend.
the class IndicatorHelper method getIndicators.
/**
* Method "getIndicators".
*
* @param result
* @return
*/
public static List<Indicator> getIndicators(AnalysisResult result) {
List<Indicator> indicators = new ArrayList<Indicator>();
if (result != null) {
EList<Indicator> indicators2 = result.getIndicators();
if (indicators2 != null) {
for (Indicator indicator : indicators2) {
List<Indicator> indicatorLeaves = getIndicatorLeavesBySingleNode(indicator);
if (indicator instanceof CompositeIndicator) {
indicators.add(indicator);
}
indicators.addAll(indicatorLeaves);
}
}
}
return indicators;
}
Aggregations