use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.
the class IndicatorImpl method checkAllowDrillDown.
/**
* Check whether drill down action is allow
*
* @return true is allowed else false
*/
protected boolean checkAllowDrillDown() {
Analysis analysis = AnalysisHelper.getAnalysis(this);
boolean isStoreData = false;
boolean isJavaEngine = false;
if (analysis != null) {
isStoreData = AnalysisHelper.isStoreData(analysis);
isJavaEngine = AnalysisHelper.isJavaExecutionEngine(analysis);
}
return isStoreData && isJavaEngine;
}
use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.
the class AnalysisMapImpl method setAnalysis.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAnalysis(Analysis newAnalysis) {
Analysis oldAnalysis = analysis;
analysis = newAnalysis;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReportsPackage.ANALYSIS_MAP__ANALYSIS, oldAnalysis, analysis));
}
use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.
the class BusinessRuleAnalysisDetailsPage method saveAnalysis.
@Override
public void saveAnalysis() throws DataprofilerCoreException {
// ADD gdbu 2011-3-3 bug 19179
for (Domain domain : getCurrentModelElement().getParameters().getDataFilter()) {
domain.setName(getCurrentModelElement().getName());
}
// ~
analysisHandler.clearAnalysis();
TableIndicator[] tableIndicators = treeViewer.getTableIndicator();
Connection tdProvider = null;
Analysis analysis = analysisHandler.getAnalysis();
analysis.getParameters().setExecutionLanguage(ExecutionLanguage.get(execLang));
if (tableIndicators != null && tableIndicators.length != 0) {
tdProvider = ConnectionHelper.getDataProvider(tableIndicators[0].getColumnSet());
if (tdProvider.eIsProxy()) {
// Resolve the connection again
tdProvider = (Connection) EObjectHelper.resolveObject(tdProvider);
}
analysis.getContext().setConnection(tdProvider);
for (TableIndicator tableIndicator : tableIndicators) {
analysisHandler.addIndicator(tableIndicator.getColumnSet(), tableIndicator.getIndicators());
}
} else {
analysis.getContext().setConnection(null);
}
analysisHandler.setStringDataFilter(dataFilterComp.getDataFilterString());
// 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(analysisHandler.getName());
// TDQ-5581,if has removed rules,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.analysis.Analysis in project tdq-studio-se by Talend.
the class BusinessRuleAnalysisResultPage method createResultDataComposite.
private void createResultDataComposite(final Composite comp, final TableIndicator tableIndicator) {
if (tableIndicator.getIndicators().length != 0) {
final NamedColumnSet set = tableIndicator.getColumnSet();
IRunnableWithProgress rwp = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask(DefaultMessagesImpl.getString("TableAnalysisResultPage.createPreview", set.getName()), // $NON-NLS-1$
IProgressMonitor.UNKNOWN);
Display.getDefault().asyncExec(new Runnable() {
public void run() {
Map<EIndicatorChartType, List<TableIndicatorUnit>> indicatorComposite = CompositeIndicator.getInstance().getTableIndicatorComposite(tableIndicator);
for (EIndicatorChartType chartType : indicatorComposite.keySet()) {
List<TableIndicatorUnit> units = indicatorComposite.get(chartType);
if (!units.isEmpty()) {
// create UI
ExpandableComposite subComp = createSubWholeComposite(comp, chartType);
final Composite composite = createCompositeForTableAndChart(subComp);
Composite tableTopComp = createTableComposite(composite);
Analysis analysis = masterPage.getAnalysisHandler().getAnalysis();
ITableTypeStates tableTypeState = TableTypeStatesFactory.getInstance().getTableStateForRule(chartType, units, tableIndicator);
// create table for RownCountIndicator
createTableViewerForRowCount(chartType, units, tableTopComp, analysis, tableTypeState);
// create table for WhereRuleIndicator
createTableForWhereRule(chartType, tableTopComp, analysis, tableTypeState, units);
Composite chartTopComp = createTableComposite(composite);
if (canShowChartForResultPage()) {
createChartsForRules(tableIndicator, chartType, units, analysis, chartTopComp);
}
subComp.setClient(composite);
subComp.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
form.reflow(true);
}
});
}
}
}
/**
* DOC yyin Comment method "createChartsForRules".
*
* @param tableIndicator
* @param chartType
* @param units
* @param analysis
* @param chartTopComp
*/
private void createChartsForRules(final TableIndicator tableIndicator, EIndicatorChartType chartType, List<TableIndicatorUnit> units, Analysis analysis, Composite chartTopComp) {
IChartTypeStates chartTypeState = ChartTypeStatesFactory.getChartStateOfTableAna(chartType, units, tableIndicator);
// get all indicator lists separated by chart, and only
// WhereRuleStatisticsStateTable can get not-null charts
List<List<Indicator>> pagedIndicators = ((WhereRuleStatisticsStateTable) chartTypeState).getPagedIndicators();
// Added TDQ-9241: for each list(for each chart), check if the current
// list has been registered dynamic event
List<Object> datasets = new ArrayList<Object>();
for (List<Indicator> oneChart : pagedIndicators) {
IEventReceiver event = EventManager.getInstance().findRegisteredEvent(oneChart.get(0), EventEnum.DQ_DYMANIC_CHART, 0);
if (event != null) {
// get the dataset from the event
Object dataset = ((TableDynamicChartEventReceiver) event).getDataset();
// one running)
if (dataset != null) {
datasets.add(dataset);
}
}
// ~
}
// create chart
List<Object> charts = null;
if (datasets.size() > 0) {
charts = chartTypeState.getChartList(datasets);
} else {
charts = chartTypeState.getChartList();
datasets = ((WhereRuleStatisticsStateTable) chartTypeState).getTempDatasetList();
}
if (charts != null) {
int index = 0;
for (int i = 0; i < charts.size(); i++) {
Object chart2 = charts.get(i);
Object chartComp = TOPChartUtils.getInstance().createChartCompositeWithSpecialSize(chartTopComp, SWT.NONE, chart2, true, 250, 550);
// Added TDQ-8787 20140707 yyin: create and store the dynamic model for
// each chart
DynamicIndicatorModel dyModel = AnalysisUtils.createDynamicModel(chartType, pagedIndicators.get(index++), chart2);
dynamicList.add(dyModel);
// ~
// one dataset <--> one chart
addMenuToChartComp(chartComp, chartTypeState.getDataExplorer(), analysis, ((ICustomerDataset) datasets.get(i)).getDataEntities());
}
}
}
/**
* DOC yyin Comment method "createTableForWhereRule".
*
* @param chartType
* @param tableTopComp
* @param analysis
* @param tableTypeState
* @param units
* @return
*/
private void createTableForWhereRule(EIndicatorChartType chartType, Composite tableTopComp, Analysis analysis, ITableTypeStates tableTypeState, List<TableIndicatorUnit> units) {
TableWithData chartData = new TableWithData(chartType, tableTypeState.getDataEntity());
TableViewer tableviewer = tableTypeState.getTableForm(tableTopComp);
tableviewer.setInput(chartData);
ChartTableFactory.addMenuAndTip(tableviewer, tableTypeState.getDataExplorer(), analysis);
// Added TDQ-8787 20140707 yyin: create and store the dynamic model
List<Indicator> allRules = new ArrayList<Indicator>();
List<TableIndicatorUnit> removeRowCountUnit = ((WhereRuleStatisticsTableState) tableTypeState).removeRowCountUnit(units);
for (TableIndicatorUnit indUnit : removeRowCountUnit) {
allRules.add(indUnit.getIndicator());
}
DynamicIndicatorModel dyModel = AnalysisUtils.createDynamicModel(chartType, allRules, null);
dyModel.setTableViewer(tableviewer);
dynamicList.add(dyModel);
}
/**
* DOC yyin Comment method "createTableViewerForRowCount".
*
* @param chartType
* @param units
* @param tableTopComp
* @param analysis
* @param tableTypeState
*/
private void createTableViewerForRowCount(EIndicatorChartType chartType, List<TableIndicatorUnit> units, Composite tableTopComp, Analysis analysis, ITableTypeStates tableTypeState) {
WhereRuleStatisticsTableState tableWhereRule = (WhereRuleStatisticsTableState) tableTypeState;
TableWithData chartDataRowCount = new TableWithData(chartType, tableWhereRule.getDataEntityOfRowCount());
TableViewer tableviewerRowCount = tableWhereRule.getTableFormRowCount(tableTopComp);
tableviewerRowCount.setInput(chartDataRowCount);
ChartTableFactory.addMenuAndTip(tableviewerRowCount, tableTypeState.getDataExplorer(), analysis);
// Added TDQ-8787 20140707 yyin: create and store the dynamic model for row
// count's table
List<Indicator> rowCount = new ArrayList<Indicator>();
rowCount.add(tableWhereRule.getRownCountUnit(units).getIndicator());
DynamicIndicatorModel dyModel = AnalysisUtils.createDynamicModel(chartType, rowCount, null);
dyModel.setTableViewer(tableviewerRowCount);
dynamicList.add(dyModel);
}
/**
* DOC yyin Comment method "createTableComposite".
*
* @param composite
* @return
*/
private Composite createTableComposite(final Composite composite) {
Composite tableTopComp = toolkit.createComposite(composite, SWT.NULL);
tableTopComp.setLayout(new GridLayout(1, false));
tableTopComp.setLayoutData(new GridData(GridData.FILL_BOTH));
return tableTopComp;
}
/**
* DOC yyin Comment method "createCompositeForTableAndChart".
*
* @param subComp
* @return
*/
private Composite createCompositeForTableAndChart(ExpandableComposite subComp) {
final Composite composite = toolkit.createComposite(subComp, SWT.NULL);
composite.setLayout(new GridLayout(2, false));
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
return composite;
}
/**
* DOC yyin Comment method "createSubWholeComposite".
*
* @param comp
* @param chartType
* @return
*/
private ExpandableComposite createSubWholeComposite(final Composite comp, EIndicatorChartType chartType) {
ExpandableComposite subComp = toolkit.createExpandableComposite(comp, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.EXPANDED);
subComp.setText(chartType.getLiteral());
subComp.setLayoutData(new GridData(GridData.FILL_BOTH));
subComp.setExpanded(EditorPreferencePage.isUnfoldingIndicatorsResultPage());
return subComp;
}
});
monitor.done();
}
};
try {
new ProgressMonitorDialog(this.getEditorSite().getShell()).run(true, false, rwp);
} catch (Exception ex) {
log.error(ex, ex);
}
}
}
use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.
the class ColumnAnalysisDetailsPage method saveAnalysis.
/**
* @param outputFolder
* @throws DataprofilerCoreException
*/
@Override
public void saveAnalysis() throws DataprofilerCoreException {
analysisHandler.changeDefaultRowLoaded(rowLoadedText.getText());
analysisHandler.changeSampleDataShowWay(sampleDataShowWayCombo.getText());
analysisHandler.clearAnalysis();
Analysis analysis = analysisHandler.getAnalysis();
for (Domain domain : getCurrentModelElement().getParameters().getDataFilter()) {
domain.setName(getCurrentModelElement().getName());
}
analysis.getParameters().setExecutionLanguage(ExecutionLanguage.get(execLang));
// save the number of connections per analysis
this.saveNumberOfConnectionsPerAnalysis();
try {
// MOD zshen feature 12919 to save analysisParameter.
analysis.getParameters().setMaxNumberRows(Integer.parseInt(maxNumText.getText()));
} catch (NumberFormatException nfe) {
// $NON-NLS-1$
MessageDialogWithToggle.openError(// $NON-NLS-1$
null, // $NON-NLS-1$
DefaultMessagesImpl.getString("AbstractAnalysisMetadataPage.SaveAnalysis"), // $NON-NLS-1$
DefaultMessagesImpl.getString(// $NON-NLS-1$
"ColumnMasterDetailsPage.emptyField", // $NON-NLS-1$
DefaultMessagesImpl.getString("ColumnMasterDetailsPage.maxNumberLabel")));
maxNumText.setText(String.valueOf(analysis.getParameters().getMaxNumberRows()));
}
analysis.getParameters().setStoreData(drillDownCheck.getSelection());
// ~12919
ModelElementIndicator[] modelElementIndicators = this.getCurrentModelElementIndicators();
if (modelElementIndicators != null && modelElementIndicators.length != 0) {
Connection tdProvider = ModelElementIndicatorHelper.getTdDataProvider(modelElementIndicators[0]);
if (tdProvider.eIsProxy()) {
// Resolve the connection again
tdProvider = (Connection) EObjectHelper.resolveObject(tdProvider);
}
analysis.getContext().setConnection(tdProvider);
for (ModelElementIndicator modelElementIndicator : modelElementIndicators) {
IRepositoryViewObject reposObject = modelElementIndicator.getModelElementRepositoryNode().getObject();
ModelElement modelEle = null;
if (reposObject instanceof MetadataColumnRepositoryObject) {
modelEle = ((MetadataColumnRepositoryObject) reposObject).getTdColumn();
}
analysisHandler.addIndicator(modelEle, modelElementIndicator.getIndicators());
DataminingType type = MetadataHelper.getDataminingType(modelEle);
if (type == null) {
type = MetadataHelper.getDefaultDataminingType(modelElementIndicator.getJavaType());
}
analysisHandler.setDatamingType(type.getLiteral(), modelEle);
}
} else {
analysis.getContext().setConnection(null);
}
analysisHandler.setStringDataFilter(dataFilterComp.getDataFilterString());
// 2011.1.12 MOD by zshen to unify anlysis and connection id when saving.
this.nameText.setText(analysisHandler.getName());
TaggedValueHelper.setTaggedValue(getCurrentModelElement(), TaggedValueHelper.IS_USE_SAMPLE_DATA, isRunWithSampleData.toString());
// TDQ-5581,if has removed emlements(patten/udi),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);
}
Aggregations