use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class InidcatorUnitTest method testIsExsitingFormCase1.
/**
* Test method for {@link org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit#isExsitingForm()}.
*
* test case 1:ColumnIndicatorUnit
*/
@Test
public void testIsExsitingFormCase1() {
Indicator indicator = IndicatorsFactory.eINSTANCE.createIndicator();
ModelElementIndicator modelElementIndicator = UnitTestBuildHelper.createModelElementIndicator();
// Count UDI case
IndicatorDefinition createIndicatorDefinition = DefinitionFactory.eINSTANCE.createIndicatorDefinition();
createIndicatorDefinition.getCategories().add(DefinitionHandler.getInstance().getUserDefinedCountIndicatorCategory());
indicator.setIndicatorDefinition(createIndicatorDefinition);
ColumnIndicatorUnit colUnit = new ColumnIndicatorUnit(IndicatorEnum.UserDefinedIndicatorEnum, indicator, modelElementIndicator);
boolean exsitingForm = colUnit.isExsitingForm();
// TDQ-10557: Allow set threshold option on UDIs
Assert.assertEquals("indicator " + IndicatorEnum.UserDefinedIndicatorEnum.getLabel() + " User Defined Count exists Form enum", true, exsitingForm);
}
use of org.talend.dataprofiler.core.model.ModelElementIndicator 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.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class AbstractColumnDropTree method reorderModelElement.
/**
* DOC talend Comment method "reorderModelElement".
*
* @param currentModelElementIndicators
*/
public ModelElementIndicator[] reorderModelElement(ModelElementIndicator[] currentModelElementIndicators, Map<String, Integer> columnIndexMap) {
ModelElementIndicator[] sortedModelElements = new ModelElementIndicator[currentModelElementIndicators.length];
for (ModelElementIndicator currModelElement : currentModelElementIndicators) {
String columnName = currModelElement.getElementName();
sortedModelElements[columnIndexMap.get(columnName)] = currModelElement;
}
return sortedModelElements;
}
use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class AbstractColumnDropTree method dropModelElements.
public void dropModelElements(List<? extends IRepositoryNode> repositoryNode, int index) {
int size = repositoryNode.size();
ModelElementIndicator[] meIndicators = new ModelElementIndicator[size];
for (int i = 0; i < size; i++) {
IRepositoryNode repNode = repositoryNode.get(i);
IRepositoryViewObject repViewObj = repNode.getObject();
// TdColumn tdColumn = SwitchHelpers.COLUMN_SWITCH.doSwitch(repViewObj);
if (repNode instanceof DFColumnRepNode) {
meIndicators[i] = ModelElementIndicatorHelper.createDFColumnIndicator(repNode);
} else if (repViewObj != null && repViewObj instanceof MetadataColumnRepositoryObject) {
meIndicators[i] = ModelElementIndicatorHelper.createColumnIndicator(repNode);
}
}
addElements(meIndicators);
}
use of org.talend.dataprofiler.core.model.ModelElementIndicator in project tdq-studio-se by Talend.
the class AnalysisColumnSetTreeViewer method removeItemBranch.
/*
* (non-Javadoc)
*
* @see
* org.talend.dataprofiler.core.ui.editor.composite.AbstractColumnDropTree#removeItemBranch(org.eclipse.swt.widgets
* .TreeItem)
*/
@Override
protected void removeItemBranch(TreeItem item) {
// MOD yyi 2011-03-22 19460: The "remove elements" option on the contextual menu does not work
IndicatorUnit unit = (IndicatorUnit) item.getData(INDICATOR_UNIT_KEY);
ModelElementIndicator meIndicator = (ModelElementIndicator) item.getData(MODELELEMENT_INDICATOR_KEY);
// MOD klliu check the item is column or pattern
if (item.getData(COLUMN_INDICATOR_KEY) != null) {
deleteColumnItems(meIndicator.getModelElementRepositoryNode());
deleteModelElementItems(meIndicator);
masterPage.setCurrentModelElementIndicators(modelElementIndicators);
}
if (null != unit) {
meIndicator.removeIndicatorUnit(unit);
}
super.removeItemBranch(item);
// add msjian TDQ-8860 2014-4-30:check whether show allmatchindicator in the indicators section.
EventManager.getInstance().publish(this.getAnalysis(), EventEnum.DQ_COLUMNSET_SHOW_MATCH_INDICATORS, null);
// TDQ-8860~
// MOD mzhao 2009-06-8, bug 5887.
updateBindConnection(masterPage, tree);
enabledButtons(false);
tree.setFocus();
}
Aggregations