Search in sources :

Example 31 with MatchRuleDefinition

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

the class MatchRuleElementTreeSelectionDialog method getBlockingKeysFromNodes.

public List<Map<String, String>> getBlockingKeysFromNodes(Object[] nodes, boolean retrieveDisplayValue) {
    List<Map<String, String>> ruleValues = new ArrayList<Map<String, String>>();
    for (Object rule : nodes) {
        if (rule instanceof RuleRepNode) {
            RuleRepNode node = (RuleRepNode) rule;
            MatchRuleDefinition matchRuleDefinition = (MatchRuleDefinition) node.getRule();
            ruleValues.addAll(getBlockingKeysFromRules(matchRuleDefinition, retrieveDisplayValue));
        }
    }
    return ruleValues;
}
Also used : ArrayList(java.util.ArrayList) MatchRuleDefinition(org.talend.dataquality.rules.MatchRuleDefinition) RuleRepNode(org.talend.dq.nodes.RuleRepNode) Map(java.util.Map) HashMap(java.util.HashMap)

Example 32 with MatchRuleDefinition

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

the class NewMatchRuleWizard method initCWMResourceBuilder.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataprofiler.core.ui.wizard.ICWMResouceAdapter#initCWMResourceBuilder()
     */
public ModelElement initCWMResourceBuilder() {
    if (matchRule != null) {
        MatchRuleDefinition copiedMatchRuleDefinition = EcoreUtil.copy(matchRule);
        copiedMatchRuleDefinition.setName(parameter.getName());
        return copiedMatchRuleDefinition;
    }
    MatchRuleBuilder ruleBuilder = new MatchRuleBuilder();
    boolean ruleInitialized = ruleBuilder.initializeDqRuleBuilder(parameter);
    if (ruleInitialized) {
        return ruleBuilder.getMatchRule();
    }
    return null;
}
Also used : MatchRuleBuilder(org.talend.dq.dqrule.MatchRuleBuilder) MatchRuleDefinition(org.talend.dataquality.rules.MatchRuleDefinition)

Example 33 with MatchRuleDefinition

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

the class NewMatchRuleWizard method createAndSaveCWMFile.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataprofiler.core.ui.wizard.ICWMResouceAdapter#createAndSaveCWMFile(orgomg.cwm.objectmodel.core.
     * ModelElement)
     */
public TypedReturnCode<Object> createAndSaveCWMFile(ModelElement repositoryObject) {
    MatchRuleDefinition newMatchRule = (MatchRuleDefinition) repositoryObject;
    TaggedValueHelper.setValidStatus(true, newMatchRule);
    // Added for export an match rule created by the match analysis, which need to replace the rules in createdItem,
    MatchRuleDefinitionWriter matchRuleWriter = ElementWriterFactory.getInstance().createdMatchRuleWriter();
    if (isExport) {
        matchRuleWriter.copy(newMatchRule, this.matchRule);
    }
    IFolder folder = parameter.getFolderProvider().getFolderResource();
    TypedReturnCode<Object> createdItem = matchRuleWriter.create(newMatchRule, folder);
    return createdItem;
}
Also used : MatchRuleDefinition(org.talend.dataquality.rules.MatchRuleDefinition) MatchRuleDefinitionWriter(org.talend.dq.writer.impl.MatchRuleDefinitionWriter) IFolder(org.eclipse.core.resources.IFolder)

Example 34 with MatchRuleDefinition

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

the class TDQMatchRuleItemImpl method setMatchRule.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setMatchRule(MatchRuleDefinition newMatchRule) {
    MatchRuleDefinition oldMatchRule = matchRule;
    matchRule = newMatchRule;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, PropertiesPackage.TDQ_MATCH_RULE_ITEM__MATCH_RULE, oldMatchRule, matchRule));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) MatchRuleDefinition(org.talend.dataquality.rules.MatchRuleDefinition)

Example 35 with MatchRuleDefinition

use of org.talend.dataquality.rules.MatchRuleDefinition in project tmdm-studio-se by Talend.

the class AbstractDeployAction method filterMatchRuleObjs.

// remove match rule and add associated model objects
protected void filterMatchRuleObjs(List<IRepositoryViewObject> viewObjs) {
    for (Object obj : viewObjs.toArray()) {
        if (obj instanceof IRepositoryViewObject) {
            IRepositoryViewObject viewObject = (IRepositoryViewObject) obj;
            Item item = viewObject.getProperty().getItem();
            if (item instanceof TDQMatchRuleItem) {
                MatchRuleDefinition matchRule = ((TDQMatchRuleItem) item).getMatchRule();
                String name = matchRule.getName();
                if (getMapInfoService() != null) {
                    List<IRepositoryViewObject> dataModels = service.findReferencedDataModels(name);
                    viewObjs.remove(obj);
                    for (IRepositoryViewObject modelObj : dataModels) {
                        if (!viewObjs.contains(modelObj)) {
                            viewObjs.add(modelObj);
                        }
                    }
                }
            }
        }
    }
}
Also used : TDQMatchRuleItem(org.talend.dataquality.properties.TDQMatchRuleItem) Item(org.talend.core.model.properties.Item) TDQMatchRuleItem(org.talend.dataquality.properties.TDQMatchRuleItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MatchRuleDefinition(org.talend.dataquality.rules.MatchRuleDefinition)

Aggregations

MatchRuleDefinition (org.talend.dataquality.rules.MatchRuleDefinition)35 ArrayList (java.util.ArrayList)10 HashMap (java.util.HashMap)9 RecordMatchingIndicator (org.talend.dataquality.indicators.columnset.RecordMatchingIndicator)8 MatchRule (org.talend.dataquality.rules.MatchRule)8 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)6 AlgorithmDefinition (org.talend.dataquality.rules.AlgorithmDefinition)6 MatchKeyDefinition (org.talend.dataquality.rules.MatchKeyDefinition)6 RuleRepNode (org.talend.dq.nodes.RuleRepNode)6 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)6 Test (org.junit.Test)5 Analysis (org.talend.dataquality.analysis.Analysis)5 MatchGroupResultConsumer (org.talend.dataquality.record.linkage.grouping.MatchGroupResultConsumer)5 Map (java.util.Map)4 IFile (org.eclipse.core.resources.IFile)4 BlockKeyIndicator (org.talend.dataquality.indicators.columnset.BlockKeyIndicator)4 TDQMatchRuleItem (org.talend.dataquality.properties.TDQMatchRuleItem)4 ExecuteMatchRuleHandler (org.talend.dq.analysis.match.ExecuteMatchRuleHandler)4 IFolder (org.eclipse.core.resources.IFolder)3 BlockKeyDefinition (org.talend.dataquality.rules.BlockKeyDefinition)3