use of org.talend.dataquality.indicators.columnset.ColumnsetFactory in project tdq-studio-se by Talend.
the class RedundancyAnalysisDetailsPage method initialize.
@Override
public void initialize(FormEditor editor) {
super.initialize(editor);
// MOD xqliu 2009-06-10 bug7334
stringDataFilterA = AnalysisHelper.getStringDataFilter(getCurrentModelElement(), 0);
stringDataFilterB = AnalysisHelper.getStringDataFilter(getCurrentModelElement(), 1);
// ~
if (getCurrentModelElement().getResults().getIndicators().size() == 0) {
ColumnsetFactory factory = ColumnsetFactory.eINSTANCE;
rowMatchingIndicatorA = factory.createRowMatchingIndicator();
rowMatchingIndicatorB = factory.createRowMatchingIndicator();
Indicator[] currentIndicators = new Indicator[] { rowMatchingIndicatorA, rowMatchingIndicatorB };
setDefaultIndDef(currentIndicators);
} else {
EList<Indicator> indicators = getCurrentModelElement().getResults().getIndicators();
rowMatchingIndicatorA = (RowMatchingIndicator) indicators.get(0);
rowMatchingIndicatorB = (RowMatchingIndicator) indicators.get(1);
}
}
use of org.talend.dataquality.indicators.columnset.ColumnsetFactory in project tdq-studio-se by Talend.
the class ColumnSetAnalysisDetailsPage method recomputeIndicators.
public void recomputeIndicators() {
columnSetAnalysisHandler = new ColumnSetAnalysisHandler();
columnSetAnalysisHandler.setAnalysis(getCurrentModelElement());
stringDataFilter = columnSetAnalysisHandler.getStringDataFilter();
analyzedColumns = columnSetAnalysisHandler.getAnalyzedColumns();
if (columnSetAnalysisHandler.getSimpleStatIndicator() == null || columnSetAnalysisHandler.getSimpleStatIndicator().eIsProxy()) {
ColumnsetFactory columnsetFactory = ColumnsetFactory.eINSTANCE;
simpleStatIndicator = columnsetFactory.createSimpleStatIndicator();
simpleStatIndicator.setRowCountIndicator(IndicatorsFactory.eINSTANCE.createRowCountIndicator());
simpleStatIndicator.setDistinctCountIndicator(IndicatorsFactory.eINSTANCE.createDistinctCountIndicator());
simpleStatIndicator.setDuplicateCountIndicator(IndicatorsFactory.eINSTANCE.createDuplicateCountIndicator());
simpleStatIndicator.setUniqueCountIndicator(IndicatorsFactory.eINSTANCE.createUniqueCountIndicator());
} else {
simpleStatIndicator = (SimpleStatIndicator) columnSetAnalysisHandler.getSimpleStatIndicator();
}
if (columnSetAnalysisHandler.getAllmatchIndicator() == null) {
ColumnsetFactory columnsetFactory = ColumnsetFactory.eINSTANCE;
allMatchIndicator = columnsetFactory.createAllMatchIndicator();
DefinitionHandler.getInstance().setDefaultIndicatorDefinition(allMatchIndicator);
} else {
allMatchIndicator = (AllMatchIndicator) columnSetAnalysisHandler.getAllmatchIndicator();
}
initializeIndicator(simpleStatIndicator);
List<ModelElementIndicator> meIndicatorList = new ArrayList<ModelElementIndicator>();
ModelElementIndicator currentIndicator = null;
for (ModelElement element : analyzedColumns) {
// MOD yyi 2011-02-16 17871:delimitefile
MetadataColumn mdColumn = SwitchHelpers.METADATA_COLUMN_SWITCH.doSwitch(element);
TdColumn tdColumn = SwitchHelpers.COLUMN_SWITCH.doSwitch(element);
if (tdColumn == null && mdColumn == null) {
continue;
}
if (tdColumn == null && mdColumn != null) {
currentIndicator = ModelElementIndicatorHelper.createDFColumnIndicator(RepositoryNodeHelper.recursiveFind(mdColumn));
} else if (tdColumn != null) {
RepositoryNode recursiveFind = RepositoryNodeHelper.recursiveFind(tdColumn);
if (recursiveFind == null) {
recursiveFind = RepositoryNodeHelper.createRepositoryNode(tdColumn);
}
currentIndicator = ModelElementIndicatorHelper.createModelElementIndicator(recursiveFind);
}
DataminingType dataminingType = MetadataHelper.getDataminingType(element);
MetadataHelper.setDataminingType(dataminingType == null ? DataminingType.NOMINAL : dataminingType, element);
Collection<Indicator> indicatorList = columnSetAnalysisHandler.getRegexMathingIndicators(element);
if (null != currentIndicator) {
currentIndicator.setIndicators(indicatorList.toArray(new Indicator[indicatorList.size()]));
meIndicatorList.add(currentIndicator);
}
}
currentModelElementIndicators = meIndicatorList.toArray(new ModelElementIndicator[meIndicatorList.size()]);
}
use of org.talend.dataquality.indicators.columnset.ColumnsetFactory in project tdq-studio-se by Talend.
the class CorrelationAnalysisDetailsPage method recomputeIndicators.
public void recomputeIndicators() {
correlationAnalysisHandler = new ColumnCorrelationAnalysisHandler();
correlationAnalysisHandler.setAnalysis(getCurrentModelElement());
stringDataFilter = correlationAnalysisHandler.getStringDataFilter();
analyzedColumns = correlationAnalysisHandler.getAnalyzedColumns();
if (correlationAnalysisHandler.getIndicator() == null && columnSetMultiIndicator != null) {
ColumnsetFactory columnsetFactory = ColumnsetFactory.eINSTANCE;
// MOD qiongli 2010-6-18 bug 12766
if (ColumnsetPackage.eINSTANCE.getCountAvgNullIndicator() == columnSetMultiIndicator.eClass()) {
columnSetMultiIndicator = columnsetFactory.createCountAvgNullIndicator();
// MOD xqliu 2010-04-06 bug 12161
fillSimpleIndicators(columnSetMultiIndicator);
// ~12161
}
if (ColumnsetPackage.eINSTANCE.getMinMaxDateIndicator() == columnSetMultiIndicator.eClass()) {
columnSetMultiIndicator = columnsetFactory.createMinMaxDateIndicator();
}
if (ColumnsetPackage.eINSTANCE.getWeakCorrelationIndicator() == columnSetMultiIndicator.eClass()) {
columnSetMultiIndicator = columnsetFactory.createWeakCorrelationIndicator();
}
} else {
columnSetMultiIndicator = (ColumnSetMultiValueIndicator) correlationAnalysisHandler.getIndicator();
}
if (columnSetMultiIndicator == null) {
columnSetMultiIndicator = ColumnsetFactory.eINSTANCE.createCountAvgNullIndicator();
}
initializeIndicator(columnSetMultiIndicator);
columnSetMultiIndicator.setStoreData(true);
for (ModelElement element : analyzedColumns) {
TdColumn tdColumn = SwitchHelpers.COLUMN_SWITCH.doSwitch(element);
if (tdColumn == null) {
continue;
}
// currentColumnIndicator = new ColumnIndicator(tdColumn);
DataminingType dataminingType = correlationAnalysisHandler.getDatamingType(tdColumn);
MetadataHelper.setDataminingType(dataminingType == null ? DataminingType.NOMINAL : dataminingType, tdColumn);
}
}
use of org.talend.dataquality.indicators.columnset.ColumnsetFactory in project tdq-studio-se by Talend.
the class CorrelationAnalysisDetailsPage method saveAnalysis.
/**
* @param outputFolder
* @throws DataprofilerCoreException
*/
@Override
public void saveAnalysis() throws DataprofilerCoreException {
for (Domain domain : getCurrentModelElement().getParameters().getDataFilter()) {
domain.setName(getCurrentModelElement().getName());
}
IRepositoryViewObject reposObject = null;
Connection tdProvider = null;
correlationAnalysisHandler.clearAnalysis();
columnSetMultiIndicator.getAnalyzedColumns().clear();
// set execute engine
Analysis analysis = correlationAnalysisHandler.getAnalysis();
analysis.getParameters().setExecutionLanguage(ExecutionLanguage.get(execLang));
// set data filter
correlationAnalysisHandler.setStringDataFilter(dataFilterComp.getDataFilterString());
// save analysis
List<RepositoryNode> repositoryNodeList = treeViewer.getColumnSetMultiValueList();
if (repositoryNodeList != null && !repositoryNodeList.isEmpty()) {
reposObject = repositoryNodeList.get(0).getObject();
tdProvider = ((ConnectionItem) reposObject.getProperty().getItem()).getConnection();
analysis.getContext().setConnection(tdProvider);
List<TdColumn> columnLst = new ArrayList<TdColumn>();
for (RepositoryNode repNode : repositoryNodeList) {
columnLst.add((TdColumn) ((MetadataColumnRepositoryObject) repNode.getObject()).getTdColumn());
}
columnSetMultiIndicator.getAnalyzedColumns().addAll(columnLst);
correlationAnalysisHandler.addIndicator(columnLst, columnSetMultiIndicator);
} else {
analysis.getContext().setConnection(null);
// MOD by zshen for bug 12042.
ColumnsetFactory columnsetFactory = ColumnsetFactory.eINSTANCE;
ColumnSetMultiValueIndicator columnSetMultiValueIndicator = null;
if (ColumnsetPackage.eINSTANCE.getCountAvgNullIndicator() == columnSetMultiIndicator.eClass()) {
columnSetMultiValueIndicator = columnsetFactory.createCountAvgNullIndicator();
}
if (ColumnsetPackage.eINSTANCE.getMinMaxDateIndicator() == columnSetMultiIndicator.eClass()) {
columnSetMultiValueIndicator = columnsetFactory.createMinMaxDateIndicator();
}
if (ColumnsetPackage.eINSTANCE.getWeakCorrelationIndicator() == columnSetMultiIndicator.eClass()) {
columnSetMultiValueIndicator = columnsetFactory.createWeakCorrelationIndicator();
}
fillSimpleIndicators(columnSetMultiValueIndicator);
analysis.getResults().getIndicators().add(columnSetMultiValueIndicator);
// ~12042
}
// 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(analysis.getName());
// ~
// 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);
}
Aggregations