Search in sources :

Example 1 with BlockingKeyHandler

use of org.talend.dataquality.record.linkage.genkey.BlockingKeyHandler in project tdq-studio-se by Talend.

the class BlockingKeySection method refreshChart.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataquality.record.linkage.ui.section.AbstractMatchTableSection#RefreshChart()
     */
@Override
public void refreshChart() {
    if (getBlockKeyDefinitionList().size() <= 0) {
        MessageDialogWithToggle.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), DefaultMessagesImpl.getString("BlockingKeySection.RefreshChartError"), // $NON-NLS-1$ //$NON-NLS-2$
        DefaultMessagesImpl.getString("BlockingKeySection.NoBlockKey"));
        return;
    }
    ReturnCode checkResultStatus = checkResultStatus();
    if (!checkResultStatus.isOk()) {
        if (checkResultStatus.getMessage() != null && !checkResultStatus.getMessage().equals(StringUtils.EMPTY)) {
            MessageDialogWithToggle.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), DefaultMessagesImpl.getString("BlockingKeySection.RefreshChartError"), // $NON-NLS-1$
            checkResultStatus.getMessage());
        }
        return;
    }
    listeners.firePropertyChange(MatchAnalysisConstant.NEED_REFRESH_DATA, true, false);
    BlockingKeyHandler executeGenerateBlockingAction = computeResult();
    if (executeGenerateBlockingAction.getResultDataList().size() == 0) {
        return;
    }
    blockingKeyDataChart.refresh(executeGenerateBlockingAction.getResultDatas());
    MatchRuleAnlaysisUtils.refreshDataTable(analysis, executeGenerateBlockingAction.getResultDataList());
    executeGenerateBlockingAction.getResultDatas().clear();
}
Also used : ReturnCode(org.talend.utils.sugars.ReturnCode) BlockingKeyHandler(org.talend.dataquality.record.linkage.genkey.BlockingKeyHandler)

Example 2 with BlockingKeyHandler

use of org.talend.dataquality.record.linkage.genkey.BlockingKeyHandler in project tdq-studio-se by Talend.

the class ExecuteMatchRuleHandler method computeBlockingKey.

private Map<String, List<String[]>> computeBlockingKey(Map<MetadataColumn, String> columnMap, List<Object[]> matchRows, RecordMatchingIndicator recordMatchingIndicator) {
    List<Map<String, String>> blockKeySchema = AnalysisRecordGroupingUtils.getBlockKeySchema(recordMatchingIndicator);
    for (MetadataColumn metaCol : columnMap.keySet()) {
        if (metaCol.getName() == null) {
            colName2IndexMap.put(metaCol.getLabel(), columnMap.get(metaCol));
        } else {
            colName2IndexMap.put(metaCol.getName(), columnMap.get(metaCol));
        }
    }
    BlockingKeyHandler blockKeyHandler = new BlockingKeyHandler(blockKeySchema, colName2IndexMap);
    blockKeyHandler.setInputData(matchRows);
    // Added TDQ-14276: need to add the column date pattern map (for most recent/ancient function)
    Map<String, String> patternMap = AnalysisRecordGroupingUtils.createColumnDatePatternMap(columnMap, colName2IndexMap);
    blockKeyHandler.setColumnDatePatternMap(patternMap);
    blockKeyHandler.run();
    Map<String, List<String[]>> resultData = blockKeyHandler.getResultDatas();
    return resultData;
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) TreeMap(java.util.TreeMap) Map(java.util.Map) BlockingKeyHandler(org.talend.dataquality.record.linkage.genkey.BlockingKeyHandler)

Example 3 with BlockingKeyHandler

use of org.talend.dataquality.record.linkage.genkey.BlockingKeyHandler 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;
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) BlockKeyDefinition(org.talend.dataquality.rules.BlockKeyDefinition) KeyDefinition(org.talend.dataquality.rules.KeyDefinition) BlockingKeyHandler(org.talend.dataquality.record.linkage.genkey.BlockingKeyHandler)

Aggregations

BlockingKeyHandler (org.talend.dataquality.record.linkage.genkey.BlockingKeyHandler)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 TreeMap (java.util.TreeMap)1 BlockKeyDefinition (org.talend.dataquality.rules.BlockKeyDefinition)1 KeyDefinition (org.talend.dataquality.rules.KeyDefinition)1 ReturnCode (org.talend.utils.sugars.ReturnCode)1