Search in sources :

Example 16 with SurvivorshipKeyDefinition

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

the class SurvivorShipTableViewer method createNewKeyDefinition.

/*
     * (non-Javadoc) columnList.toArray(new String[0])
     * 
     * @see org.talend.dataquality.record.linkage.ui.composite.tableviewer.AbstractMatchAnalysisTableViewer#
     * createNewKeyDefinition(java.lang.String)
     */
@Override
protected SurvivorshipKeyDefinition createNewKeyDefinition(String columnName) {
    SurvivorshipKeyDefinition skd = RulesFactory.eINSTANCE.createSurvivorshipKeyDefinition();
    skd.setName(MatchAnalysisConstant.SURVIVORSHIP_KEY_DEFAULT_VALUE);
    skd.setColumn(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 17 with SurvivorshipKeyDefinition

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

the class MatchKeyAndSurvivorshipTableViewer method removeElement.

@Override
public void removeElement(MatchKeyAndSurvivorDefinition msDedefinition, List<MatchKeyAndSurvivorDefinition> matchKeys) {
    Iterator<MatchKeyAndSurvivorDefinition> matchKeyIterator = matchKeys.iterator();
    while (matchKeyIterator.hasNext()) {
        MatchKeyAndSurvivorDefinition keyDef = matchKeyIterator.next();
        if (StringUtils.equals(keyDef.getMatchKey().getName(), msDedefinition.getMatchKey().getName())) {
            super.removeElement(keyDef, matchKeys);
            // link the added MatchKeyAndSurvivorDefinition's match and survivor key with matchRuleDef's matchkey
            // and
            // survivorkey list;
            SurvivorshipKeyDefinition survivorShipKey = msDedefinition.getSurvivorShipKey();
            MatchRuleDefinition matchRuleDef = (MatchRuleDefinition) survivorShipKey.eContainer();
            ((MatchRule) msDedefinition.getMatchKey().eContainer()).getMatchKeys().remove(msDedefinition.getMatchKey());
            matchRuleDef.getSurvivorshipKeys().remove(survivorShipKey);
            break;
        }
    }
}
Also used : SurvivorshipKeyDefinition(org.talend.dataquality.rules.SurvivorshipKeyDefinition) MatchRuleDefinition(org.talend.dataquality.rules.MatchRuleDefinition)

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