Search in sources :

Example 11 with ModelElementIndicator

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);
}
Also used : IndicatorDefinition(org.talend.dataquality.indicators.definition.IndicatorDefinition) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) Indicator(org.talend.dataquality.indicators.Indicator) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) Test(org.junit.Test)

Example 12 with ModelElementIndicator

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);
}
Also used : TDQIndicatorDefinitionItem(org.talend.dataquality.properties.TDQIndicatorDefinitionItem) BenfordLawFrequencyIndicator(org.talend.dataquality.indicators.BenfordLawFrequencyIndicator) ColumnIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ArrayList(java.util.ArrayList) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ColumnIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) Before(org.junit.Before)

Example 13 with ModelElementIndicator

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;
}
Also used : ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 14 with ModelElementIndicator

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);
}
Also used : DFColumnRepNode(org.talend.dq.nodes.DFColumnRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 15 with ModelElementIndicator

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();
}
Also used : IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Aggregations

ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)58 IRepositoryNode (org.talend.repository.model.IRepositoryNode)22 ArrayList (java.util.ArrayList)16 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)16 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)16 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)15 Indicator (org.talend.dataquality.indicators.Indicator)13 IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)12 TreeItem (org.eclipse.swt.widgets.TreeItem)11 RepositoryNode (org.talend.repository.model.RepositoryNode)10 IndicatorEnum (org.talend.dq.nodes.indicator.type.IndicatorEnum)9 MetadataXmlElementTypeRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataXmlElementTypeRepositoryObject)7 Connection (org.talend.core.model.metadata.builder.connection.Connection)6 CompositeIndicator (org.talend.dataquality.indicators.CompositeIndicator)6 MetadataTableRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject)5 TreeEditor (org.eclipse.swt.custom.TreeEditor)4 MouseAdapter (org.eclipse.swt.events.MouseAdapter)4 MouseEvent (org.eclipse.swt.events.MouseEvent)4 Composite (org.eclipse.swt.widgets.Composite)4 Label (org.eclipse.swt.widgets.Label)4