use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.
the class AnalysisExecutor method hasOutThreshold.
/**
* DOC qiongli Comment method "hasOutThreshold".
*
* @param indicator
* @return
*/
private boolean hasOutThreshold(Indicator indicator) {
String[] indicatorThreshold = IndicatorHelper.getIndicatorThreshold(indicator);
String[] indiPercentThreshold = IndicatorHelper.getIndicatorThresholdInPercent(indicator);
Object obj = IndicatorCommonUtil.getIndicatorValue(indicator);
if (indicatorThreshold != null || indiPercentThreshold != null) {
// MOD qiongli 2011-11-15 TDQ-3690 avoid String "null",and get the value for ValueIndicator to transfer.
if (obj != null && !PluginConstant.EMPTY_STRING.equals(obj.toString()) && !"null".equalsIgnoreCase(obj.toString())) {
// $NON-NLS-1$
String value = PluginConstant.EMPTY_STRING;
if (indicator instanceof ValueIndicator) {
value = ((ValueIndicator) indicator).getValue();
}
ChartDataEntity chartDataEntity = new ChartDataEntity(indicator, PluginConstant.EMPTY_STRING, value);
if (obj instanceof PatternMatchingExt) {
obj = (((PatternMatchingExt) obj).getMatchingValueCount());
}
if (chartDataEntity.isOutOfRange(obj.toString())) {
return true;
}
}
}
List<Indicator> leaves = IndicatorHelper.getIndicatorLeaves(indicator);
if (leaves.size() > 0 && !leaves.get(0).equals(indicator)) {
for (Indicator leaveIndicator : leaves) {
if (hasOutThreshold(leaveIndicator)) {
return true;
}
}
}
return false;
}
use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.
the class DependenciesHandler method getIndicatorDependency.
/**
* get Indicator Dependency.
*
* @return get the list for analysis which use parameter to be a Indicator
*/
public List<IRepositoryViewObject> getIndicatorDependency(IRepositoryViewObject viewObject) {
Item item = viewObject.getProperty().getItem();
List<IRepositoryViewObject> listAnalysisViewObject = new ArrayList<IRepositoryViewObject>();
if (item instanceof TDQIndicatorDefinitionItemImpl) {
TDQIndicatorDefinitionItemImpl tdqIndicatorItem = (TDQIndicatorDefinitionItemImpl) item;
IndicatorDefinition newIndicatorDefinition = tdqIndicatorItem.getIndicatorDefinition();
List<IRepositoryViewObject> allAnaList = new ArrayList<IRepositoryViewObject>();
try {
allAnaList.addAll(ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.TDQ_ANALYSIS_ELEMENT, true));
} catch (PersistenceException e) {
log.error(e, e);
}
for (IRepositoryViewObject theAna : allAnaList) {
List<Indicator> indicators = IndicatorHelper.getIndicators(((TDQAnalysisItem) theAna.getProperty().getItem()).getAnalysis().getResults());
for (Indicator indicator : indicators) {
IndicatorDefinition oldIndicatorDefinition = indicator.getIndicatorDefinition();
if (ModelElementHelper.compareUUID(oldIndicatorDefinition, newIndicatorDefinition)) {
listAnalysisViewObject.add(theAna);
break;
}
}
}
}
return listAnalysisViewObject;
}
use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.
the class SchemaAnalysisWizard method initCWMResourceBuilder.
@Override
public ModelElement initCWMResourceBuilder() {
Analysis analysis = (Analysis) super.initCWMResourceBuilder();
if (getAnalysisBuilder() != null) {
// MOD 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();
// Connection tdProvider = packageParameter.getTdDataProvider();
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()) {
SchemaIndicator createSchemaIndicator = SchemaFactory.eINSTANCE.createSchemaIndicator();
DBSchemaRepNode catalogNode = (DBSchemaRepNode) node;
Schema schema = ((MetadataSchemaRepositoryObject) catalogNode.getObject()).getSchema();
modelElement[i] = schema;
DefinitionHandler.getInstance().setDefaultIndicatorDefinition(createSchemaIndicator);
createSchemaIndicator.setAnalyzedElement(schema);
indicators[i] = createSchemaIndicator;
i++;
}
getAnalysisBuilder().addElementsToAnalyze(modelElement, indicators);
}
return analysis;
}
use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.
the class MatchWizard method initCWMResourceBuilder.
/*
* (non-Javadoc)
*
* @see org.talend.dataprofiler.core.ui.wizard.analysis.column.ColumnSetWizard#initCWMResourceBuilder()
*/
@Override
public ModelElement initCWMResourceBuilder() {
Analysis analysis = (Analysis) super.initCWMResourceBuilder();
// New blocking key indicator.
Indicator blockKeyIndicator = ColumnsetFactory.eINSTANCE.createBlockKeyIndicator();
analysis.getResults().getIndicators().add(blockKeyIndicator);
// Match rule indicator
RecordMatchingIndicator matchRuleIndicator = ColumnsetFactory.eINSTANCE.createRecordMatchingIndicator();
MatchRuleDefinition matchRuleDefinition = RulesFactory.eINSTANCE.createMatchRuleDefinition();
matchRuleIndicator.setBuiltInMatchRuleDefinition(matchRuleDefinition);
analysis.getResults().getIndicators().add(matchRuleIndicator);
// default loaded row count
IPreferenceStore preferenceStore = CorePlugin.getDefault().getPreferenceStore();
int maxRows = preferenceStore.getInt(PluginConstant.MAX_NB_ROWS_ANALYSIS_EDITOR);
TaggedValueHelper.setTaggedValue(analysis, TaggedValueHelper.PREVIEW_ROW_NUMBER, String.valueOf(maxRows));
return analysis;
}
use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.
the class IndicatorEvaluator method storeIndicator.
/*
* (non-Javadoc)
*
* @see org.talend.dq.indicators.Evaluator#storeIndicator(java.lang.Object,
* org.talend.dataquality.indicators.Indicator)
*
* MOD scorreia 2009-04-24 overrided to solve bug 7093
*/
@Override
public boolean storeIndicator(String elementToAnalyze, Indicator indicator) {
boolean ok = true;
final List<Indicator> indicatorLeaves = IndicatorHelper.getIndicatorLeaves(indicator);
for (Indicator leaf : indicatorLeaves) {
if (!this.allIndicators.contains(leaf) && !MultiMapHelper.addUniqueObjectToListMap(elementToAnalyze, leaf, elementToIndicators)) {
ok = false;
}
}
this.allIndicators.addAll(indicatorLeaves);
return ok;
}
Aggregations