use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject 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);
}
use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject 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.core.repository.model.repositoryObject.MetadataColumnRepositoryObject 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.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdq-studio-se by Talend.
the class AnalyzeColumnCorrelationProvider method fillContextMenu.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
*/
@SuppressWarnings("unchecked")
@Override
public void fillContextMenu(IMenuManager menu) {
// MOD mzhao user readonly role on svn repository mode.
if (!isShowMenu()) {
return;
}
boolean showMenu = true;
TreeSelection currentSelection = ((TreeSelection) this.getContext().getSelection());
List list = currentSelection.toList();
for (Object obj : list) {
if (obj instanceof RepositoryNode) {
RepositoryNode node = (RepositoryNode) obj;
if (ENodeType.TDQ_REPOSITORY_ELEMENT.equals(node.getType())) {
IRepositoryViewObject viewObject = node.getObject();
if (viewObject instanceof MetadataColumnRepositoryObject) {
showMenu = true;
} else {
showMenu = false;
break;
}
} else {
showMenu = false;
break;
}
} else {
showMenu = false;
break;
}
}
if (showMenu) {
analyzeColumnCorrAction.setColumnSelection(currentSelection);
menu.add(analyzeColumnCorrAction);
}
}
use of org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject in project tdq-studio-se by Talend.
the class CreateDateAnalysis method init.
@Override
public void init(ICommonActionExtensionSite site) {
if (site.getViewSite() instanceof ICommonViewerWorkbenchSite) {
StructuredSelection selection = (StructuredSelection) site.getStructuredViewer().getSelection();
Object fe = selection.getFirstElement();
if (fe instanceof IRepositoryNode) {
IRepositoryViewObject object = ((IRepositoryNode) fe).getObject();
if (object instanceof MetadataColumnRepositoryObject) {
MetadataColumnRepositoryObject columnObject = (MetadataColumnRepositoryObject) object;
modelElement = columnObject.getTdColumn();
}
}
}
super.init(site);
}
Aggregations