use of org.talend.dataquality.rules.MatchRuleDefinition in project tdq-studio-se by Talend.
the class MatchRuleElementTreeSelectionDialog method getMatchRulesFromNodes.
/**
* DOC sizhaoliu Comment method "getMatchRulesFromNodes".
*
* @param nodes
* @param retrieveDisplayValue get the display value when this parameter is set to true, otherwise, get the
* component value.
* @return
*/
public List<Map<String, String>> getMatchRulesFromNodes(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(getMatchRulesFromRules(matchRuleDefinition, retrieveDisplayValue));
}
}
return ruleValues;
}
use of org.talend.dataquality.rules.MatchRuleDefinition in project tdq-studio-se by Talend.
the class TreeMessageInfoDialog method getLabelProvider.
protected ILabelProvider getLabelProvider() {
if (labelProvider == null) {
labelProvider = new LabelProvider() {
@Override
public String getText(Object obj) {
if (obj == null) {
// $NON-NLS-1$
return "";
}
if (obj instanceof ImpactNode) {
return ((ImpactNode) obj).toString();
} else if (obj instanceof IFile) {
IFile file = (IFile) obj;
ModelElement modelElement = ModelElementFileFactory.getModelElement(file);
// MOD msjian TDQ-5909: modify to displayName
return modelElement != null ? PropertyHelper.getProperty(modelElement).getDisplayName() : file.getName();
} else if (obj instanceof RepositoryViewObject) {
// Added 20130226 TDQ-6899 show the name for Jrxml object (which has no related ModelElement)
return ((IRepositoryViewObject) obj).getLabel();
} else if (obj instanceof MetadataTable) {
// ADD TDQ-7146: for all type's connection table/view node
return ((ModelElement) obj).getName();
}
Property property = PropertyHelper.getProperty((ModelElement) obj);
return property == null ? ((ModelElement) obj).getName() : property.getDisplayName();
}
@Override
public Image getImage(Object obj) {
ModelElement modelElement = null;
if (obj instanceof ModelElement) {
modelElement = (ModelElement) obj;
} else if (obj instanceof ImpactNode) {
modelElement = ((ImpactNode) obj).getNodeElement();
} else if (obj instanceof IFile) {
modelElement = ModelElementFileFactory.getModelElement((IFile) obj);
} else if (obj instanceof RepositoryViewObject) {
// Added 20130226 TDQ-6899 show the name for Jrxml object (which has no related ModelElement)
return ImageLib.getImage(ImageLib.JRXML_ICON);
}
// ~
if (modelElement == null) {
if (((ImpactNode) obj).getNode() != null) {
return ImageLib.getImage(ImageLib.JRXML_ICON);
}
return super.getImage(obj);
}
Image modelElementImage = null;
String imgName = null;
if (modelElement instanceof Analysis) {
imgName = ImageLib.ANALYSIS_OBJECT;
} else if (modelElement instanceof TdReport) {
imgName = ImageLib.REPORT_OBJECT;
} else if (modelElement instanceof DatabaseConnection) {
imgName = ImageLib.CONNECTION;
} else if (modelElement instanceof DelimitedFileConnection) {
imgName = ImageLib.FILE_DELIMITED;
} else if (modelElement instanceof Pattern) {
imgName = ImageLib.PATTERN_REG;
} else if (modelElement instanceof IndicatorDefinition) {
// IndicatorDefinition
if (modelElement instanceof DQRule) {
imgName = ImageLib.DQ_RULE;
} else if (modelElement instanceof MatchRuleDefinition) {
imgName = ImageLib.MATCH_RULE_ICON;
} else {
imgName = ImageLib.IND_DEFINITION;
}
// TDQ-8550~
} else if (modelElement instanceof MetadataTable) {
imgName = ImageLib.TABLE;
}
if (imgName != null) {
modelElementImage = ImageLib.getImage(imgName);
}
// add lock icon on the image
if (modelElementImage != null) {
if (modelElement != null) {
Property property = PropertyHelper.getProperty(modelElement);
if (property != null) {
Item item = property.getItem();
if (item != null) {
if (ProxyRepositoryManager.getInstance().isLockByUserOwn(item)) {
modelElementImage = ImageLib.createLockedByOwnIcon(imgName);
} else if (ProxyRepositoryManager.getInstance().isLockByOthers(item)) {
modelElementImage = ImageLib.createLockedByOtherIcon(imgName);
}
}
}
}
return modelElementImage;
}
return super.getImage(obj);
}
};
}
return labelProvider;
}
use of org.talend.dataquality.rules.MatchRuleDefinition in project tdq-studio-se by Talend.
the class RecordMatchingIndicatorImpl method basicSetBuiltInMatchRuleDefinition.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetBuiltInMatchRuleDefinition(MatchRuleDefinition newBuiltInMatchRuleDefinition, NotificationChain msgs) {
MatchRuleDefinition oldBuiltInMatchRuleDefinition = builtInMatchRuleDefinition;
builtInMatchRuleDefinition = newBuiltInMatchRuleDefinition;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ColumnsetPackage.RECORD_MATCHING_INDICATOR__BUILT_IN_MATCH_RULE_DEFINITION, oldBuiltInMatchRuleDefinition, newBuiltInMatchRuleDefinition);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.talend.dataquality.rules.MatchRuleDefinition in project tdq-studio-se by Talend.
the class FileTreeLabelProvider method getImage.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
*/
@Override
public Image getImage(Object element) {
Image image = null;
if (element instanceof ItemRecord) {
ItemRecord record = (ItemRecord) element;
File file = record.getFile();
String fileName = file.getName();
if (file.isDirectory()) {
image = ImageLib.getImage(ImageLib.FOLDERNODE_IMAGE);
EResourceConstant constant = resolveResourceConstant(fileName);
if (constant != null) {
switch(constant) {
case DATA_PROFILING:
image = ImageLib.getImage(ImageLib.DATA_PROFILING);
break;
case METADATA:
image = ImageLib.getImage(ImageLib.METADATA);
break;
case LIBRARIES:
image = ImageLib.getImage(ImageLib.LIBRARIES);
break;
case ANALYSIS:
break;
case REPORTS:
break;
case EXCHANGE:
image = ImageLib.getImage(ImageLib.EXCHANGE);
break;
case DB_CONNECTIONS:
image = ImageLib.getImage(ImageLib.CONNECTION);
break;
case FILEDELIMITED:
image = ImageLib.getImage(ImageLib.FILE_DELIMITED);
break;
case HADOOP_CLUSTER:
image = ImageLib.getImage(ImageLib.HADOOP_CLUSTER);
break;
case CONTEXT:
image = ImageLib.getImage(ImageLib.CONTEXT);
break;
default:
break;
}
}
} else {
if (fileName.endsWith(FactoriesUtil.ANA)) {
image = ImageLib.getImage(ImageLib.ANALYSIS_OBJECT);
} else if (fileName.endsWith(FactoriesUtil.REP)) {
image = ImageLib.getImage(ImageLib.REPORT_OBJECT);
} else if (fileName.endsWith(FactoriesUtil.PATTERN)) {
image = ImageLib.getImage(ImageLib.PATTERN_REG);
} else if (fileName.endsWith(FactoriesUtil.DQRULE)) {
if (record.getElement() instanceof MatchRuleDefinition) {
image = ImageLib.getImage(ImageLib.MATCH_RULE_ICON);
} else {
image = ImageLib.getImage(ImageLib.DQ_RULE);
}
} else if (fileName.endsWith(FactoriesUtil.ITEM_EXTENSION)) {
if (record.getElement() instanceof DelimitedFileConnection) {
image = ImageLib.getImage(ImageLib.FILE_DELIMITED);
} else if (record.getElement() instanceof DatabaseConnection) {
image = ImageLib.getImage(ImageLib.TD_DATAPROVIDER);
} else {
image = ImageLib.getImage(ImageLib.CONTEXT);
}
} else if (fileName.endsWith(FactoriesUtil.DEFINITION)) {
image = ImageLib.getImage(ImageLib.IND_DEFINITION);
} else if (fileName.endsWith(FactoriesUtil.SQL)) {
image = ImageLib.getImage(ImageLib.SOURCE_FILE);
} else if (fileName.endsWith(FactoriesUtil.JAR)) {
image = ImageLib.getImage(ImageLib.JAR_FILE);
} else if (fileName.endsWith(FactoriesUtil.JRXML)) {
image = ImageLib.getImage(ImageLib.JRXML_ICON);
}
}
}
return image != null ? image : super.getImage(element);
}
use of org.talend.dataquality.rules.MatchRuleDefinition in project tdq-studio-se by Talend.
the class MatchAnalysisExecutorTest method createMatchIndicatorWithOneMathRule.
/**
* DOC zhao Comment method "createMatchIndicatorWithOneMathRule".
*
* @param nameVar
* @param matchIndicator
* @param groupQualityThreshold
* @param matchInterval
*/
private void createMatchIndicatorWithOneMathRule(String nameVar, RecordMatchingIndicator matchIndicator, double groupQualityThreshold, double matchInterval) {
MatchRuleDefinition matchRuleDefinition = RulesPackage.eINSTANCE.getRulesFactory().createMatchRuleDefinition();
matchRuleDefinition.setMatchGroupQualityThreshold(groupQualityThreshold);
MatchRule matchRule = RulesPackage.eINSTANCE.getRulesFactory().createMatchRule();
matchRule.setMatchInterval(matchInterval);
matchRule.setName("match rule 1");
MatchKeyDefinition matchkeyDef = RulesPackage.eINSTANCE.getRulesFactory().createMatchKeyDefinition();
matchkeyDef.setName(nameVar);
matchkeyDef.setColumn(nameVar);
AlgorithmDefinition algoDef = RulesPackage.eINSTANCE.getRulesFactory().createAlgorithmDefinition();
algoDef.setAlgorithmType(AttributeMatcherType.LEVENSHTEIN.name());
matchkeyDef.setAlgorithm(algoDef);
matchkeyDef.setConfidenceWeight(1);
matchRule.getMatchKeys().add(matchkeyDef);
matchRuleDefinition.getMatchRules().add(matchRule);
matchIndicator.setBuiltInMatchRuleDefinition(matchRuleDefinition);
}
Aggregations