use of org.talend.dataquality.rules.KeyDefinition in project tdq-studio-se by Talend.
the class BlockingKeySection method isKeyDefinitionAdded.
/*
* (non-Javadoc)
*
* @see
* org.talend.dataquality.record.linkage.ui.section.AbstractMatchAnaysisTableSection#isKeyDefinitionAdded(java.lang
* .String)
*/
@Override
public Boolean isKeyDefinitionAdded(String columnName) {
Boolean isAdded = Boolean.FALSE;
RecordMatchingIndicator recordMatchingIndicator = MatchRuleAnlaysisUtils.getRecordMatchIndicatorFromAna(analysis);
List<BlockKeyDefinition> keyDefs = recordMatchingIndicator.getBuiltInMatchRuleDefinition().getBlockKeys();
for (KeyDefinition keyDef : keyDefs) {
// the key's name can NOT be same, the column can be same
if (StringUtils.equals(columnName, keyDef.getName())) {
isAdded = Boolean.TRUE;
break;
}
}
return isAdded;
}
use of org.talend.dataquality.rules.KeyDefinition in project tdq-studio-se by Talend.
the class BlockingKeySection method getSelectedColumnAsBlockKeys.
/**
* get all columns which is selected as blocking key
*
* @return
*/
public List<String> getSelectedColumnAsBlockKeys() {
List<String> keyColumns = new ArrayList<String>();
RecordMatchingIndicator recordMatchingIndicator = MatchRuleAnlaysisUtils.getRecordMatchIndicatorFromAna(analysis);
List<BlockKeyDefinition> keyDefs = recordMatchingIndicator.getBuiltInMatchRuleDefinition().getBlockKeys();
if (keyDefs.size() > 0) {
for (KeyDefinition keydef : keyDefs) {
keyColumns.add(keydef.getColumn());
}
}
return keyColumns;
}
use of org.talend.dataquality.rules.KeyDefinition in project tdq-studio-se by Talend.
the class AnalysisRecordGroupingUtils method getBlockKeySchema.
/**
* mzhao Get block key schema given the record matching indicator.
*
* @param recordMatchingIndicator
* @return
*/
public static List<Map<String, String>> getBlockKeySchema(RecordMatchingIndicator recordMatchingIndicator) {
List<AppliedBlockKey> appliedBlockKeys = recordMatchingIndicator.getBuiltInMatchRuleDefinition().getAppliedBlockKeys();
List<Map<String, String>> blockKeySchema = new ArrayList<Map<String, String>>();
for (KeyDefinition keyDef : appliedBlockKeys) {
AppliedBlockKey appliedKeyDefinition = (AppliedBlockKey) keyDef;
String column = appliedKeyDefinition.getColumn();
if (StringUtils.equals(PluginConstant.BLOCK_KEY, column)) {
// If there exist customized block key defined, get the key
// parameters.
List<BlockKeyDefinition> blockKeyDefs = recordMatchingIndicator.getBuiltInMatchRuleDefinition().getBlockKeys();
for (BlockKeyDefinition blockKeyDef : blockKeyDefs) {
Map<String, String> blockKeyDefMap = new HashMap<String, String>();
blockKeyDefMap.putAll(getCustomizedBlockKeyParameter(blockKeyDef, blockKeyDef.getColumn()));
blockKeySchema.add(blockKeyDefMap);
}
} else {
Map<String, String> blockKeyDefMap = new HashMap<String, String>();
blockKeyDefMap.put(MatchAnalysisConstant.PRECOLUMN, column);
blockKeySchema.add(blockKeyDefMap);
}
}
return blockKeySchema;
}
use of org.talend.dataquality.rules.KeyDefinition in project tdq-studio-se by Talend.
the class BlockingKeySection method computeResult.
/**
* DOC zshen Comment method "computeRusult". <br>
* TODO Handle the return value: return the result directly instead of action instance.
*
* @return
*/
protected BlockingKeyHandler computeResult() {
List<Map<String, String>> blockingKeyData = MatchRuleAnlaysisUtils.blockingKeyDataConvert((List<KeyDefinition>) tableComposite.getInput());
Map<String, String> colName2IndexMap = new HashMap<String, String>();
for (MetadataColumn metaCol : columnMap.keySet()) {
colName2IndexMap.put(metaCol.getName(), columnMap.get(metaCol));
}
BlockingKeyHandler executeGenerateBlockingAction = new BlockingKeyHandler(blockingKeyData, colName2IndexMap);
if (hasBlockingKey()) {
executeGenerateBlockingAction.setInputData(matchRows);
executeGenerateBlockingAction.run();
}
return executeGenerateBlockingAction;
}
use of org.talend.dataquality.rules.KeyDefinition in project tdq-studio-se by Talend.
the class MatchingKeySection method isKeyDefinitionAdded.
/*
* The policy of comparing the key's name is: case INsensitive
*
* @see org.talend.dataquality.record.linkage.ui.section.AbstractMatchAnaysisTableSection#isKeyDefinitionAdded()
*/
@Override
public Boolean isKeyDefinitionAdded(String colummName) throws Exception {
Boolean isAddded = Boolean.FALSE;
MatchRule matchRule = getCurrentMatchRule();
for (KeyDefinition keyDef : matchRule.getMatchKeys()) {
if (StringUtils.equals(colummName, keyDef.getColumn())) {
isAddded = Boolean.TRUE;
break;
}
}
return isAddded;
}
Aggregations