use of org.talend.dq.indicators.preview.table.ChartDataEntity 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.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.
the class SummaryStatisticsTableState method getDataEntity.
/*
* (non-Javadoc)
*
* @see org.talend.dataprofiler.core.ui.editor.preview.model.states.table.AbstractTableTypeStates#getDataEntity()
*/
@Override
public ChartDataEntity[] getDataEntity() {
List<ChartDataEntity> dataEnities = new ArrayList<ChartDataEntity>();
for (IndicatorUnit unit : units) {
String value = summaryUtil.getUnitValue(unit);
ChartDataEntity entity = summaryUtil.createDataEntity(unit, value);
dataEnities.add(entity);
}
return dataEnities.toArray(new ChartDataEntity[dataEnities.size()]);
}
use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.
the class FrequencyTypeStateUtil method createChartEntity.
public static ChartDataEntity createChartEntity(Indicator indicator, FrequencyExt freqExt, String keyLabel, boolean isWithRowCountIndicator) {
ChartDataEntity entity = new ChartDataEntity();
entity.setIndicator(indicator);
// MOD mzhao feature:6307 display soundex distinct count and real count.
entity.setKey(freqExt == null ? null : freqExt.getKey());
entity.setLabelNull(freqExt == null || freqExt.getKey() == null);
entity.setLabel(keyLabel);
entity.setValue(String.valueOf(freqExt == null ? StringUtils.EMPTY : freqExt.getValue()));
if (freqExt == null) {
entity.setPercent(0.0);
} else if (indicator instanceof BenfordLawFrequencyIndicator) {
entity.setPercent(freqExt.getFrequency());
} else {
Double percent = isWithRowCountIndicator ? freqExt.getFrequency() : Double.NaN;
entity.setPercent(percent);
}
return entity;
}
use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.
the class ModeStatisticsStateUtil method createDataEntity.
/**
* DOC yyin Comment method "createDataEntity".
*
* @param unit
* @param label
* @return
*/
public static ChartDataEntity createDataEntity(IndicatorUnit unit, String label) {
ChartDataEntity entity = new ChartDataEntity();
entity.setIndicator(unit.getIndicator());
entity.setLabel(label);
Object value = unit.getValue();
entity.setValue(String.valueOf(value == null ? StringUtils.EMPTY : value));
return entity;
}
use of org.talend.dq.indicators.preview.table.ChartDataEntity in project tdq-studio-se by Talend.
the class PhoneNumbStatisticsStateUtil method createDataEntity.
/**
* DOC yyin Comment method "createDataEntity".
*
* @param unit
* @param value
* @param label
* @return
*/
public static ChartDataEntity createDataEntity(Indicator indicator, String value, String label) {
ChartDataEntity entity = new ChartDataEntity();
entity.setIndicator(indicator);
entity.setLabel(label);
entity.setValue(value);
entity.setPercent(Double.parseDouble(value) / indicator.getCount());
return entity;
}
Aggregations