Search in sources :

Example 1 with MatchKeyAndSurvivorDefinition

use of org.talend.dataquality.record.linkage.ui.composite.tableviewer.definition.MatchKeyAndSurvivorDefinition in project tdq-studio-se by Talend.

the class AnaMatchSurvivorSection method createMatchAndSurvivorKey.

/**
 * DOC yyin Comment method "createMatchAndSurvivorKey".
 *
 * @param matchKey
 * @param isClearSurvivor
 * @param isClearSurvivor
 * @param index
 */
private void createMatchAndSurvivorKey(MatchKeyDefinition matchKey, boolean isClearSurvivor, List<MatchKeyAndSurvivorDefinition> matchAndSurvivorKeyList) {
    MatchKeyAndSurvivorDefinition mAnds = new MatchKeyAndSurvivorDefinition();
    mAnds.setMatchKey(matchKey);
    // create a new survivor key
    updateSurvivorKey(isClearSurvivor, matchKey.getName(), mAnds);
    matchAndSurvivorKeyList.add(mAnds);
}
Also used : MatchKeyAndSurvivorDefinition(org.talend.dataquality.record.linkage.ui.composite.tableviewer.definition.MatchKeyAndSurvivorDefinition)

Example 2 with MatchKeyAndSurvivorDefinition

use of org.talend.dataquality.record.linkage.ui.composite.tableviewer.definition.MatchKeyAndSurvivorDefinition in project tdq-studio-se by Talend.

the class AnaMatchSurvivorSection method checkAndRemoveEmptyMatchRule.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.dataquality.record.linkage.ui.section.MatchingKeySection#checkAndRemoveEmptyMatchRule(org.eclipse.
     * swt.custom.CTabItem)
     */
@Override
protected void checkAndRemoveEmptyMatchRule(CTabItem theTab) {
    MatchRule matchRule = getMatchRule(theTab);
    List<MatchKeyAndSurvivorDefinition> matchAndSurvDefList = matchRuleWithSurvMap.get(matchRule);
    if (matchAndSurvDefList.size() <= 0) {
        MatchRuleDefinition matchRuleDefinition = getMatchRuleDefinition();
        matchRuleDefinition.getMatchRules().remove(matchRule);
        for (MatchKeyAndSurvivorDefinition matchAndSurvDef : matchAndSurvDefList) {
            matchRuleDefinition.getSurvivorshipKeys().remove(matchAndSurvDef.getSurvivorShipKey());
        }
    }
}
Also used : MatchRuleDefinition(org.talend.dataquality.rules.MatchRuleDefinition) MatchRule(org.talend.dataquality.rules.MatchRule) MatchKeyAndSurvivorDefinition(org.talend.dataquality.record.linkage.ui.composite.tableviewer.definition.MatchKeyAndSurvivorDefinition)

Example 3 with MatchKeyAndSurvivorDefinition

use of org.talend.dataquality.record.linkage.ui.composite.tableviewer.definition.MatchKeyAndSurvivorDefinition in project tdq-studio-se by Talend.

the class AnaMatchSurvivorSection method removeMatchKeyFromCurrentMatchRule.

@Override
public void removeMatchKeyFromCurrentMatchRule(String column) {
    MatchKeyAndSurvivorTableComposite matchRuleTableComp = (MatchKeyAndSurvivorTableComposite) getCurrentMatchRuleTableComposite();
    MatchRule matchRule = matchRuleTableComp.getMatchRule();
    List<MatchKeyAndSurvivorDefinition> matchAndSurvDefList = matchRuleWithSurvMap.get(matchRule);
    matchRuleTableComp.removeKeyDefinition(column, matchAndSurvDefList);
}
Also used : MatchKeyAndSurvivorTableComposite(org.talend.dataquality.record.linkage.ui.composite.MatchKeyAndSurvivorTableComposite) MatchRule(org.talend.dataquality.rules.MatchRule) MatchKeyAndSurvivorDefinition(org.talend.dataquality.record.linkage.ui.composite.tableviewer.definition.MatchKeyAndSurvivorDefinition)

Example 4 with MatchKeyAndSurvivorDefinition

use of org.talend.dataquality.record.linkage.ui.composite.tableviewer.definition.MatchKeyAndSurvivorDefinition in project tdq-studio-se by Talend.

the class AnaMatchSurvivorSection method generateSurvivorKeyByMatchKey.

protected List<MatchKeyAndSurvivorDefinition> generateSurvivorKeyByMatchKey(MatchRule matchRule, boolean isMustCreateSurvivor) {
    List<MatchKeyAndSurvivorDefinition> matchAndSurvivorKeyList = matchRuleWithSurvMap.get(matchRule);
    if (matchAndSurvivorKeyList == null) {
        matchAndSurvivorKeyList = new ArrayList<MatchKeyAndSurvivorDefinition>();
        matchRuleWithSurvMap.put(matchRule, matchAndSurvivorKeyList);
    }
    EList<MatchKeyDefinition> matchKeys = matchRule.getMatchKeys();
    int index = 0;
    for (MatchKeyDefinition matchKey : matchKeys) {
        // first, find the current matchKey in MatchAndSurvivorKeyList
        if (matchAndSurvivorKeyList.size() > index) {
            MatchKeyAndSurvivorDefinition definition = matchAndSurvivorKeyList.get(index);
            // check if the position of the match key moved or not
            if (StringUtils.equals(matchKey.getName(), definition.getMatchKey().getName())) {
                // update the current match key
                definition.setMatchKey(matchKey);
                updateSurvivorKey(isMustCreateSurvivor, matchKey.getName(), definition);
            } else {
                // the position of the current match key moved, need to find its related mAndS key in list,
                MatchKeyAndSurvivorDefinition oldDefinition = findPositionOfCurrentMatchkey(matchKey, matchAndSurvivorKeyList);
                // if can't find, means that it is a new one
                if (oldDefinition == null) {
                    createMatchAndSurvivorKey(matchKey, isMustCreateSurvivor, matchAndSurvivorKeyList);
                } else {
                    // delete the old definition in current list
                    matchAndSurvivorKeyList.remove(oldDefinition);
                    // set new match key to it
                    oldDefinition.setMatchKey(matchKey);
                    updateSurvivorKey(isMustCreateSurvivor, matchKey.getName(), oldDefinition);
                    // insert it in the new position
                    matchAndSurvivorKeyList.add(index, oldDefinition);
                }
            }
        } else {
            // need to create a MatchAndSurvivorKey
            createMatchAndSurvivorKey(matchKey, isMustCreateSurvivor, matchAndSurvivorKeyList);
        }
        index++;
    }
    return matchAndSurvivorKeyList;
}
Also used : MatchKeyDefinition(org.talend.dataquality.rules.MatchKeyDefinition) MatchKeyAndSurvivorDefinition(org.talend.dataquality.record.linkage.ui.composite.tableviewer.definition.MatchKeyAndSurvivorDefinition)

Example 5 with MatchKeyAndSurvivorDefinition

use of org.talend.dataquality.record.linkage.ui.composite.tableviewer.definition.MatchKeyAndSurvivorDefinition in project tdq-studio-se by Talend.

the class AnaMatchSurvivorSection method remoteKeyDefinition.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataquality.record.linkage.ui.section.MatchingKeySection#remoteKeyDefinition(java.lang.String,
     * org.eclipse.swt.custom.CTabItem)
     */
@Override
protected void remoteKeyDefinition(String column, CTabItem oneTab) {
    MatchKeyAndSurvivorTableComposite matchRuleTableComp = (MatchKeyAndSurvivorTableComposite) getMatchRuleComposite(oneTab);
    List<MatchKeyAndSurvivorDefinition> matchAndSurvDefList = matchRuleWithSurvMap.get(getMatchRule(oneTab));
    matchRuleTableComp.removeKeyDefinition(column, matchAndSurvDefList);
}
Also used : MatchKeyAndSurvivorTableComposite(org.talend.dataquality.record.linkage.ui.composite.MatchKeyAndSurvivorTableComposite) MatchKeyAndSurvivorDefinition(org.talend.dataquality.record.linkage.ui.composite.tableviewer.definition.MatchKeyAndSurvivorDefinition)

Aggregations

MatchKeyAndSurvivorDefinition (org.talend.dataquality.record.linkage.ui.composite.tableviewer.definition.MatchKeyAndSurvivorDefinition)10 MatchKeyAndSurvivorTableComposite (org.talend.dataquality.record.linkage.ui.composite.MatchKeyAndSurvivorTableComposite)4 MatchRule (org.talend.dataquality.rules.MatchRule)4 MatchKeyDefinition (org.talend.dataquality.rules.MatchKeyDefinition)2 MatchRuleDefinition (org.talend.dataquality.rules.MatchRuleDefinition)2 ISelection (org.eclipse.jface.viewers.ISelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 TableItem (org.eclipse.swt.widgets.TableItem)1 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)1 AttributeMatcherType (org.talend.dataquality.record.linkage.constant.AttributeMatcherType)1 TokenizedResolutionMethod (org.talend.dataquality.record.linkage.constant.TokenizedResolutionMethod)1 HandleNullEnum (org.talend.dataquality.record.linkage.utils.HandleNullEnum)1 SurvivorShipAlgorithmEnum (org.talend.dataquality.record.linkage.utils.SurvivorShipAlgorithmEnum)1