use of org.talend.dataquality.indicators.columnset.AllMatchIndicator in project tdq-studio-se by Talend.
the class ColumnSetAnalysisDetailsPage method saveAnalysis.
/**
* @param outputFolder
* @throws DataprofilerCoreException
*/
@Override
public void saveAnalysis() throws DataprofilerCoreException {
columnSetAnalysisHandler.changeDefaultRowLoaded(rowLoadedText.getText());
columnSetAnalysisHandler.changeSampleDataShowWay(sampleDataShowWayCombo.getText());
// columnSetAnalysisHandler.setName(columnSetAnalysisHandler.getName().replace(" ", ""));
for (Domain domain : getCurrentModelElement().getParameters().getDataFilter()) {
domain.setName(getCurrentModelElement().getName());
}
// ~
columnSetAnalysisHandler.clearAnalysis();
simpleStatIndicator.getAnalyzedColumns().clear();
allMatchIndicator.getAnalyzedColumns().clear();
// set execute engine
Analysis analysis = columnSetAnalysisHandler.getAnalysis();
analysis.getParameters().setExecutionLanguage(ExecutionLanguage.get(execLang));
// set data filter
columnSetAnalysisHandler.setStringDataFilter(dataFilterComp.getDataFilterString());
// save analysis
List<IRepositoryNode> repositoryNodes = treeViewer.getColumnSetMultiValueList();
Connection tdProvider = null;
IRepositoryViewObject reposObject = null;
if (repositoryNodes != null && repositoryNodes.size() != 0) {
ConnectionItem item = (ConnectionItem) repositoryNodes.get(0).getObject().getProperty().getItem();
tdProvider = item.getConnection();
if (tdProvider.eIsProxy()) {
// Resolve the connection again
tdProvider = (Connection) EObjectHelper.resolveObject(tdProvider);
}
analysis.getContext().setConnection(tdProvider);
List<ModelElement> columnList = new ArrayList<ModelElement>();
for (IRepositoryNode rd : repositoryNodes) {
reposObject = rd.getObject();
columnList.add(((MetadataColumnRepositoryObject) reposObject).getTdColumn());
}
simpleStatIndicator.getAnalyzedColumns().addAll(columnList);
columnSetAnalysisHandler.addIndicator(columnList, simpleStatIndicator);
// ~ MOD mzhao feature 13040. 2010-05-21
allMatchIndicator.getCompositeRegexMatchingIndicators().clear();
ModelElementIndicator[] modelElementIndicator = treeViewer.getModelElementIndicator();
if (modelElementIndicator != null) {
for (ModelElementIndicator modelElementInd : modelElementIndicator) {
Indicator[] inds = modelElementInd.getPatternIndicators();
for (Indicator ind : inds) {
if (ind instanceof RegexpMatchingIndicator) {
// MOD yyi 2011-06-15 22419:column set pattern for MDM
IRepositoryViewObject obj = modelElementInd.getModelElementRepositoryNode().getObject();
ModelElement analyzedElt = ((MetadataColumnRepositoryObject) obj).getTdColumn();
ind.setAnalyzedElement(analyzedElt);
allMatchIndicator.getCompositeRegexMatchingIndicators().add((RegexpMatchingIndicator) ind);
}
}
}
}
if (allMatchIndicator.getCompositeRegexMatchingIndicators().size() > 0) {
allMatchIndicator.getAnalyzedColumns().addAll(columnList);
columnSetAnalysisHandler.addIndicator(columnList, allMatchIndicator);
}
// ~
} else {
analysis.getContext().setConnection(null);
}
TaggedValueHelper.setTaggedValue(getCurrentModelElement(), TaggedValueHelper.IS_USE_SAMPLE_DATA, isRunWithSampleData.toString());
// save the number of connections per analysis
this.saveNumberOfConnectionsPerAnalysis();
// 2011.1.12 MOD by zhsne to unify anlysis and connection id when saving.
this.nameText.setText(columnSetAnalysisHandler.getName());
// TDQ-5581,if has removed emlements(patten),should remove dependency each other before saving.
// MOD yyi 2012-02-08 TDQ-4621:Explicitly set true for updating dependencies.
ReturnCode saved = ElementWriterFactory.getInstance().createAnalysisWrite().save(getCurrentRepNode().getObject().getProperty().getItem(), true);
// MOD yyi 2012-02-03 TDQ-3602:Avoid to rewriting all analyzes after saving, no reason to update all analyzes
// which is depended in the referred connection.
// Extract saving log function.
// @see org.talend.dataprofiler.core.ui.editor.analysis.AbstractAnalysisMetadataPage#logSaved(ReturnCode)
logSaved(saved);
treeViewer.setDirty(false);
dataFilterComp.setDirty(false);
}
use of org.talend.dataquality.indicators.columnset.AllMatchIndicator in project tdq-studio-se by Talend.
the class ColumnSetAnalysisHandler method getRegexMathingIndicators.
public Collection<Indicator> getRegexMathingIndicators(ModelElement modelElement) {
Collection<Indicator> indics = new ArrayList<Indicator>();
EList<Indicator> allIndics = analysis.getResults().getIndicators();
for (Indicator indicator : allIndics) {
if (indicator instanceof AllMatchIndicator) {
AllMatchIndicator allMatchInd = (AllMatchIndicator) indicator;
for (Indicator regexInd : allMatchInd.getCompositeRegexMatchingIndicators()) {
if (regexInd.getAnalyzedElement() != null && regexInd.getAnalyzedElement().equals(modelElement)) {
indics.add(regexInd);
}
}
break;
}
}
return indics;
}
use of org.talend.dataquality.indicators.columnset.AllMatchIndicator in project tdq-studio-se by Talend.
the class ColumnSetAnalysisHandler method getAllmatchIndicator.
/**
* DOC mzhao get AllMetchIndicator.
*
* @return
*/
public Indicator getAllmatchIndicator() {
Indicator indicator = null;
EList<Indicator> allIndics = analysis.getResults().getIndicators();
for (Indicator indic : allIndics) {
if (indic != null && indic instanceof AllMatchIndicator) {
indicator = indic;
break;
}
}
return indicator;
}
use of org.talend.dataquality.indicators.columnset.AllMatchIndicator in project tdq-studio-se by Talend.
the class DataExplorer method getAnalyzedElementName.
/**
* Add qiongli handle ColumnSetMultiValueIndicator.
*
* @return
*/
protected String getAnalyzedElementName(Indicator ind) {
if (ind.getAnalyzedElement() != null) {
return dbmsLanguage.quote(ind.getAnalyzedElement().getName());
}
StringBuffer name = new StringBuffer(PluginConstant.EMPTY_STRING);
EObject object = ind.eContainer();
EList<ModelElement> eLs = null;
if (object != null && object instanceof ColumnSetMultiValueIndicator) {
eLs = ((ColumnSetMultiValueIndicator) object).getAnalyzedColumns();
} else if (ind instanceof AllMatchIndicator) {
eLs = ((AllMatchIndicator) ind).getAnalyzedColumns();
}
if (eLs != null && !eLs.isEmpty()) {
for (ModelElement mColumn : eLs) {
// $NON-NLS-1$
name.append(dbmsLanguage.quote(mColumn.getName())).append(",");
}
if (eLs.size() > 0) {
// $NON-NLS-1$
return org.apache.commons.lang.StringUtils.removeEnd(name.toString(), ",");
}
}
return name.toString();
}
use of org.talend.dataquality.indicators.columnset.AllMatchIndicator in project tdq-studio-se by Talend.
the class AnalysisHelper method getPatterns.
public static List<Pattern> getPatterns(Analysis analysis) {
List<Pattern> rets = new ArrayList<Pattern>();
EList<Indicator> indicators = analysis.getResults().getIndicators();
for (Indicator indicator : indicators) {
if (indicator instanceof PatternMatchingIndicator) {
IndicatorParameters parameters = ((PatternMatchingIndicator) indicator).getParameters();
if (null != parameters && null != parameters.getDataValidDomain()) {
rets.addAll(parameters.getDataValidDomain().getPatterns());
}
}
// MOD yyi 2010-08-03 14292 Add dependency for children indicator in Column Set analysis
if (indicator instanceof AllMatchIndicator) {
EList<RegexpMatchingIndicator> list = ((AllMatchIndicator) indicator).getCompositeRegexMatchingIndicators();
for (RegexpMatchingIndicator pattern : list) {
IndicatorParameters parameters = pattern.getParameters();
if (null != parameters && null != parameters.getDataValidDomain()) {
rets.addAll(parameters.getDataValidDomain().getPatterns());
}
}
}
// ~
}
return rets;
}
Aggregations