Search in sources :

Example 6 with SurvivorshipKeyDefinition

use of org.talend.dataquality.rules.SurvivorshipKeyDefinition in project tdq-studio-se by Talend.

the class SurvivorshipDefinitionSection method createSubContent.

@Override
protected Composite createSubContent(Composite sectionClient) {
    Composite ruleComp = toolkit.createComposite(sectionClient, SWT.NONE);
    GridData data = new GridData(GridData.FILL_BOTH);
    ruleComp.setLayoutData(data);
    GridLayout gridLayout = new GridLayout(1, true);
    gridLayout.marginWidth = 0;
    gridLayout.marginHeight = 0;
    ruleComp.setLayout(gridLayout);
    tableComposite = new SurvivorshipTableComposite(ruleComp, SWT.NO_FOCUS);
    tableComposite.addPropertyChangeListener(this);
    tableComposite.setLayout(gridLayout);
    tableComposite.setLayoutData(data);
    tableComposite.createContent();
    section.setExpanded(true);
    tableComposite.serViewerSorter(new KeyDefinitionTableViewerSorter<SurvivorshipKeyDefinition>(this.matchRuleDef.getSurvivorshipKeys()));
    initTableInput();
    return ruleComp;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) SurvivorshipTableComposite(org.talend.dataquality.record.linkage.ui.composite.SurvivorshipTableComposite) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) SurvivorshipKeyDefinition(org.talend.dataquality.rules.SurvivorshipKeyDefinition) SurvivorshipTableComposite(org.talend.dataquality.record.linkage.ui.composite.SurvivorshipTableComposite)

Example 7 with SurvivorshipKeyDefinition

use of org.talend.dataquality.rules.SurvivorshipKeyDefinition in project tdq-studio-se by Talend.

the class SurvivorshipDefinitionSection method moveUpTableItem.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataquality.record.linkage.ui.section.AbstractMatchAnaysisTableSection#moveDownTableItem()
     */
@Override
public void moveUpTableItem() {
    ISelection selectItems = tableComposite.getSelectItems();
    if (selectItems instanceof StructuredSelection) {
        if (selectItems.isEmpty()) {
            return;
        }
        List<SurvivorshipKeyDefinition> currentElements = this.matchRuleDef.getSurvivorshipKeys();
        List<SurvivorshipKeyDefinition> survivorshipKeyDefinitionlist = ((StructuredSelection) selectItems).toList();
        for (int index = 0; index < survivorshipKeyDefinitionlist.size(); index++) {
            if (!isSameWithCurrentModel(currentElements.get(index), survivorshipKeyDefinitionlist.get(index))) {
                continue;
            }
            SurvivorshipKeyDefinition next = survivorshipKeyDefinitionlist.get(index);
            tableComposite.moveUpKeyDefinition(next, currentElements);
        }
        tableComposite.selectAllItem(((StructuredSelection) selectItems).toList());
    }
}
Also used : ISelection(org.eclipse.jface.viewers.ISelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) SurvivorshipKeyDefinition(org.talend.dataquality.rules.SurvivorshipKeyDefinition)

Example 8 with SurvivorshipKeyDefinition

use of org.talend.dataquality.rules.SurvivorshipKeyDefinition in project tdq-studio-se by Talend.

the class SurvivorshipDefinitionSection method removeTableItem.

@Override
public void removeTableItem() {
    boolean success = false;
    ISelection selectItems = tableComposite.getSelectItems();
    if (selectItems instanceof StructuredSelection) {
        Iterator<SurvivorshipKeyDefinition> iterator = ((StructuredSelection) selectItems).iterator();
        while (iterator.hasNext()) {
            SurvivorshipKeyDefinition next = iterator.next();
            tableComposite.removeKeyDefinition(next, matchRuleDef.getSurvivorshipKeys());
            success = true;
        }
        if (success) {
            listeners.firePropertyChange(MatchAnalysisConstant.ISDIRTY_PROPERTY, true, false);
        }
    }
}
Also used : ISelection(org.eclipse.jface.viewers.ISelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) SurvivorshipKeyDefinition(org.talend.dataquality.rules.SurvivorshipKeyDefinition)

Example 9 with SurvivorshipKeyDefinition

use of org.talend.dataquality.rules.SurvivorshipKeyDefinition in project tdq-studio-se by Talend.

the class MatchKeyAndSurvivorshipTableViewer method createNewSurvivorshipKeyDefinition.

private SurvivorshipKeyDefinition createNewSurvivorshipKeyDefinition(String columnName) {
    SurvivorshipKeyDefinition skd = RulesFactory.eINSTANCE.createSurvivorshipKeyDefinition();
    skd.setName(columnName);
    AlgorithmDefinition createAlgorithmDefinition = RulesFactory.eINSTANCE.createAlgorithmDefinition();
    createAlgorithmDefinition.setAlgorithmType(SurvivorShipAlgorithmEnum.getTypeByIndex(3).getComponentValueName());
    skd.setFunction(createAlgorithmDefinition);
    skd.setAllowManualResolution(true);
    return skd;
}
Also used : SurvivorshipKeyDefinition(org.talend.dataquality.rules.SurvivorshipKeyDefinition) AlgorithmDefinition(org.talend.dataquality.rules.AlgorithmDefinition)

Example 10 with SurvivorshipKeyDefinition

use of org.talend.dataquality.rules.SurvivorshipKeyDefinition in project tdq-studio-se by Talend.

the class MatchKeyAndSurvivorshipTableViewer method createNewKeyDefinition.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.dataquality.record.linkage.ui.composite.tableviewer.definition.MatchKeyAndSurvivorshipTableViewer#
     * createNewKeyDefinition(java.lang.String)
     */
@Override
protected MatchKeyAndSurvivorDefinition createNewKeyDefinition(String columnName) {
    MatchKeyDefinition matchKeyDefinition = MatchRuleAnlaysisUtils.createDefaultMatchRow(columnName);
    SurvivorshipKeyDefinition survivorshipKeyDefinition = createNewSurvivorshipKeyDefinition(columnName);
    MatchKeyAndSurvivorDefinition matchKeySurvDef = new MatchKeyAndSurvivorDefinition();
    matchKeySurvDef.setMatchKey(matchKeyDefinition);
    matchKeySurvDef.setSurvivorShipKey(survivorshipKeyDefinition);
    matchRule.getMatchKeys().add(matchKeySurvDef.getMatchKey());
    ((MatchRuleDefinition) matchRule.eContainer()).getSurvivorshipKeys().add(matchKeySurvDef.getSurvivorShipKey());
    return matchKeySurvDef;
}
Also used : MatchKeyDefinition(org.talend.dataquality.rules.MatchKeyDefinition) SurvivorshipKeyDefinition(org.talend.dataquality.rules.SurvivorshipKeyDefinition)

Aggregations

SurvivorshipKeyDefinition (org.talend.dataquality.rules.SurvivorshipKeyDefinition)17 AlgorithmDefinition (org.talend.dataquality.rules.AlgorithmDefinition)4 ArrayList (java.util.ArrayList)3 ISelection (org.eclipse.jface.viewers.ISelection)3 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)3 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)2 SurvivorShipAlgorithmParams (org.talend.dataquality.record.linkage.grouping.swoosh.SurvivorShipAlgorithmParams)2 SurvivorshipFunction (org.talend.dataquality.record.linkage.grouping.swoosh.SurvivorShipAlgorithmParams.SurvivorshipFunction)2 MatchKeyDefinition (org.talend.dataquality.rules.MatchKeyDefinition)2 MatchRuleDefinition (org.talend.dataquality.rules.MatchRuleDefinition)2 ReturnCode (org.talend.utils.sugars.ReturnCode)2 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 EList (org.eclipse.emf.common.util.EList)1 CTabItem (org.eclipse.swt.custom.CTabItem)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 TableItem (org.eclipse.swt.widgets.TableItem)1