Search in sources :

Example 6 with MatchRule

use of org.talend.dataquality.rules.MatchRule 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 7 with MatchRule

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

the class MatchingKeySection method getMatchRule.

/**
 * DOC zhao Comment method "getMatchRule".
 *
 * @param tabItem
 * @return
 */
protected MatchRule getMatchRule(CTabItem tabItem) {
    MatchRuleTableComposite matchRuleTableComp = (MatchRuleTableComposite) getMatchRuleComposite(tabItem);
    MatchRule matchRule = matchRuleTableComp.getMatchRule();
    return matchRule;
}
Also used : MatchRuleTableComposite(org.talend.dataquality.record.linkage.ui.composite.MatchRuleTableComposite) MatchRule(org.talend.dataquality.rules.MatchRule)

Example 8 with MatchRule

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

the class MatchingKeySection method createMatchRuleByCopy.

// copy a match rule to a new one
private MatchRule createMatchRuleByCopy(MatchRule oldRule) {
    MatchRule newRule = RulesFactory.eINSTANCE.createMatchRule();
    if (oldRule.getMatchKeys() != null && oldRule.getMatchKeys().size() > 0) {
        for (MatchKeyDefinition matchKey : oldRule.getMatchKeys()) {
            newRule.getMatchKeys().add(EcoreUtil.copy(matchKey));
        }
    }
    newRule.setMatchInterval(oldRule.getMatchInterval());
    return newRule;
}
Also used : MatchKeyDefinition(org.talend.dataquality.rules.MatchKeyDefinition) MatchRule(org.talend.dataquality.rules.MatchRule)

Example 9 with MatchRule

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

the class MatchingKeySection method initMatchRuleTabs.

/**
 * DOC zhao Comment method "initMatchRuleTabs".
 */
private void initMatchRuleTabs() {
    List<MatchRule> matchRules = getMatchRuleList();
    for (MatchRule matchRule : matchRules) {
        addRuleTab(false, matchRule);
        tabCount++;
    }
    if (matchRules.isEmpty()) {
        // create one match rule tab when no one exist.
        MatchRule newMatchRule = getNewMatchRule();
        addRuleTab(false, newMatchRule);
        matchRules.add(newMatchRule);
    }
}
Also used : MatchRule(org.talend.dataquality.rules.MatchRule)

Example 10 with MatchRule

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

the class MatchAnalysisDetailsPage method canRun.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataprofiler.core.ui.editor.analysis.AbstractAnalysisMetadataPage#canRun()
     */
@Override
protected ReturnCode canRun() {
    ReturnCode rc = new ReturnCode(Boolean.FALSE);
    // when the user didnot select any columns, can not run
    if (analysisHandler.getAnalyzedColumns() == null || analysisHandler.getAnalyzedColumns().size() < 1) {
        // $NON-NLS-1$
        rc.setMessage(DefaultMessagesImpl.getString("MatchMasterDetailsPage.NoSelectColumn"));
        return rc;
    }
    RecordMatchingIndicator recordMatchingIndicator = MatchRuleAnlaysisUtils.getRecordMatchIndicatorFromAna(getCurrentModelElement());
    EList<MatchRule> matchRules = recordMatchingIndicator.getBuiltInMatchRuleDefinition().getMatchRules();
    if (matchRules.size() > 0) {
        MatchRule matchRule = matchRules.get(0);
        if (matchRule.getMatchKeys().size() > 0) {
            rc.setOk(Boolean.TRUE);
        } else {
            // $NON-NLS-1$
            rc.setMessage(DefaultMessagesImpl.getString("MatchMasterDetailsPage.NoMatchKey"));
        }
    } else {
        // $NON-NLS-1$
        rc.setMessage(DefaultMessagesImpl.getString("MatchMasterDetailsPage.NoMatchKey"));
    }
    if (rc.isOk()) {
        rc = this.particularDefaultSurvivorshipSection.checkResultStatus();
    }
    return rc;
}
Also used : ReturnCode(org.talend.utils.sugars.ReturnCode) MatchRule(org.talend.dataquality.rules.MatchRule) RecordMatchingIndicator(org.talend.dataquality.indicators.columnset.RecordMatchingIndicator)

Aggregations

MatchRule (org.talend.dataquality.rules.MatchRule)29 MatchKeyDefinition (org.talend.dataquality.rules.MatchKeyDefinition)14 ArrayList (java.util.ArrayList)10 MatchRuleDefinition (org.talend.dataquality.rules.MatchRuleDefinition)8 HashMap (java.util.HashMap)7 RecordMatchingIndicator (org.talend.dataquality.indicators.columnset.RecordMatchingIndicator)6 AlgorithmDefinition (org.talend.dataquality.rules.AlgorithmDefinition)6 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)5 BlockKeyDefinition (org.talend.dataquality.rules.BlockKeyDefinition)5 Test (org.junit.Test)4 BlockKeyIndicator (org.talend.dataquality.indicators.columnset.BlockKeyIndicator)4 MatchGroupResultConsumer (org.talend.dataquality.record.linkage.grouping.MatchGroupResultConsumer)4 MatchKeyAndSurvivorDefinition (org.talend.dataquality.record.linkage.ui.composite.tableviewer.definition.MatchKeyAndSurvivorDefinition)4 ExecuteMatchRuleHandler (org.talend.dq.analysis.match.ExecuteMatchRuleHandler)4 CTabItem (org.eclipse.swt.custom.CTabItem)3 MatchKeyAndSurvivorTableComposite (org.talend.dataquality.record.linkage.ui.composite.MatchKeyAndSurvivorTableComposite)3 SurvivorshipKeyDefinition (org.talend.dataquality.rules.SurvivorshipKeyDefinition)3 Map (java.util.Map)2 MatchRuleTableComposite (org.talend.dataquality.record.linkage.ui.composite.MatchRuleTableComposite)2 KeyDefinition (org.talend.dataquality.rules.KeyDefinition)2