Search in sources :

Example 16 with ParticularDefaultSurvivorshipDefinitions

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

the class ParticularDefSurshipDefinitionSection method setColumnValueIfMatch.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.dataquality.record.linkage.ui.section.AbstractMatchAnaysisTableSection#setColumnValueIfMatch(org.talend.dataquality
     * .rules.KeyDefinition)
     */
@Override
protected void setColumnValueIfMatch(KeyDefinition keyDefinition) {
    String columnName = StringUtils.EMPTY;
    String columnType = StringUtils.EMPTY;
    if (this.columnMap != null) {
        for (MetadataColumn column : columnMap.keySet()) {
            if (StringUtils.equalsIgnoreCase(getColumnName(column), getMappingName(keyDefinition))) {
                columnName = column.getLabel();
                columnType = column.getTalendType();
                break;
            }
        }
    }
    keyDefinition.setColumn(columnName);
    ((ParticularDefaultSurvivorshipDefinitions) keyDefinition).setDataType(columnType);
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) ParticularDefaultSurvivorshipDefinitions(org.talend.dataquality.rules.ParticularDefaultSurvivorshipDefinitions)

Example 17 with ParticularDefaultSurvivorshipDefinitions

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

the class ParticularDefSurshipDefinitionSection method moveUpTableItem.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataquality.record.linkage.ui.section.AbstractMatchAnaysisTableSection#moveUpTableItem()
     */
@Override
public void moveUpTableItem() {
    ISelection selectItems = tableComposite.getSelectItems();
    if (selectItems instanceof StructuredSelection) {
        if (selectItems.isEmpty()) {
            return;
        }
        List<ParticularDefaultSurvivorshipDefinitions> currentElements = this.matchRuleDef.getParticularDefaultSurvivorshipDefinitions();
        List<ParticularDefaultSurvivorshipDefinitions> particularDefaultSurvivorshipKeyDefinitionlist = ((StructuredSelection) selectItems).toList();
        for (int index = 0; index < particularDefaultSurvivorshipKeyDefinitionlist.size(); index++) {
            if (!isSameWithCurrentModel(currentElements.get(index), particularDefaultSurvivorshipKeyDefinitionlist.get(index))) {
                continue;
            }
            ParticularDefaultSurvivorshipDefinitions next = particularDefaultSurvivorshipKeyDefinitionlist.get(index);
            tableComposite.moveUpKeyDefinition(next, currentElements);
        }
        tableComposite.selectAllItem(((StructuredSelection) selectItems).toList());
    }
}
Also used : ParticularDefaultSurvivorshipDefinitions(org.talend.dataquality.rules.ParticularDefaultSurvivorshipDefinitions) ISelection(org.eclipse.jface.viewers.ISelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection)

Example 18 with ParticularDefaultSurvivorshipDefinitions

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

the class FunctionEditingSupport method getValue.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.viewers.EditingSupport#getValue(java.lang.Object)
     */
@Override
protected Object getValue(Object element) {
    String talendDataType = ((ParticularDefaultSurvivorshipDefinitions) element).getDataType();
    String[] allShowTypes = getAllFunctionByDataTypes(talendDataType);
    SurvivorShipAlgorithmEnum typeBySavedValue = SurvivorShipAlgorithmEnum.getTypeBySavedValue(((ParticularDefaultSurvivorshipDefinitions) element).getFunction().getAlgorithmType());
    for (int index = 0; index < allShowTypes.length; index++) {
        if (typeBySavedValue.getValue().equals(allShowTypes[index])) {
            return index;
        }
    }
    return -1;
}
Also used : ParticularDefaultSurvivorshipDefinitions(org.talend.dataquality.rules.ParticularDefaultSurvivorshipDefinitions) SurvivorShipAlgorithmEnum(org.talend.dataquality.record.linkage.utils.SurvivorShipAlgorithmEnum)

Example 19 with ParticularDefaultSurvivorshipDefinitions

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

the class FunctionEditingSupport method getCellEditor.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.viewers.EditingSupport#getCellEditor(java.lang.Object)
     */
@Override
protected CellEditor getCellEditor(Object element) {
    String talendDataType = ((ParticularDefaultSurvivorshipDefinitions) element).getDataType();
    ComboBoxCellEditor comboBoxCellEditor = new ComboBoxCellEditor(((ParticularDefaultSurvivorShipTableViewer) this.getViewer()).getTable(), getAllFunctionByDataTypes(talendDataType), SWT.READ_ONLY);
    return comboBoxCellEditor;
}
Also used : ParticularDefaultSurvivorshipDefinitions(org.talend.dataquality.rules.ParticularDefaultSurvivorshipDefinitions) ComboBoxCellEditor(org.eclipse.jface.viewers.ComboBoxCellEditor)

Example 20 with ParticularDefaultSurvivorshipDefinitions

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

the class FunctionEditingSupport method setValue.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.viewers.EditingSupport#setValue(java.lang.Object, java.lang.Object)
     */
@Override
protected void setValue(Object element, Object value) {
    ParticularDefaultSurvivorshipDefinitions pdskd = ((ParticularDefaultSurvivorshipDefinitions) element);
    String talendDataType = ((ParticularDefaultSurvivorshipDefinitions) element).getDataType();
    int functionTypeIndex = Integer.valueOf(value.toString()).intValue();
    SurvivorShipAlgorithmEnum valueByIndex = findEnumValue(talendDataType, functionTypeIndex);
    if (StringUtils.equals(pdskd.getFunction().getAlgorithmType(), valueByIndex.getComponentValueName())) {
        return;
    }
    pdskd.getFunction().setAlgorithmType(valueByIndex.getComponentValueName());
    if (!(isSurvivorShipAlgorithm(pdskd, SurvivorShipAlgorithmEnum.MOST_TRUSTED_SOURCE) || isSurvivorShipAlgorithm(pdskd, SurvivorShipAlgorithmEnum.CONCATENATE))) {
        pdskd.getFunction().setAlgorithmParameters(StringUtils.EMPTY);
        CellEditor[] cellEditors = this.getViewer().getCellEditors();
        if (cellEditors.length == 3) {
            cellEditors[2].setValue(StringUtils.EMPTY);
        }
    }
    this.getViewer().update(element, null);
}
Also used : ParticularDefaultSurvivorshipDefinitions(org.talend.dataquality.rules.ParticularDefaultSurvivorshipDefinitions) CellEditor(org.eclipse.jface.viewers.CellEditor) ComboBoxCellEditor(org.eclipse.jface.viewers.ComboBoxCellEditor) SurvivorShipAlgorithmEnum(org.talend.dataquality.record.linkage.utils.SurvivorShipAlgorithmEnum)

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