Search in sources :

Example 6 with ParticularDefaultSurvivorshipDefinitions

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

the class ParticularDefaultSurvivorShipCellModifier method modify.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object, java.lang.String, java.lang.Object)
     */
@Override
public void modify(Object element, String property, Object value) {
    if (element instanceof TableItem) {
        ParticularDefaultSurvivorshipDefinitions pdskd = (ParticularDefaultSurvivorshipDefinitions) ((TableItem) element).getData();
        String newValue = String.valueOf(value);
        if (MatchAnalysisConstant.PRECOLUMN.equalsIgnoreCase(property)) {
            if (Integer.parseInt(newValue) == -1) {
                return;
            }
            MetadataColumn metadataColumn = columnList.get(Integer.parseInt(newValue));
            String columnName = metadataColumn.getName();
            if (StringUtils.equals(pdskd.getColumn(), columnName)) {
                return;
            }
            pdskd.setColumn(columnName);
            pdskd.setDataType(metadataColumn.getTalendType());
            if (isFunctionInvalid(pdskd, metadataColumn.getTalendType())) {
                resetFunction(pdskd);
            }
        } else if (MatchAnalysisConstant.FUNCTION.equalsIgnoreCase(property)) {
            SurvivorShipAlgorithmEnum valueByIndex = SurvivorShipAlgorithmEnum.getTypeByIndex(Integer.valueOf(newValue).intValue());
            if (StringUtils.equals(pdskd.getFunction().getAlgorithmType(), valueByIndex.getComponentValueName())) {
                return;
            }
            setFunction(pdskd, valueByIndex);
        } else if (MatchAnalysisConstant.PARAMETER.equalsIgnoreCase(property)) {
            pdskd.getFunction().setAlgorithmParameters(newValue);
        } else {
            return;
        }
        tableViewer.update(pdskd, null);
    }
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) ParticularDefaultSurvivorshipDefinitions(org.talend.dataquality.rules.ParticularDefaultSurvivorshipDefinitions) TableItem(org.eclipse.swt.widgets.TableItem) SurvivorShipAlgorithmEnum(org.talend.dataquality.record.linkage.utils.SurvivorShipAlgorithmEnum)

Example 7 with ParticularDefaultSurvivorshipDefinitions

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

the class ParticularDefaultSurvivorShipTableViewer method removeElement.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.dataquality.record.linkage.ui.composite.tableviewer.AbstractMatchAnalysisTableViewer#removeElement(java.lang
     * .Object, java.util.List)
     */
@Override
public void removeElement(ParticularDefaultSurvivorshipDefinitions keyPDef, List<ParticularDefaultSurvivorshipDefinitions> keyList) {
    if (!keyList.remove(keyPDef)) {
        Iterator<ParticularDefaultSurvivorshipDefinitions> keyIterator = keyList.iterator();
        while (keyIterator.hasNext()) {
            ParticularDefaultSurvivorshipDefinitions tmpKeyDef = keyIterator.next();
            if (StringUtils.equals(keyPDef.getColumn(), tmpKeyDef.getColumn())) {
                keyList.remove(keyPDef);
                // Update table view.
                remove(keyPDef);
                break;
            }
        }
    } else {
        remove(keyPDef);
    }
}
Also used : ParticularDefaultSurvivorshipDefinitions(org.talend.dataquality.rules.ParticularDefaultSurvivorshipDefinitions)

Example 8 with ParticularDefaultSurvivorshipDefinitions

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

the class ParticularDefaultSurvivorShipTableViewer method createNewKeyDefinition.

@Override
protected ParticularDefaultSurvivorshipDefinitions createNewKeyDefinition(String columnName) {
    ParticularDefaultSurvivorshipDefinitions pskd = RulesFactory.eINSTANCE.createParticularDefaultSurvivorshipDefinitions();
    AlgorithmDefinition createAlgorithmDefinition = RulesFactory.eINSTANCE.createAlgorithmDefinition();
    createAlgorithmDefinition.setAlgorithmType(SurvivorShipAlgorithmEnum.getTypeByIndex(3).getComponentValueName());
    pskd.setFunction(createAlgorithmDefinition);
    return pskd;
}
Also used : ParticularDefaultSurvivorshipDefinitions(org.talend.dataquality.rules.ParticularDefaultSurvivorshipDefinitions) AlgorithmDefinition(org.talend.dataquality.rules.AlgorithmDefinition)

Example 9 with ParticularDefaultSurvivorshipDefinitions

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

the class ParticularDefaultSurvivorShipDefinitionCellModifier method modify.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.dataquality.record.linkage.ui.composite.tableviewer.ParticularDefaultSurvivorShipCellModifier#modify(java.lang
     * .Object, java.lang.String, java.lang.Object)
     */
@Override
public void modify(Object element, String property, Object value) {
    if (element instanceof TableItem) {
        ParticularDefaultSurvivorshipDefinitions pdskd = (ParticularDefaultSurvivorshipDefinitions) ((TableItem) element).getData();
        String newColumnName = String.valueOf(value);
        if (MatchAnalysisConstant.PRECOLUMN.equalsIgnoreCase(property)) {
            pdskd.setColumn(newColumnName);
            tableViewer.update(pdskd, null);
            return;
        }
    }
    super.modify(element, property, value);
}
Also used : ParticularDefaultSurvivorshipDefinitions(org.talend.dataquality.rules.ParticularDefaultSurvivorshipDefinitions) TableItem(org.eclipse.swt.widgets.TableItem)

Example 10 with ParticularDefaultSurvivorshipDefinitions

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

the class ParticularDefaultSurvivorShipDefintionTableViewer method createNewKeyDefinition.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.dataquality.record.linkage.ui.composite.tableviewer.ParticularDefaultSurvivorShipTableViewer#createNewKeyDefinition
     * (java.lang.String)
     */
@Override
protected ParticularDefaultSurvivorshipDefinitions createNewKeyDefinition(String columnName) {
    ParticularDefaultSurvivorshipDefinitions newKeyDefinition = super.createNewKeyDefinition(columnName);
    newKeyDefinition.setColumn(columnName);
    return newKeyDefinition;
}
Also used : ParticularDefaultSurvivorshipDefinitions(org.talend.dataquality.rules.ParticularDefaultSurvivorshipDefinitions)

Aggregations

ParticularDefaultSurvivorshipDefinitions (org.talend.dataquality.rules.ParticularDefaultSurvivorshipDefinitions)20 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)6 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)4 ISelection (org.eclipse.jface.viewers.ISelection)3 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)3 SurvivorShipAlgorithmEnum (org.talend.dataquality.record.linkage.utils.SurvivorShipAlgorithmEnum)3 AlgorithmDefinition (org.talend.dataquality.rules.AlgorithmDefinition)3 Map (java.util.Map)2 ComboBoxCellEditor (org.eclipse.jface.viewers.ComboBoxCellEditor)2 TableItem (org.eclipse.swt.widgets.TableItem)2 RecordMatchingIndicator (org.talend.dataquality.indicators.columnset.RecordMatchingIndicator)2 SurvivorshipFunction (org.talend.dataquality.record.linkage.grouping.swoosh.SurvivorShipAlgorithmParams.SurvivorshipFunction)2 DefaultSurvivorshipDefinition (org.talend.dataquality.rules.DefaultSurvivorshipDefinition)2 MatchRuleDefinition (org.talend.dataquality.rules.MatchRuleDefinition)2 List (java.util.List)1 EList (org.eclipse.emf.common.util.EList)1 CellEditor (org.eclipse.jface.viewers.CellEditor)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1