Search in sources :

Example 1 with ExecutionLanguage

use of org.talend.dataquality.analysis.ExecutionLanguage in project tdq-studio-se by Talend.

the class IndicatorPaginationInfo method createMenuForAllDataEntity.

/**
 * DOC yyin Comment method "createMenuForAllDataEntity".
 *
 * @param shell
 * @param dataExplorer
 * @param analysis
 * @param chartDataEntities
 * @return
 */
protected Map<String, Object> createMenuForAllDataEntity(Composite composite, DataExplorer dataExplorer, Analysis analysis, ChartDataEntity[] chartDataEntities) {
    Map<String, Object> menuMap = new HashMap<String, Object>();
    final ExecutionLanguage currentEngine = analysis.getParameters().getExecutionLanguage();
    // ADD msjian TDQ-7275 2013-5-21: when allow drill down is not checked, no menu display
    if (ExecutionLanguage.JAVA == currentEngine && !analysis.getParameters().isStoreData()) {
        return menuMap;
    }
    // TDQ-7275~
    for (ChartDataEntity oneDataEntity : chartDataEntities) {
        Indicator indicator = oneDataEntity.getIndicator();
        Menu menu = TOPChartUtils.getInstance().createMenu(composite, dataExplorer, analysis, oneDataEntity, indicator, false);
        ChartTableFactory.addJobGenerationMenu(menu, analysis, indicator);
        menuMap.put(oneDataEntity.getLabel(), menu);
    }
    return menuMap;
}
Also used : HashMap(java.util.HashMap) ExecutionLanguage(org.talend.dataquality.analysis.ExecutionLanguage) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) Menu(org.eclipse.swt.widgets.Menu) Indicator(org.talend.dataquality.indicators.Indicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 2 with ExecutionLanguage

use of org.talend.dataquality.analysis.ExecutionLanguage in project tdq-studio-se by Talend.

the class ColumnAnalysisDetailsPage method addListenerToExecuteEngine.

private void addListenerToExecuteEngine(final CCombo execCombo1, final Composite javaEnginSection) {
    execCombo1.addSelectionListener(new SelectionAdapter() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
             */
        @Override
        public void widgetSelected(SelectionEvent e) {
            // MOD xqliu 2009-08-24 bug 8776
            execLang = execCombo1.getText();
            // MOD zshen 11104 2010-01-27: when have a datePatternFreqIndicator in the
            // "analyzed Columns",ExecutionLanguage only is Java.
            ExecutionLanguage currentLanguage = ExecutionLanguage.get(execLang);
            if (ExecutionLanguage.SQL.equals(currentLanguage) && includeJavaEngineIndicator()) {
                String dialogMessage = getNonJavaIndicatorMessage();
                MessageUI.openWarning(dialogMessage);
                changeExecuteLanguageToJava(false);
                execLang = execCombo1.getText();
                return;
            } else if (ExecutionLanguage.JAVA.equals(currentLanguage) && checkSqlEngineIndicatorExist()) {
                if (isRunWithSampleData) {
                    // $NON-NLS-1$
                    MessageUI.openWarning(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.SqlIndicatorExistWarning"));
                } else {
                    // $NON-NLS-1$
                    MessageUI.openWarning(DefaultMessagesImpl.getString("ColumnMasterDetailsPage.SqlIndicatorExistWarning2"));
                }
                changeExecuteLanguageToSql(true);
                execLang = execCombo1.getText();
                return;
            }
            refreshEnginSection(javaEnginSection, currentLanguage);
        }
    });
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ExecutionLanguage(org.talend.dataquality.analysis.ExecutionLanguage)

Example 3 with ExecutionLanguage

use of org.talend.dataquality.analysis.ExecutionLanguage in project tdq-studio-se by Talend.

the class AbstractAnalysisMetadataPage method createExecuteEngineSection.

/**
 * Extracted from the column and column set master page, to create the execution language selection section
 *
 * @param form1
 * @param anasisDataComp
 * @param analyzedColumns
 * @param anaParameters
 * @return
 */
protected Composite createExecuteEngineSection(final ScrolledForm form1, Composite anasisDataComp, EList<ModelElement> analyzedColumns, AnalysisParameters anaParameters) {
    analysisParamSection = createSection(form1, anasisDataComp, DefaultMessagesImpl.getString("ColumnMasterDetailsPage.AnalysisParameter"), // $NON-NLS-1$
    null);
    Composite sectionClient = toolkit.createComposite(analysisParamSection);
    sectionClient.setLayout(new GridLayout(1, false));
    Composite comp1 = new Composite(sectionClient, SWT.NONE);
    this.createAnalysisLimitComposite(comp1);
    Composite comp2 = new Composite(sectionClient, SWT.NONE);
    comp2.setLayout(new GridLayout(2, false));
    GridDataFactory.fillDefaults().grab(true, true).applyTo(comp2);
    // $NON-NLS-1$
    toolkit.createLabel(comp2, DefaultMessagesImpl.getString("ColumnMasterDetailsPage.ExecutionEngine"));
    // MOD zshen:need to use the component with finish indicator Selection.
    execCombo = new CCombo(comp2, SWT.BORDER);
    // ~
    execCombo.setEditable(false);
    // run with sample data mode only used by java engin
    if (this.isRunWithSampleData) {
        execCombo.setEnabled(false);
    }
    for (ExecutionLanguage language : ExecutionLanguage.VALUES) {
        String temp = language.getLiteral();
        execCombo.add(temp);
    }
    // MOD qiongli 2011-3-17 set DataFilterText disabled except TdColumn.
    if (analyzedColumns != null && !analyzedColumns.isEmpty()) {
        ModelElement mod = analyzedColumns.get(0);
        TdColumn tdColumn = SwitchHelpers.COLUMN_SWITCH.doSwitch(mod);
        dataFilterComp.getDataFilterText().setEnabled((tdColumn != null) ? true : false);
        if (tdColumn == null) {
            dataFilterComp.getDataFilterText().setEnabled(false);
            changeExecuteLanguageToJava(true);
        }
    }
    ExecutionLanguage executionLanguage = getCurrentModelElement().getParameters().getExecutionLanguage();
    execLang = executionLanguage.getLiteral();
    execCombo.setText(execLang);
    // ADD xqliu 2009-08-24 bug 8776
    setLanguageToTreeViewer(ExecutionLanguage.get(execLang));
    // ~
    // MOD msjian TDQ-9467: this part is only for column analysis
    createDrillDownPart(anaParameters, comp2, executionLanguage);
    analysisParamSection.setClient(sectionClient);
    return comp2;
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) GridLayout(org.eclipse.swt.layout.GridLayout) CCombo(org.eclipse.swt.custom.CCombo) TdColumn(org.talend.cwm.relational.TdColumn) Composite(org.eclipse.swt.widgets.Composite) ExecutionLanguage(org.talend.dataquality.analysis.ExecutionLanguage)

Example 4 with ExecutionLanguage

use of org.talend.dataquality.analysis.ExecutionLanguage in project tdq-studio-se by Talend.

the class UDIUtils method createIndicatorUnit.

public static IndicatorUnit[] createIndicatorUnit(IndicatorDefinition udid, ModelElementIndicator meIndicator, Analysis analysis) throws Throwable {
    List<IndicatorUnit> addIndicatorUnits = new ArrayList<IndicatorUnit>();
    // can't add the same user defined indicator
    for (Indicator indicator : meIndicator.getIndicators()) {
        // MOD xwang 2011-08-01 bug TDQ-2730
        if (udid.getName().equals(indicator.getName()) && indicator instanceof UserDefIndicator) {
            // $NON-NLS-1$
            MessageUI.openWarning(DefaultMessagesImpl.getString("UDIUtils.UDISelected", udid.getName()));
            return null;
        }
    }
    Indicator udi = UDIFactory.createUserDefIndicator(udid);
    udi.setIndicatorDefinition(udid);
    // MOD mzhao feature 11128, Handle Java User Defined Indicator.
    Indicator judi = UDIHelper.adaptToJavaUDI(udi);
    if (judi != null) {
        udi = judi;
    }
    IEditorPart activeEditor = CorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    if (activeEditor == null || !(activeEditor instanceof AnalysisEditor)) {
        return null;
    }
    ExecutionLanguage executionLanguage = ((AnalysisEditor) activeEditor).getUIExecuteEngin();
    boolean isJavaEngin = ExecutionLanguage.JAVA.equals(executionLanguage);
    DbmsLanguage dbmsLanguage = DbmsLanguageFactory.createDbmsLanguage(analysis, executionLanguage);
    Expression returnExpression = dbmsLanguage.getExpression(udi);
    String executeType = isJavaEngin ? executionLanguage.getName() : dbmsLanguage.getDbmsName();
    // MOD qiongli 2013.5.22 TDQ-7282.if don't find a valid java expression for JUDI,should also pop this dialog.
    boolean finddExpression = true;
    if (isJavaEngin && judi == null || !isJavaEngin && returnExpression == null) {
        finddExpression = false;
    }
    if (!finddExpression) {
        // open the editor
        boolean openUDI = MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), DefaultMessagesImpl.getString("PatternUtilities.Warning"), // $NON-NLS-1$ //$NON-NLS-2$
        DefaultMessagesImpl.getString("UDIUtils.NoExpression", executeType));
        if (openUDI) {
            RepositoryNode node = RepositoryNodeHelper.recursiveFind(udid);
            if (RepositoryNodeHelper.canOpenEditor(node)) {
                new OpenItemEditorAction(new IRepositoryNode[] { node }).run();
            }
        }
        return null;
    }
    // dbmsLanguage
    IndicatorParameters parameters = udi.getParameters();
    if (parameters == null) {
        parameters = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
        udi.setParameters(parameters);
    }
    Domain indicatorValidDomain = parameters.getIndicatorValidDomain();
    if (indicatorValidDomain == null) {
        // $NON-NLS-1$
        indicatorValidDomain = DomainHelper.createDomain("JAVA_UDI_PARAMETERS");
        parameters.setIndicatorValidDomain(indicatorValidDomain);
    }
    List<IndicatorDefinitionParameter> indicatorDefs = udid.getIndicatorDefinitionParameter();
    for (IndicatorDefinitionParameter idp : indicatorDefs) {
        JavaUDIIndicatorParameter judip = DomainHelper.createJavaUDIIndicatorParameter(idp.getKey(), idp.getValue());
        indicatorValidDomain.getJavaUDIIndicatorParameter().add(judip);
    }
    IndicatorEnum indicatorType = IndicatorEnum.findIndicatorEnum(udi.eClass());
    addIndicatorUnits.add(meIndicator.addSpecialIndicator(indicatorType, udi));
    DependenciesHandler.getInstance().setUsageDependencyOn(analysis, udid);
    return addIndicatorUnits.toArray(new IndicatorUnit[addIndicatorUnits.size()]);
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ArrayList(java.util.ArrayList) JavaUDIIndicatorParameter(org.talend.dataquality.domain.JavaUDIIndicatorParameter) ExecutionLanguage(org.talend.dataquality.analysis.ExecutionLanguage) IEditorPart(org.eclipse.ui.IEditorPart) DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) OpenItemEditorAction(org.talend.dataprofiler.core.ui.action.actions.OpenItemEditorAction) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) UserDefIndicator(org.talend.dataquality.indicators.sql.UserDefIndicator) Indicator(org.talend.dataquality.indicators.Indicator) DbmsLanguage(org.talend.dq.dbms.DbmsLanguage) TdExpression(org.talend.cwm.relational.TdExpression) Expression(orgomg.cwm.objectmodel.core.Expression) IndicatorDefinitionParameter(org.talend.dataquality.indicators.definition.IndicatorDefinitionParameter) AnalysisEditor(org.talend.dataprofiler.core.ui.editor.analysis.AnalysisEditor) Domain(org.talend.dataquality.domain.Domain) UserDefIndicator(org.talend.dataquality.indicators.sql.UserDefIndicator)

Example 5 with ExecutionLanguage

use of org.talend.dataquality.analysis.ExecutionLanguage in project tdq-studio-se by Talend.

the class AnalysisExecutorSelector method getAnalysisExecutor.

/**
 * Method "getAnalysisExecutor".
 *
 * @param analysis the analysis to be run by the executor.
 * @return the appropriate executor of the analysis or null when no appropriate executor has been found.
 */
public static IAnalysisExecutor getAnalysisExecutor(Analysis analysis) {
    assert analysis != null;
    AnalysisType analysisType = AnalysisHelper.getAnalysisType(analysis);
    if (analysisType == null) {
        // $NON-NLS-1$
        log.error(Messages.getString("AnalysisExecutorSelector.ANALYSISTYPEISNOTSET", analysis.getName()));
        return null;
    }
    ExecutionLanguage executionEngine = AnalysisHelper.getExecutionEngine(analysis);
    IAnalysisExecutor exec = null;
    switch(analysisType) {
        case MULTIPLE_COLUMN:
            exec = getModelElementAnalysisExecutor(analysis, executionEngine);
            break;
        case CONNECTION:
            exec = new ConnectionAnalysisExecutor();
            break;
        case SCHEMA:
            exec = new SchemaAnalysisExecutor();
            break;
        case CATALOG:
            exec = new CatalogAnalysisExecutor();
            break;
        case COLUMNS_COMPARISON:
            exec = new RowMatchingAnalysisExecutor();
            break;
        case COLUMN_CORRELATION:
            exec = new MultiColumnAnalysisExecutor();
            break;
        case COLUMN_SET:
            // MOD yyi 2011-02-22 17871:delimitefile
            exec = getColumnSetAnalysisExecutor(analysis, executionEngine);
            break;
        case TABLE:
            exec = new TableAnalysisSqlExecutor();
            break;
        case TABLE_FUNCTIONAL_DEPENDENCY:
            exec = new FunctionalDependencyExecutor();
            break;
        case MATCH_ANALYSIS:
            exec = new MatchAnalysisExecutor();
            break;
        default:
            // this should not happen. This executor has not been tested for a long time.
            exec = null;
    }
    return exec;
}
Also used : AnalysisType(org.talend.dataquality.analysis.AnalysisType) ExecutionLanguage(org.talend.dataquality.analysis.ExecutionLanguage)

Aggregations

ExecutionLanguage (org.talend.dataquality.analysis.ExecutionLanguage)12 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)4 Indicator (org.talend.dataquality.indicators.Indicator)3 IndicatorEnum (org.talend.dq.nodes.indicator.type.IndicatorEnum)3 IRepositoryNode (org.talend.repository.model.IRepositoryNode)3 IEditorPart (org.eclipse.ui.IEditorPart)2 OpenItemEditorAction (org.talend.dataprofiler.core.ui.action.actions.OpenItemEditorAction)2 AnalysisEditor (org.talend.dataprofiler.core.ui.editor.analysis.AnalysisEditor)2 IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)2 DbmsLanguage (org.talend.dq.dbms.DbmsLanguage)2 RepositoryNode (org.talend.repository.model.RepositoryNode)2 DataManager (orgomg.cwm.foundation.softwaredeployment.DataManager)2 Expression (orgomg.cwm.objectmodel.core.Expression)2 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1 CCombo (org.eclipse.swt.custom.CCombo)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1