use of org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit in project tdq-studio-se by Talend.
the class ModelElementIndicatorImpl method createTempSpecialIndicatorUnit.
private IndicatorUnit createTempSpecialIndicatorUnit(IndicatorEnum indicatorEnum, Indicator indicator) {
Indicator tempIndicator = indicator;
if (tempIndicator == null) {
EFactoryImpl factory = (EFactoryImpl) indicatorEnum.getIndicatorType().getEPackage().getEFactoryInstance();
tempIndicator = (Indicator) factory.create(indicatorEnum.getIndicatorType());
// MOD scorreia 2008-09-18: bug 5131 fixed: set indicator's definition when the indicator is created.
if (!DefinitionHandler.getInstance().setDefaultIndicatorDefinition(tempIndicator)) {
// $NON-NLS-1$
log.error(DefaultMessagesImpl.getString("ModelElementIndicatorImpl_COULDNOTSETDEF_GIVEN_IND0") + tempIndicator.getName());
}
}
// }
if (this.specialIndicatorUnitList == null) {
this.specialIndicatorUnitList = new ArrayList<IndicatorUnit>();
}
for (IndicatorUnit currentUnit : tempSpecialIndicatorUnitList) {
if (tempIndicator.getName().equalsIgnoreCase(currentUnit.getIndicator().getName())) {
return currentUnit;
}
}
IndicatorUnit indicatorUnit = new ColumnIndicatorUnit(indicatorEnum, tempIndicator, this);
tempSpecialIndicatorUnitList.add(indicatorUnit);
this.specialIndicatorUnitMap.put(tempIndicator.getName(), indicatorUnit);
return indicatorUnit;
}
use of org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit in project tdq-studio-se by Talend.
the class ModelElementIndicatorImpl method createPlainIndicatorUnit.
/**
* Create a new IndicatorUnit according to indicatorEnum and indicator, if the parameter indicator is null, will
* create a new indicator .
*
* @param indicatorEnum
* @param indicator
* @return
*/
private IndicatorUnit createPlainIndicatorUnit(IndicatorEnum indicatorEnum, Indicator indicator) {
Indicator tempIndicator = indicator;
if (tempIndicator == null) {
EFactoryImpl factory = (EFactoryImpl) indicatorEnum.getIndicatorType().getEPackage().getEFactoryInstance();
tempIndicator = (Indicator) factory.create(indicatorEnum.getIndicatorType());
// MOD scorreia 2008-09-18: bug 5131 fixed: set indicator's definition when the indicator is created.
if (!DefinitionHandler.getInstance().setDefaultIndicatorDefinition(tempIndicator)) {
// $NON-NLS-1$
log.error("Could not set the definition of the given indicator :" + tempIndicator.getName());
}
// for 4225, the frequency indicator need be initialized
int sqlType = getJavaType();
if (tempIndicator instanceof FrequencyIndicator && Java2SqlType.isDateInSQL(sqlType)) {
IndicatorParameters parameters = tempIndicator.getParameters();
if (parameters == null) {
parameters = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
tempIndicator.setParameters(parameters);
}
DateParameters dateParameters = parameters.getDateParameters();
// "Year Frequency Table" when applying on "Time" type
if (dateParameters == null && !(indicatorEnum == IndicatorEnum.PatternFreqIndicatorEnum || indicatorEnum == IndicatorEnum.PatternLowFreqIndicatorEnum || indicatorEnum == IndicatorEnum.FrequencyIndicatorEnum || indicatorEnum == IndicatorEnum.LowFrequencyIndicatorEnum)) {
dateParameters = IndicatorsFactory.eINSTANCE.createDateParameters();
parameters.setDateParameters(dateParameters);
}
// TDQ-5357~
// MOD scorreia 2008-06-19 default is already set in the model
// dateParameters.setDateAggregationType(DateGrain.YEAR);
}
}
IndicatorUnit indicatorUnit = new ColumnIndicatorUnit(indicatorEnum, tempIndicator, this);
this.plainIndicatorUnitMap.put(indicatorEnum, indicatorUnit);
return indicatorUnit;
}
use of org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit in project tdq-studio-se by Talend.
the class BenfordLawFrequencyStateTest method setUp.
/**
* init the state.
*
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
UnitTestBuildHelper.initProjectStructure();
List<IndicatorUnit> units = new ArrayList<IndicatorUnit>();
BenfordLawFrequencyIndicator benfordLawFrequencyIndicator = IndicatorsFactory.eINSTANCE.createBenfordLawFrequencyIndicator();
List<IRepositoryViewObject> all = ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.SYSTEM_INDICATORS_FRAUDDETECTION);
Assert.assertEquals(1, all.size());
IRepositoryViewObject iRepositoryViewObject = all.get(0);
Assert.assertNotNull(iRepositoryViewObject);
TDQIndicatorDefinitionItem benfordItem = (TDQIndicatorDefinitionItem) iRepositoryViewObject.getProperty().getItem();
benfordLawFrequencyIndicator.setIndicatorDefinition(benfordItem.getIndicatorDefinition());
ModelElementIndicator modelElementIndicator = UnitTestBuildHelper.createModelElementIndicator();
ColumnIndicatorUnit columnIndicatorUnit = new ColumnIndicatorUnit(IndicatorEnum.BenfordLawFrequencyIndicatorEnum, benfordLawFrequencyIndicator, modelElementIndicator);
// IndicatorUnit unit = mock(IndicatorUnit.class);
units.add(columnIndicatorUnit);
for (int i = 0; i < 10; i++) {
benfordLawFrequencyIndicator.handle(i);
}
benState = new BenfordLawFrequencyState(units);
}
use of org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit in project tdq-studio-se by Talend.
the class FrequencyDynamicChartEventReceiver method refreshChart.
@Override
public void refreshChart() {
List<IndicatorUnit> indicatorUnits = new ArrayList<IndicatorUnit>();
indicatorUnits.add(new ColumnIndicatorUnit(IndicatorEnum.findIndicatorEnum(this.getIndicator().eClass()), this.getIndicator(), null));
// indicators
FrequencyStatisticsState state = new FrequencyStatisticsState(indicatorUnits);
state.setSupportDynamicChart(true);
Object chart = state.getChart();
TOPChartUtils.getInstance().decorateChart(chart, false);
if (this.parentChartComposite != null) {
TOPChartUtils.getInstance().refrechChart(this.parentChartComposite, chart);
}
EventManager.getInstance().publish(chartComposite, EventEnum.DQ_DYNAMIC_REFRESH_DYNAMIC_CHART, null);
}
use of org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit in project tdq-studio-se by Talend.
the class DynamicBAWChartEventReceiver method createEventReceiver.
public DynamicChartEventReceiver createEventReceiver(IndicatorEnum type, Indicator oneIndicator) {
// the receiver for each summary indicator, just need to put the indicator name and its related value into the
// map, and call the method which judge the total
DynamicChartEventReceiver eReceiver = new DynamicChartEventReceiver() {
@Override
public boolean handle(Object value) {
super.handle(value);
addToSummaryMap(getIndicatorType(), value);
if (isIntact()) {
if (this.getTableViewer() != null) {
String str = value == null ? String.valueOf(Double.NaN) : String.valueOf(value);
this.refreshTable(str);
if (isLastIndicator()) {
// when current is last one indicator which Summary statistics indicators then update IQRIndicator and
// RangeIndicator
updateValueOfIRQAndRange();
}
}
} else {
updateValueOfIRQAndRange();
}
return true;
}
};
eReceiver.setIndicatorType(type);
eReceiver.setIndicatorName(oneIndicator.getName());
indicators.add(new ColumnIndicatorUnit(type, oneIndicator, null));
if (IndicatorEnum.IQRIndicatorEnum.equals(type)) {
this.IRQIndicator = oneIndicator;
this.IRQIndicatorEvent = eReceiver;
} else if (IndicatorEnum.RangeIndicatorEnum.equals(type)) {
this.rangeIndicator = oneIndicator;
this.rangeIndicatorEvent = eReceiver;
}
return eReceiver;
}
Aggregations