use of org.talend.dataquality.record.linkage.utils.DefaultSurvivorShipDataTypeEnum in project tdq-studio-se by Talend.
the class MatchRuleElementTreeSelectionDialog method checkFunctionValid.
/**
* Check validity of function
*
* @param functionType the type of function
* @param matchedColumnName the name of column
* @param dataType the data type of column
* @return true if function is valid else false
*/
private boolean checkFunctionValid(String functionType, String matchedColumnName, String dataType) {
SurvivorShipAlgorithmEnum functionEnum = SurvivorShipAlgorithmEnum.getTypeBySavedValue(functionType);
// for most common, no need to check, it fixes all type.
if (SurvivorShipAlgorithmEnum.MOST_COMMON.equals(functionEnum)) {
return true;
}
DefaultSurvivorShipDataTypeEnum[] valudDataType = functionEnum.getDataType();
return FunctionEditingSupport.isSupportDataType(valudDataType, dataType);
}
use of org.talend.dataquality.record.linkage.utils.DefaultSurvivorShipDataTypeEnum in project tdq-studio-se by Talend.
the class DefaultSurvivorShipCellModifier 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) {
DefaultSurvivorshipDefinition skd = (DefaultSurvivorshipDefinition) ((TableItem) element).getData();
String newValue = String.valueOf(value);
if (MatchAnalysisConstant.DATA_TYPE.equalsIgnoreCase(property)) {
DefaultSurvivorShipDataTypeEnum valueByIndex = DefaultSurvivorShipDataTypeEnum.getTypeByIndex(Integer.valueOf(newValue).intValue());
if (StringUtils.equals(skd.getDataType(), valueByIndex.getValue())) {
return;
}
skd.setDataType(valueByIndex.getValue());
} else if (MatchAnalysisConstant.FUNCTION.equalsIgnoreCase(property)) {
SurvivorShipAlgorithmEnum valueByIndex = SurvivorShipAlgorithmEnum.getTypeByIndex(Integer.valueOf(newValue).intValue());
if (StringUtils.equals(skd.getFunction().getAlgorithmType(), valueByIndex.getComponentValueName())) {
return;
}
skd.getFunction().setAlgorithmType(valueByIndex.getComponentValueName());
if (!(isSurvivorShipAlgorithm(skd, SurvivorShipAlgorithmEnum.MOST_TRUSTED_SOURCE) | isSurvivorShipAlgorithm(skd, SurvivorShipAlgorithmEnum.CONCATENATE))) {
skd.getFunction().setAlgorithmParameters(StringUtils.EMPTY);
CellEditor[] cellEditors = tableViewer.getCellEditors();
if (cellEditors.length == 3) {
cellEditors[2].setValue(StringUtils.EMPTY);
}
}
} else if (MatchAnalysisConstant.PARAMETER.equalsIgnoreCase(property)) {
skd.getFunction().setAlgorithmParameters(newValue);
} else {
return;
}
tableViewer.update(skd, null);
}
}
use of org.talend.dataquality.record.linkage.utils.DefaultSurvivorShipDataTypeEnum in project tdq-studio-se by Talend.
the class ParticularDefSurshipDefinitionSection method checkFunctionValid.
/**
* Check validity of function
*
* @param functionType the type of function
* @param matchedColumnName the name of column
* @param dataType the data type of column
* @return true if function is valid else false
*/
private boolean checkFunctionValid(ParticularDefaultSurvivorshipDefinitions partucykarDefinition) {
AlgorithmDefinition algorithmDefinition = partucykarDefinition.getFunction();
String functionType = algorithmDefinition != null && algorithmDefinition.getAlgorithmType() != null ? algorithmDefinition.getAlgorithmType() : StringUtils.EMPTY;
String dataType = partucykarDefinition.getDataType();
SurvivorShipAlgorithmEnum functionEnum = SurvivorShipAlgorithmEnum.getTypeBySavedValue(functionType);
DefaultSurvivorShipDataTypeEnum[] valudDataType = functionEnum.getDataType();
return FunctionEditingSupport.isSupportDataType(valudDataType, dataType);
}
Aggregations