Search in sources :

Example 6 with DataManager

use of orgomg.cwm.foundation.softwaredeployment.DataManager in project tdq-studio-se by Talend.

the class AbstractColumnDropTree method initializedConnection.

/**
 * DOC msjian Comment method "initializedConnection". for 6560
 *
 * @param indicators
 */
void initializedConnection(ModelElementIndicator[] indicators) {
    Analysis analysis = getMasterPage().getAnalysisHandler().getAnalysis();
    DataManager connection = analysis.getContext().getConnection();
    // Connection tdDataProvider = null;
    boolean enableWhereClauseFlag = true;
    boolean enableExecuteLanguageFlag = false;
    // ~
    if (indicators != null && indicators.length > 0) {
        if (connection == null) {
            connection = ModelElementIndicatorHelper.getTdDataProvider(indicators[0]);
            analysis.getContext().setConnection(connection);
        }
        if (connection != null && getMasterPage().getExecCombo() != null) {
            if (ConnectionUtils.isDelimitedFileConnection((DataProvider) connection)) {
                getMasterPage().setWhereClauseDisabled();
                // when the selected column is not DB type,will disable the execute engine combobox.
                getMasterPage().changeExecuteLanguageToJava(true);
                enableWhereClauseFlag = false;
                enableExecuteLanguageFlag = false;
            } else {
                // when the selected column is back to DB type, should enable the execute engine combobox again.
                getMasterPage().enableExecuteLanguage();
            }
        }
    }
    // MOD klliu if default ExecutionLanguage is java,it is not changed to SQL.2011-11-21
    String execLang = analysis.getParameters().getExecutionLanguage().getLiteral();
    if (execLang != null && ExecutionLanguage.JAVA.getLiteral().equals(execLang) && (ConnectionUtils.isDelimitedFileConnection((DataProvider) connection))) {
        enableExecuteLanguageFlag = false;
    }
    if (enableWhereClauseFlag) {
        getMasterPage().setWhereClauseEnable();
    }
    if (enableExecuteLanguageFlag) {
        getMasterPage().changeExecuteLanguageToSql(true);
    }
}
Also used : Analysis(org.talend.dataquality.analysis.Analysis) DataManager(orgomg.cwm.foundation.softwaredeployment.DataManager)

Example 7 with DataManager

use of orgomg.cwm.foundation.softwaredeployment.DataManager in project tdq-studio-se by Talend.

the class AbstractPagePart method updateBindConnection.

/**
 * ADD mzhao 2009-05-05 bug:6587.
 */
protected void updateBindConnection(AbstractAnalysisMetadataPage masterPage, Tree tree) {
    if (!isAnalyzedColumnsEmpty(tree)) {
        DataManager dataManager = masterPage.getCurrentModelElement().getContext().getConnection();
        if (dataManager == null) {
            if (tree.getData() instanceof AnalysisColumnNominalIntervalTreeViewer) {
                AnalysisColumnNominalIntervalTreeViewer treeViewer = (AnalysisColumnNominalIntervalTreeViewer) tree.getData();
                RepositoryNode repositoryNode = treeViewer.getColumnSetMultiValueList().get(0);
                dataManager = ((ConnectionItem) repositoryNode.getObject().getProperty().getItem()).getConnection();
            } else if (tree.getData() instanceof AnalysisColumnSetTreeViewer) {
                AnalysisColumnSetTreeViewer treeViewer = (AnalysisColumnSetTreeViewer) tree.getData();
                IRepositoryNode reposNode = treeViewer.getColumnSetMultiValueList().get(0);
                dataManager = ((ConnectionItem) reposNode.getObject().getProperty().getItem()).getConnection();
            }
        }
        setConnectionState(masterPage, dataManager);
    }
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) ConnectionItem(org.talend.core.model.properties.ConnectionItem) DataManager(orgomg.cwm.foundation.softwaredeployment.DataManager) DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode)

Example 8 with DataManager

use of orgomg.cwm.foundation.softwaredeployment.DataManager in project tdq-studio-se by Talend.

the class PatternMouseAdapter method mouseDown.

@Override
public void mouseDown(MouseEvent e) {
    DataManager dm = analysis.getContext().getConnection();
    if (dm == null) {
        masterPage.doSave(null);
    }
    // MOD gdbu 2011-8-26 bug : TDQ-2169
    IRepositoryNode patternFolderNode = getPatternSelectDialogInputData();
    if (patternFolderNode == null) {
        return;
    }
    CheckedTreeSelectionDialog dialog = PatternUtilities.createPatternCheckedTreeSelectionDialog(patternFolderNode);
    if (null != filters) {
        for (ViewerFilter filter : filters) {
            dialog.addFilter(filter);
        }
    }
    // ~TDQ-2169
    Object[] selectedRepNodes = PatternUtilities.getPatternRepNodesByIndicator(meIndicator);
    dialog.setInitialSelections(selectedRepNodes);
    dialog.create();
    if (dialog.open() == Window.OK) {
        // MOD qiongli 2012-10-17 TDQ-5923,just remove some deselected indicatorUnit,just create new indicatorUnit
        // for some new added pattern nodes.
        List<PatternRepNode> allSelectedPatternNodes = new ArrayList<PatternRepNode>();
        Set<String> allSelectedNodeNames = new HashSet<String>();
        for (Object obj : dialog.getResult()) {
            if (obj instanceof PatternRepNode) {
                PatternRepNode patternNode = (PatternRepNode) obj;
                allSelectedPatternNodes.add(patternNode);
                allSelectedNodeNames.add(patternNode.getLabel());
            }
        }
        Set<String> oldSelectedNodeNames = new HashSet<String>();
        Map<String, IndicatorUnit> oldSelectedUnits = new HashMap<String, IndicatorUnit>();
        for (IndicatorUnit indicatorUnit : meIndicator.getIndicatorUnits()) {
            Indicator indicator = indicatorUnit.getIndicator();
            if (indicator instanceof PatternMatchingIndicator) {
                if (!allSelectedNodeNames.contains(indicator.getName())) {
                    // this method will deal dependency with same time
                    columnDropTree.deleteIndicatorItems(meIndicator, indicatorUnit);
                    if (!columnDropTree.isDirty()) {
                        columnDropTree.setDirty(true);
                    }
                } else {
                    oldSelectedNodeNames.add(indicator.getName());
                    oldSelectedUnits.put(indicator.getName(), indicatorUnit);
                }
            }
        }
        // Added yyin 20121121 TDQ-6329: after remove all, should also add the old selected patterns
        // because the columnset does not have pagination, can not refresh automatically
        boolean addOldSelected = false;
        if (masterPage instanceof ColumnSetAnalysisDetailsPage) {
            addOldSelected = true;
        }
        if (addOldSelected) {
            for (TreeItem child : treeItem.getItems()) {
                masterPage.getTreeViewer().removeItemBranch(child);
            }
        }
        // ~
        treeItem.removeAll();
        for (PatternRepNode patternNode : allSelectedPatternNodes) {
            if (oldSelectedNodeNames.contains(patternNode.getLabel()) && !addOldSelected) {
                continue;
            }
            TypedReturnCode<IndicatorUnit> trc = PatternUtilities.createIndicatorUnit(patternNode.getPattern(), meIndicator, analysis);
            if (trc.isOk()) {
                createOneUnit(trc.getObject());
                // TDQ-8860 add msjian 2014-4-30:check whether show allmatchindicator in the indicators section
                if (masterPage instanceof ColumnSetAnalysisDetailsPage) {
                    EventManager.getInstance().publish(analysis, EventEnum.DQ_COLUMNSET_SHOW_MATCH_INDICATORS, null);
                }
            // TDQ-8860~
            }
        }
        treeItem.setExpanded(true);
        if (masterPage instanceof ColumnAnalysisDetailsPage) {
            ColumnAnalysisDetailsPage page = (ColumnAnalysisDetailsPage) masterPage;
            page.refreshTheTree(page.getCurrentModelElementIndicators());
        }
    }
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) CheckedTreeSelectionDialog(org.eclipse.ui.dialogs.CheckedTreeSelectionDialog) HashMap(java.util.HashMap) TreeItem(org.eclipse.swt.widgets.TreeItem) ArrayList(java.util.ArrayList) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) DataManager(orgomg.cwm.foundation.softwaredeployment.DataManager) PatternMatchingIndicator(org.talend.dataquality.indicators.PatternMatchingIndicator) Indicator(org.talend.dataquality.indicators.Indicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) PatternMatchingIndicator(org.talend.dataquality.indicators.PatternMatchingIndicator) ColumnSetAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.ColumnSetAnalysisDetailsPage) ColumnAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.ColumnAnalysisDetailsPage) PatternRepNode(org.talend.dq.nodes.PatternRepNode) HashSet(java.util.HashSet)

Example 9 with DataManager

use of orgomg.cwm.foundation.softwaredeployment.DataManager in project tdq-studio-se by Talend.

the class AbstractSchemaEvaluator method dbms.

protected DbmsLanguage dbms() {
    if (this.dbmsLanguage == null) {
        DataManager dm = this.getDataManager();
        if (dm == null) {
            // $NON-NLS-1$
            throw new RuntimeException("No data manager found.");
        }
        this.dbmsLanguage = DbmsLanguageFactory.createDbmsLanguage(dm);
    }
    return this.dbmsLanguage;
}
Also used : DataManager(orgomg.cwm.foundation.softwaredeployment.DataManager)

Example 10 with DataManager

use of orgomg.cwm.foundation.softwaredeployment.DataManager in project tdq-studio-se by Talend.

the class RespositoryDetailView method createAnaysisDetail.

private void createAnaysisDetail(Analysis ana) {
    if (ana == null) {
        return;
    }
    createName(ana);
    createPurpose(ana);
    createDescription(ana);
    AnalysisParameters parameters = ana.getParameters();
    String description = parameters == null ? null : parameters.getAnalysisType().getLiteral();
    // $NON-NLS-1$
    newLabelAndText(gContainer, DefaultMessagesImpl.getString("RespositoryDetailView.otherType"), description);
    AnalysisContext context = ana.getContext();
    int numn = context == null ? 0 : context.getAnalysedElements().size();
    newLabelAndText(gContainer, DefaultMessagesImpl.getString("RespositoryDetailView.numberOfAnalyzedElements"), // $NON-NLS-1$
    String.valueOf(numn));
    DataManager connection = context == null ? null : context.getConnection();
    if (connection == null) {
        description = null;
    } else {
        description = connection.getName();
    }
    // $NON-NLS-1$
    newLabelAndText(gContainer, DefaultMessagesImpl.getString("RespositoryDetailView.connection"), description);
}
Also used : AnalysisParameters(org.talend.dataquality.analysis.AnalysisParameters) DataManager(orgomg.cwm.foundation.softwaredeployment.DataManager) AnalysisContext(org.talend.dataquality.analysis.AnalysisContext)

Aggregations

DataManager (orgomg.cwm.foundation.softwaredeployment.DataManager)37 Analysis (org.talend.dataquality.analysis.Analysis)8 AnalysisContext (org.talend.dataquality.analysis.AnalysisContext)7 IRepositoryNode (org.talend.repository.model.IRepositoryNode)6 ArrayList (java.util.ArrayList)5 Connection (org.talend.core.model.metadata.builder.connection.Connection)5 TdColumn (org.talend.cwm.relational.TdColumn)4 Indicator (org.talend.dataquality.indicators.Indicator)4 RepositoryNode (org.talend.repository.model.RepositoryNode)4 Dependency (orgomg.cwm.objectmodel.core.Dependency)4 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)4 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)3 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)3 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)3 CompositeIndicator (org.talend.dataquality.indicators.CompositeIndicator)3 SQLException (java.sql.SQLException)2 HashSet (java.util.HashSet)2 List (java.util.List)2 EList (org.eclipse.emf.common.util.EList)2 EObject (org.eclipse.emf.ecore.EObject)2