use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.
the class ColumnAnalysisDetailsPage method recomputeIndicators.
public void recomputeIndicators() {
analysisHandler = new ModelElementAnalysisHandler();
analysisHandler.setAnalysis(getCurrentModelElement());
// Handle JUDIs
UDIHelper.updateJUDIsForAnalysis(getCurrentModelElement());
stringDataFilter = analysisHandler.getStringDataFilterwithContext();
EList<ModelElement> analyzedColumns = analysisHandler.getAnalyzedColumns();
List<ModelElementIndicator> meIndicatorList = new ArrayList<ModelElementIndicator>();
ModelElementIndicator currentIndicator = null;
for (ModelElement element : analyzedColumns) {
TdColumn tdColumn = SwitchHelpers.COLUMN_SWITCH.doSwitch(element);
// MOD qiongli 2011-1-10,16796:delimitefile
MetadataColumn mdColumn = SwitchHelpers.METADATA_COLUMN_SWITCH.doSwitch(element);
if (tdColumn == null && mdColumn == null) {
continue;
}
// MOD qiongli TDQ-7052 if the node is filtered ,it will be return null,so should create a new node.
RepositoryNode repNode = RepositoryNodeHelper.recursiveFind(element);
if (repNode == null) {
repNode = RepositoryNodeHelper.createRepositoryNode(element);
}
// MOD mzhao feature 15750, The column is recompute from the file, here create a new repository view object.
if (tdColumn == null && mdColumn != null) {
currentIndicator = ModelElementIndicatorHelper.createDFColumnIndicator(repNode);
} else if (tdColumn != null) {
currentIndicator = ModelElementIndicatorHelper.createModelElementIndicator(repNode);
}
DataminingType dataminingType = DataminingType.get(analysisHandler.getDatamingType(element));
MetadataHelper.setDataminingType(dataminingType == null ? DataminingType.NOMINAL : dataminingType, element);
Collection<Indicator> indicatorList = analysisHandler.getIndicators(element);
if (currentIndicator != null) {
currentIndicator.setIndicators(indicatorList.toArray(new Indicator[indicatorList.size()]));
meIndicatorList.add(currentIndicator);
}
}
currentModelElementIndicators = meIndicatorList.toArray(new ModelElementIndicator[meIndicatorList.size()]);
}
use of org.talend.dataquality.indicators.Indicator 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.Indicator in project tdq-studio-se by Talend.
the class ConnectionAnalysisDetailsPage method getCatalogIndicators.
@Override
public List<OverviewIndUIElement> getCatalogIndicators() {
ConnectionIndicator conIndicator = (ConnectionIndicator) getCurrentModelElement().getResults().getIndicators().get(0);
Connection analyzedElement = (Connection) conIndicator.getAnalyzedElement();
EList<CatalogIndicator> catalogIndicators = conIndicator.getCatalogIndicators();
List<OverviewIndUIElement> cataUIEleList = new ArrayList<OverviewIndUIElement>();
RepositoryNode connNode = RepositoryNodeHelper.recursiveFind(analyzedElement);
for (Indicator indicator : catalogIndicators) {
if (connNode != null) {
for (IRepositoryNode catalogNode : connNode.getChildren()) {
Catalog catalog = ((MetadataCatalogRepositoryObject) catalogNode.getObject()).getCatalog();
String connUuid = ResourceHelper.getUUID(catalog);
String anaUuid = ResourceHelper.getUUID(indicator.getAnalyzedElement());
if (connUuid.equals(anaUuid)) {
OverviewIndUIElement cataUIEle = new OverviewIndUIElement();
cataUIEle.setNode(catalogNode);
cataUIEle.setOverviewIndicator(indicator);
cataUIEleList.add(cataUIEle);
break;
}
}
}
}
return cataUIEleList;
}
use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.
the class DynamicAnalysisMasterPage method registerDynamicEvent.
/**
* Added TDQ-8787 20140613 yyin: create all charts before running, register each chart with its related indicator.
*/
public void registerDynamicEvent() {
// only worked for the analysis which support dynamic chart
// create all charts for related indicator in current page
createDynamicChartsBeforeRun();
// get all indicators and datasets
List<DynamicIndicatorModel> indiAndDatasets = getDynamicDatasets();
// register dynamic event,for the indicator (for each column)
for (DynamicIndicatorModel oneCategoryIndicatorModel : indiAndDatasets) {
if (EIndicatorChartType.SUMMARY_STATISTICS.equals(oneCategoryIndicatorModel.getChartType())) {
// when all summary indicators are selected
DynamicBAWChartEventReceiver bawReceiver = AnalysisUtils.createDynamicBAWChartEventReceiver(oneCategoryIndicatorModel, eventReceivers);
bawReceiver.setChartComposite(chartComposite);
// no need to register the parent baw receiver with one of summary indicator, no need to handle baw
// actually
} else {
int index = 0;
for (Indicator oneIndicator : oneCategoryIndicatorModel.getIndicatorList()) {
// if the indicator is a frequency indicator, create a Frequency Event Receiver
DynamicChartEventReceiver eReceiver = createEventReceiver(oneCategoryIndicatorModel, index++, oneIndicator);
eReceiver.setChartComposite(chartComposite);
// clear data
eReceiver.clearValue();
registerIndicatorEvent(oneIndicator, eReceiver);
}
}
}
reLayoutChartComposite();
registerOtherDynamicEvent();
}
use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.
the class DynamicAnalysisMasterPage method unRegisterDynamicEvent.
/**
* unregister every dynamic events which registered before executing analysis
*
* @param eventReceivers
*/
public void unRegisterDynamicEvent() {
EventManager.getInstance().clearEvent(getCurrentModelElement(), EventEnum.DQ_DYNAMIC_SWITCH_MASTER_RESULT_PAGE);
for (Indicator oneIndicator : eventReceivers.keySet()) {
DynamicChartEventReceiver eventReceiver = (DynamicChartEventReceiver) eventReceivers.get(oneIndicator);
eventReceiver.clear();
EventManager.getInstance().clearEvent(oneIndicator, EventEnum.DQ_DYMANIC_CHART);
}
eventReceivers.clear();
EventManager.getInstance().clearEvent(chartComposite, EventEnum.DQ_DYNAMIC_REFRESH_DYNAMIC_CHART);
clearDynamicDatasets();
}
Aggregations