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);
}
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());
}
}
}
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);
}
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;
}
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);
}
Aggregations