use of org.talend.dataquality.rules.AppliedBlockKey in project tdq-studio-se by Talend.
the class AnalysisRecordGroupingUtils method createAppliedBlockKeyByGenKey.
/**
* By default for analysis, the applied blocking key will be the key from key generation definition. This will be
* refined when there is a need to define the applied blocking key manually by user later.
*
* @param recordMatchingIndicator
*/
public static void createAppliedBlockKeyByGenKey(RecordMatchingIndicator recordMatchingIndicator) {
List<AppliedBlockKey> appliedBlockKeys = recordMatchingIndicator.getBuiltInMatchRuleDefinition().getAppliedBlockKeys();
appliedBlockKeys.clear();
List<BlockKeyDefinition> blockKeyDefs = recordMatchingIndicator.getBuiltInMatchRuleDefinition().getBlockKeys();
if (blockKeyDefs != null && blockKeyDefs.size() > 0) {
AppliedBlockKey appliedBlockKey = RulesPackage.eINSTANCE.getRulesFactory().createAppliedBlockKey();
appliedBlockKey.setColumn(PluginConstant.BLOCK_KEY);
appliedBlockKey.setName(PluginConstant.BLOCK_KEY);
appliedBlockKeys.add(appliedBlockKey);
}
}
use of org.talend.dataquality.rules.AppliedBlockKey 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;
}
Aggregations