use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.
the class ColumnSetAnalysisDetailsPage method createPreviewSection.
void createPreviewSection(final ScrolledForm form, Composite parent) {
previewSection = createSection(form, parent, DefaultMessagesImpl.getString("ColumnMasterDetailsPage.graphics"), // $NON-NLS-1$ //$NON-NLS-2$
DefaultMessagesImpl.getString("ColumnMasterDetailsPage.space"));
previewSection.setLayoutData(new GridData(GridData.FILL_BOTH));
Composite sectionClient = toolkit.createComposite(previewSection);
sectionClient.setLayout(new GridLayout());
sectionClient.setLayoutData(new GridData(GridData.FILL_BOTH));
Button chartButton = new Button(sectionClient, SWT.NONE);
// $NON-NLS-1$
chartButton.setText(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.refreshGraphics"));
final Label message = toolkit.createLabel(sectionClient, // $NON-NLS-1$
DefaultMessagesImpl.getString("ColumnMasterDetailsPage.spaceWhite"));
message.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
message.setVisible(false);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(sectionClient);
chartComposite = toolkit.createComposite(sectionClient);
chartComposite.setLayout(new GridLayout());
chartComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
final Analysis analysis = columnSetAnalysisHandler.getAnalysis();
chartButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
disposeChartComposite();
boolean analysisStatue = analysis.getResults().getResultMetadata() != null && analysis.getResults().getResultMetadata().getExecutionDate() != null;
if (!analysisStatue) {
boolean returnCode = MessageDialog.openConfirm(null, // $NON-NLS-1$
DefaultMessagesImpl.getString("ColumnMasterDetailsPage.ViewResult"), // $NON-NLS-1$
DefaultMessagesImpl.getString("ColumnMasterDetailsPage.RunOrSeeSampleData"));
if (returnCode) {
new RunAnalysisAction().run();
message.setVisible(false);
} else {
createPreviewCharts(form, chartComposite, false);
// $NON-NLS-1$
message.setText(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.warning"));
message.setVisible(true);
}
} else {
createPreviewCharts(form, chartComposite, true);
}
chartComposite.layout();
form.reflow(true);
}
});
previewSection.setClient(sectionClient);
}
use of org.talend.dataquality.analysis.Analysis 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.analysis.Analysis 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);
}
use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.
the class AbstractAnalysisMetadataPage method getCurrentConnectionRepNode.
protected IRepositoryNode getCurrentConnectionRepNode() {
// MOD klliu 2010-12-10
IEditorInput editorInput = getEditor().getEditorInput();
if (editorInput instanceof AnalysisItemEditorInput) {
AnalysisItemEditorInput fileEditorInput = (AnalysisItemEditorInput) editorInput;
return fileEditorInput.getConnectionNode();
} else {
// ADD TDQ-9613 msjian: when the user do something from the other views for example: from task view
FileEditorInput fileEditorInput = (FileEditorInput) editorInput;
Analysis findAnalysis = AnaResourceFileHelper.getInstance().findAnalysis(fileEditorInput.getFile());
DataManager connection = findAnalysis.getContext().getConnection();
if (connection != null) {
return RepositoryNodeHelper.recursiveFind(connection);
}
// TDQ-9613~
}
return null;
}
use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.
the class AnalysisEditor method translateInput.
@Override
protected void translateInput(IEditorInput input) {
// MOD klliu 2010-12-10
Analysis findAnalysis = null;
// $NON-NLS-1$
String label = "";
if (input instanceof AnalysisItemEditorInput) {
AnalysisItemEditorInput fileEditorInput = (AnalysisItemEditorInput) input;
findAnalysis = (Analysis) fileEditorInput.getModel();
label = fileEditorInput.getName();
} else if (input instanceof FileEditorInput) {
FileEditorInput fileEditorInput = (FileEditorInput) input;
IFile file = fileEditorInput.getFile();
label = file.getFullPath().toString();
if (FactoriesUtil.isAnalysisFile(file.getFileExtension())) {
findAnalysis = AnaResourceFileHelper.getInstance().findAnalysis(file);
}
}
if (findAnalysis != null) {
analysisType = findAnalysis.getParameters().getAnalysisType();
} else {
// $NON-NLS-1$
log.error("Could not find an analysis in file: " + label);
}
}
Aggregations