use of org.talend.dataquality.rules.MatchRuleDefinition in project tdq-studio-se by Talend.
the class MatchRuleMasterDetailsPage method getMatchRuleRepNodeFromInput.
/**
* get PatternRepNode From editorInput
*
* @param editorInput
* @return
*/
private RuleRepNode getMatchRuleRepNodeFromInput(IEditorInput editorInput) {
if (editorInput instanceof FileEditorInput) {
FileEditorInput fileEditorInput = (FileEditorInput) editorInput;
IFile file = fileEditorInput.getFile();
if (file != null) {
MatchRuleDefinition matchRuleDefinition = DQRuleResourceFileHelper.getInstance().findMatchRule(file);
matchRuleDefinition = (MatchRuleDefinition) EObjectHelper.resolveObject(matchRuleDefinition);
return RepositoryNodeHelper.recursiveFindMatcherRule(matchRuleDefinition);
}
} else if (editorInput instanceof BusinessRuleItemEditorInput) {
return ((BusinessRuleItemEditorInput) editorInput).getRepNode();
} else if (editorInput instanceof MatchRuleItemEditorInput) {
// this is only comes from MDM team
matchRuleDefiniton = (MatchRuleDefinition) ((MatchRuleItemEditorInput) editorInput).getMatchRule();
item = ((MatchRuleItemEditorInput) editorInput).getItem();
}
return null;
}
use of org.talend.dataquality.rules.MatchRuleDefinition in project tdq-studio-se by Talend.
the class ItemRecord method includeCustomMatcherJarDependencies.
/**
* DOC zshen Comment method "includeCustomMatcherJarDependencies".
*
* @param matchAnalysis
*/
private void includeCustomMatcherJarDependencies(Analysis matchAnalysis) {
RecordMatchingIndicator recordMatchIndicatorFromAna = AnalysisHelper.getRecordMatchIndicatorFromAna(matchAnalysis);
MatchRuleDefinition builtInMatchRuleDefinition = recordMatchIndicatorFromAna.getBuiltInMatchRuleDefinition();
includeCustomMatcherJarDependencies(builtInMatchRuleDefinition);
}
use of org.talend.dataquality.rules.MatchRuleDefinition in project tdq-studio-se by Talend.
the class ItemRecord method computeDependencies.
/**
* DOC bZhou Comment method "computeDependencies".
*/
private void computeDependencies(ModelElement mElement) {
if (isJRXml()) {
Collection<TdReport> allReports = (Collection<TdReport>) RepResourceFileHelper.getInstance().getAllElement();
for (TdReport report : allReports) {
// MOD yyi 2012-02-20 TDQ-4545 TDQ-4701: Change to relative path comparing.
IPath pathRepFile = RepResourceFileHelper.findCorrespondingFile(report).getLocation();
IPath pathJrxmlFile = new Path(file.getPath());
String path = pathJrxmlFile.makeRelativeTo(pathRepFile).toString();
for (AnalysisMap anaMap : report.getAnalysisMap()) {
if (StringUtils.equals(path, anaMap.getJrxmlSource())) {
// TODO the File is jrxml, but the ModelElement is report ???
this.dependencySet.add(file);
}
}
}
} else if (mElement != null) {
if (mElement instanceof Connection) {
includeContextDependency((Connection) mElement);
return;
}
List<File> dependencyFile = getClintDependencyForExport(mElement);
for (File df : dependencyFile) {
ModelElement modelElement = getElement(df);
if (modelElement != null) {
File depFile = EObjectHelper.modelElement2File(modelElement);
if (depFile != null) {
this.dependencySet.add(depFile);
}
// MOD sizhaoliu 2013-04-13 TDQ-7082
if (modelElement instanceof IndicatorDefinition) {
if (modelElement instanceof UDIndicatorDefinition) {
includeJUDIDependencies((IndicatorDefinition) modelElement);
} else {
for (IndicatorDefinition definition : ((IndicatorDefinition) modelElement).getAggregatedDefinitions()) {
includeAggregatedDependencies(definition);
}
}
}
}
}
// MOD yyi 2012-02-20 TDQ-4545 TDQ-4701: Map user define jrxm templates with report.
if (mElement instanceof TdReport) {
TdReport rep = (TdReport) mElement;
for (AnalysisMap anaMap : rep.getAnalysisMap()) {
ReportType reportType = ReportHelper.ReportType.getReportType(anaMap.getAnalysis(), anaMap.getReportType());
boolean isUserMade = ReportHelper.ReportType.USER_MADE.equals(reportType);
if (isUserMade) {
traverseFolderAndAddJrxmlDependencies(getJrxmlFolderFromReport(rep, ResourceManager.getJRXMLFolder()));
}
}
} else if (mElement instanceof IndicatorDefinition) {
// MOD sizhaoliu 2013-04-13 TDQ-7082
IndicatorDefinition definition = (IndicatorDefinition) mElement;
if (definition instanceof UDIndicatorDefinition) {
includeJUDIDependencies(definition);
} else {
for (IndicatorDefinition defInd : definition.getAggregatedDefinitions()) {
includeAggregatedDependencies(defInd);
}
}
// folder
if (mElement instanceof MatchRuleDefinition) {
includeCustomMatcherJarDependencies((MatchRuleDefinition) mElement);
}
} else if (mElement instanceof Analysis && AnalysisType.MATCH_ANALYSIS == AnalysisHelper.getAnalysisType((Analysis) mElement)) {
includeCustomMatcherJarDependencies((Analysis) mElement);
}
}
}
use of org.talend.dataquality.rules.MatchRuleDefinition in project tdq-studio-se by Talend.
the class MatchWizard method initCWMResourceBuilder.
/*
* (non-Javadoc)
*
* @see org.talend.dataprofiler.core.ui.wizard.analysis.column.ColumnSetWizard#initCWMResourceBuilder()
*/
@Override
public ModelElement initCWMResourceBuilder() {
Analysis analysis = (Analysis) super.initCWMResourceBuilder();
// New blocking key indicator.
Indicator blockKeyIndicator = ColumnsetFactory.eINSTANCE.createBlockKeyIndicator();
analysis.getResults().getIndicators().add(blockKeyIndicator);
// Match rule indicator
RecordMatchingIndicator matchRuleIndicator = ColumnsetFactory.eINSTANCE.createRecordMatchingIndicator();
MatchRuleDefinition matchRuleDefinition = RulesFactory.eINSTANCE.createMatchRuleDefinition();
matchRuleIndicator.setBuiltInMatchRuleDefinition(matchRuleDefinition);
analysis.getResults().getIndicators().add(matchRuleIndicator);
// default loaded row count
IPreferenceStore preferenceStore = CorePlugin.getDefault().getPreferenceStore();
int maxRows = preferenceStore.getInt(PluginConstant.MAX_NB_ROWS_ANALYSIS_EDITOR);
TaggedValueHelper.setTaggedValue(analysis, TaggedValueHelper.PREVIEW_ROW_NUMBER, String.valueOf(maxRows));
return analysis;
}
use of org.talend.dataquality.rules.MatchRuleDefinition in project tdq-studio-se by Talend.
the class RuleFolderFliter method select.
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
// MOD klliu bug TDQ-3202 filter Parser Rule folder and item.
if (element instanceof IFile) {
IFile file = (IFile) element;
if (FactoriesUtil.DQRULE.equals(file.getFileExtension())) {
// add support for match rule
ModelElement modelElement = DQRuleResourceFileHelper.getInstance().getModelElement(file);
if (modelElement == null) {
return false;
}
ModelElement rule = DQRuleResourceFileHelper.getInstance().doSwitch(modelElement);
if (rule != null && rule instanceof MatchRuleDefinition) {
return true;
}
// ~
WhereRule findWhereRule = DQRuleResourceFileHelper.getInstance().findWhereRule(file);
if (findWhereRule == null) {
return false;
}
return true;
}
} else if (element instanceof IFolder) {
IFolder folder = (IFolder) element;
boolean subFolder = ResourceService.isSubFolder(ResourceManager.getRulesFolder(), folder);
if (subFolder) {
return !folder.getFullPath().equals(ResourceManager.getRulesParserFolder().getFullPath());
}
return subFolder;
}
// ~
return isShowFile;
}
Aggregations