use of org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit in project tdq-studio-se by Talend.
the class ModelElementIndicatorImpl method removeSpecialIndicatorUnit.
/**
* Remove the specialIndicatorUnit from specialIndicatorList, if there exist more than one InicatorIndicator which
* has same IndicatorEnumn type, the type of IndicatorUnit will be not removed from flatIndicatorEnumList.
*
* @param indicatorUnit
*/
private void removeSpecialIndicatorUnit(IndicatorUnit indicatorUnit) {
IndicatorEnum indicatorEnumn = indicatorUnit.getType();
this.specialIndicatorUnitList.remove(indicatorUnit);
for (IndicatorUnit unit : specialIndicatorUnitList) {
if (unit.getType() == indicatorEnumn) {
return;
} else {
continue;
}
}
this.flatIndicatorEnumList.remove(indicatorEnumn);
}
use of org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit 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.IndicatorUnit in project tdq-studio-se by Talend.
the class ModelElementIndicatorImpl method getIndicators.
public Indicator[] getIndicators() {
List<Indicator> indicatorList = new ArrayList<Indicator>();
IndicatorUnit[] indicatorUnits = this.getIndicatorUnits();
for (IndicatorUnit indicatorUnit : indicatorUnits) {
indicatorList.add(indicatorUnit.getIndicator());
}
return indicatorList.toArray(new Indicator[indicatorList.size()]);
}
use of org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit 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.IndicatorUnit in project tdq-studio-se by Talend.
the class AbstractColumnDropTree method openIndicatorOptionDialog.
/**
* open Indicator Option Dialog.
*
* @param shell
* @param indicatorItem
* @return
*/
public boolean openIndicatorOptionDialog(Shell shell, TreeItem indicatorItem) {
IndicatorUnit indicatorUnit = (IndicatorUnit) indicatorItem.getData(INDICATOR_UNIT_KEY);
if (FormEnum.isExsitingForm(indicatorUnit)) {
IndicatorOptionsWizard wizard = new IndicatorOptionsWizard(indicatorUnit);
String href = FormEnum.getFirstFormHelpHref(indicatorUnit);
OpeningHelpWizardDialog optionDialog = new OpeningHelpWizardDialog(shell, wizard, href);
if (Window.OK == optionDialog.open()) {
setDirty(wizard.isDirty());
return hasIndicatorParameters(indicatorUnit);
}
} else {
openNoIndicatorOptionsMessageDialog(shell);
}
return false;
}
Aggregations