Search in sources :

Example 1 with AnalysisLabelParameter

use of org.talend.dq.analysis.parameters.AnalysisLabelParameter in project tdq-studio-se by Talend.

the class NewWizardSelectionPage method addListeners.

protected void addListeners() {
    typeTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            AnalysisTypeNode node = (AnalysisTypeNode) ((IStructuredSelection) event.getSelection()).getFirstElement();
            if (node == null) {
                return;
            }
            AnalysisTypeNode parent = (AnalysisTypeNode) node.getParent();
            IContext context = HelpSystem.getContext(HelpPlugin.getDefault().getAnalysisHelpContextID());
            IHelpResource[] relatedTopics = context.getRelatedTopics();
            String href = null;
            String currentLiteral = node.getLiteral();
            if (AnalysisLabelParameter.FUNCTIONAL_DEPENDENCY_ANALYSIS.equals(currentLiteral)) {
                currentLiteral = AnalysisType.TABLE_FUNCTIONAL_DEPENDENCY.getLiteral();
            } else if (AnalysisLabelParameter.CONNECTION_OVERVIEW_ANALYSIS.equals(currentLiteral)) {
                currentLiteral = AnalysisType.CONNECTION.getLiteral();
            } else if (AnalysisLabelParameter.CATALOG_OVERVIEW_ANALYSIS.equals(currentLiteral)) {
                currentLiteral = AnalysisType.CATALOG.getLiteral();
            } else if (AnalysisLabelParameter.SCHEMA_OVERVIEW_ANALYSIS.equals(currentLiteral)) {
                currentLiteral = AnalysisType.SCHEMA.getLiteral();
            }
            AnalysisType currentType = AnalysisType.get(currentLiteral);
            if (parent == null) {
                setPageComplete(false);
                // MOD hcheng 2009-06-05 add help in analysis wizard
                switch(currentType) {
                    case CONNECTION:
                        href = relatedTopics[0].getHref();
                        break;
                    case COLUMNS_COMPARISON:
                        href = relatedTopics[4].getHref();
                        break;
                    case TABLE:
                        href = relatedTopics[6].getHref();
                        break;
                    case MULTIPLE_COLUMN:
                        href = relatedTopics[11].getHref();
                        break;
                    case COLUMN_CORRELATION:
                        href = relatedTopics[18].getHref();
                        break;
                    default:
                }
            } else {
                AnalysisParameter parameter = null;
                AnalysisType parentType = AnalysisType.get(parent.getLiteral());
                FolderProvider folderProvider = getCurrentFolderProvider() == null ? ((CreateNewAnalysisWizard) getWizard()).getCurrentFolderProvider() : getCurrentFolderProvider();
                switch(parentType) {
                    case COLUMN_CORRELATION:
                        AnalysisParameter correlationColumnParam = new AnalysisLabelParameter();
                        ((AnalysisLabelParameter) correlationColumnParam).setCategoryLabel(node.getName());
                        correlationColumnParam.setFolderProvider(folderProvider);
                        parameter = correlationColumnParam;
                        if (AnalysisLabelParameter.NUMBERIC_CORRELATION.equals(currentLiteral)) {
                            href = relatedTopics[19].getHref();
                        } else if (AnalysisLabelParameter.DATE_CORRELATION.equals(currentLiteral)) {
                            href = relatedTopics[20].getHref();
                        } else if (AnalysisLabelParameter.NOMINAL_CORRELATION.equals(currentLiteral)) {
                            href = relatedTopics[21].getHref();
                        } else {
                            href = relatedTopics[18].getHref();
                        }
                        break;
                    case MULTIPLE_COLUMN:
                        AnalysisParameter multipleColumnParam = new AnalysisLabelParameter();
                        ((AnalysisLabelParameter) multipleColumnParam).setCategoryLabel(node.getName());
                        multipleColumnParam.setFolderProvider(folderProvider);
                        parameter = multipleColumnParam;
                        if (AnalysisLabelParameter.SEMANTIC_DISCOVERY_ANALYSIS.equals(currentLiteral)) {
                            href = relatedTopics[12].getHref();
                        } else if (AnalysisLabelParameter.BASIC_COLUMN_ANALYSIS.equals(currentLiteral)) {
                            href = relatedTopics[13].getHref();
                        } else if (AnalysisLabelParameter.NOMINAL_VALUES_ANALYSIS.equals(currentLiteral)) {
                            href = relatedTopics[14].getHref();
                        } else if (AnalysisLabelParameter.PATTERN_FREQUENCY_ANALYSIS.equals(currentLiteral)) {
                            href = relatedTopics[15].getHref();
                        } else if (AnalysisLabelParameter.DISCRETE_DATA_ANALYSIS.equals(currentLiteral)) {
                            href = relatedTopics[16].getHref();
                        } else if (AnalysisLabelParameter.SUMMARY_STATISTICS_ANALYSIS.equals(currentLiteral)) {
                            href = relatedTopics[17].getHref();
                        } else {
                            href = relatedTopics[13].getHref();
                        }
                        break;
                    case COLUMNS_COMPARISON:
                        AnalysisParameter anaParam = new AnalysisParameter();
                        anaParam.setFolderProvider(folderProvider);
                        parameter = anaParam;
                        href = relatedTopics[5].getHref();
                        break;
                    case CONNECTION:
                        switch(currentType) {
                            case CONNECTION:
                            default:
                                AnalysisFilterParameter connParam = new AnalysisFilterParameter();
                                connParam.setFolderProvider(folderProvider);
                                parameter = connParam;
                                href = relatedTopics[1].getHref();
                                parentType = currentType;
                                break;
                            case CATALOG:
                                PackagesAnalyisParameter catalogParam = new PackagesAnalyisParameter();
                                catalogParam.setFolderProvider(folderProvider);
                                parameter = catalogParam;
                                href = relatedTopics[2].getHref();
                                parentType = currentType;
                                break;
                            case SCHEMA:
                                PackagesAnalyisParameter schemaParam = new PackagesAnalyisParameter();
                                schemaParam.setFolderProvider(folderProvider);
                                parameter = schemaParam;
                                href = relatedTopics[3].getHref();
                                parentType = currentType;
                                break;
                        }
                        break;
                    case TABLE:
                        switch(currentType) {
                            case MATCH_ANALYSIS:
                                parameter = new AnalysisParameter();
                                parameter.setFolderProvider(folderProvider);
                                href = relatedTopics[8].getHref();
                                parentType = currentType;
                                break;
                            case COLUMN_SET:
                                AnalysisParameter corrParam = new AnalysisParameter();
                                corrParam.setFolderProvider(folderProvider);
                                parameter = corrParam;
                                href = relatedTopics[10].getHref();
                                parentType = currentType;
                                break;
                            case TABLE_FUNCTIONAL_DEPENDENCY:
                                FuncationDependencyParameter funcationDependency = new FuncationDependencyParameter();
                                funcationDependency.setFolderProvider(folderProvider);
                                parameter = funcationDependency;
                                href = relatedTopics[9].getHref();
                                parentType = currentType;
                                break;
                            default:
                                NamedColumnSetAnalysisParameter tableParam = new NamedColumnSetAnalysisParameter();
                                tableParam.setFolderProvider(folderProvider);
                                parameter = tableParam;
                                href = relatedTopics[7].getHref();
                                break;
                        }
                        break;
                    default:
                        parameter = new AnalysisParameter();
                }
                selectedWizard = WizardFactory.createAnalysisWizard(parentType, parameter);
                setPageComplete(true);
            }
            // MOD by hcheng,0007483: Add help in analysis wizard
            OpeningHelpWizardDialog dialog = (OpeningHelpWizardDialog) getWizard().getContainer();
            dialog.setHref(href);
            dialog.showHelp();
        }
    });
    typeTreeViewer.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            AnalysisTypeNode node = (AnalysisTypeNode) ((IStructuredSelection) event.getSelection()).getFirstElement();
            if (node.getParent() == null) {
                typeTreeViewer.expandToLevel(node, 1);
            } else {
                advanceToNextPageOrFinish();
            }
        }
    });
}
Also used : AnalysisType(org.talend.dataquality.analysis.AnalysisType) AnalysisTypeNode(org.talend.dataprofiler.core.model.nodes.analysis.AnalysisTypeNode) IContext(org.eclipse.help.IContext) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) OpeningHelpWizardDialog(org.talend.dataprofiler.core.ui.utils.OpeningHelpWizardDialog) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) NamedColumnSetAnalysisParameter(org.talend.dq.analysis.parameters.NamedColumnSetAnalysisParameter) FuncationDependencyParameter(org.talend.dq.analysis.parameters.FuncationDependencyParameter) FolderProvider(org.talend.cwm.management.api.FolderProvider) PackagesAnalyisParameter(org.talend.dq.analysis.parameters.PackagesAnalyisParameter) NamedColumnSetAnalysisParameter(org.talend.dq.analysis.parameters.NamedColumnSetAnalysisParameter) AnalysisParameter(org.talend.dq.analysis.parameters.AnalysisParameter) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) AnalysisFilterParameter(org.talend.dq.analysis.parameters.AnalysisFilterParameter) AnalysisLabelParameter(org.talend.dq.analysis.parameters.AnalysisLabelParameter)

Example 2 with AnalysisLabelParameter

use of org.talend.dq.analysis.parameters.AnalysisLabelParameter in project tdq-studio-se by Talend.

the class CreateNewAnalysisAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.ui.cheatsheets.ICheatSheetAction#run(java.lang.String[],
     * org.eclipse.ui.cheatsheets.ICheatSheetManager)
     */
public void run(String[] params, ICheatSheetManager manager) {
    // ADD xqliu TDQ-4285 2011-12-27
    if (!CheatSheetActionHelper.canRun()) {
        return;
    }
    // passed parameter.
    if (params == null || params.length == 0) {
        return;
    }
    Integer analysisCatigory = null;
    if (NumberUtils.isNumber(params[0])) {
        analysisCatigory = NumberUtils.toInt(params[0]);
    }
    AnalysisType analysisType = null;
    Wizard wizard = null;
    if (analysisCatigory != null) {
        switch(analysisCatigory) {
            case AnalysisType.BUSINESS_RULE_VALUE:
                analysisType = AnalysisType.TABLE;
                wizard = WizardFactory.createAnalysisWizard(analysisType);
                break;
            case AnalysisType.TABLE_FUNCTIONAL_DEPENDENCY_VALUE:
                analysisType = AnalysisType.TABLE_FUNCTIONAL_DEPENDENCY;
                wizard = WizardFactory.createAnalysisWizard(analysisType);
                break;
            case AnalysisType.COLUMN_SET_VALUE:
                analysisType = AnalysisType.COLUMN_SET;
                wizard = WizardFactory.createAnalysisWizard(analysisType);
                break;
            case AnalysisType.MULTIPLE_COLUMN_VALUE:
                analysisType = AnalysisType.MULTIPLE_COLUMN;
                wizard = WizardFactory.createAnalysisWizard(analysisType);
                break;
            case AnalysisType.CATALOG_VALUE:
                analysisType = AnalysisType.CATALOG;
                wizard = WizardFactory.createAnalysisWizard(analysisType);
                break;
            case AnalysisType.SCHEMA_VALUE:
                analysisType = AnalysisType.SCHEMA;
                wizard = WizardFactory.createAnalysisWizard(analysisType);
                break;
            case AnalysisType.COLUMNS_COMPARISON_VALUE:
                analysisType = AnalysisType.COLUMNS_COMPARISON;
                wizard = WizardFactory.createAnalysisWizard(analysisType);
                break;
            case AnalysisType.COLUMN_CORRELATION_VALUE:
                analysisType = AnalysisType.COLUMN_CORRELATION;
                if (params[1] != null) {
                    if (NumberUtils.isNumber(params[1])) {
                        AnalysisLabelParameter parameter = new AnalysisLabelParameter();
                        parameter.setAnalysisTypeName(analysisType.getLiteral());
                        int correAnaType = NumberUtils.toInt(params[1]);
                        if (correAnaType == 0) {
                            parameter.setCategoryLabel(AnalysisLabelParameter.NUMBERIC_CORRELATION);
                        } else if (correAnaType == 1) {
                            parameter.setCategoryLabel(AnalysisLabelParameter.NOMINAL_CORRELATION);
                        } else {
                            parameter.setCategoryLabel(AnalysisLabelParameter.DATE_CORRELATION);
                        }
                        wizard = WizardFactory.createAnalysisWizard(analysisType, parameter);
                    }
                }
                break;
            case AnalysisType.MATCH_ANALYSIS_VALUE:
                analysisType = AnalysisType.MATCH_ANALYSIS;
                wizard = WizardFactory.createAnalysisWizard(analysisType);
                break;
            default:
                break;
        }
    }
    if (analysisType == null || wizard == null) {
        return;
    }
    wizard.setForcePreviousAndNextButtons(true);
    WizardDialog dialog = new WizardDialog(null, wizard);
    dialog.setPageSize(500, 340);
    if (WizardDialog.OK == dialog.open()) {
        ProxyRepositoryManager.getInstance().save();
    }
}
Also used : AnalysisType(org.talend.dataquality.analysis.AnalysisType) CreateNewAnalysisWizard(org.talend.dataprofiler.core.ui.wizard.analysis.CreateNewAnalysisWizard) Wizard(org.eclipse.jface.wizard.Wizard) OpeningHelpWizardDialog(org.talend.dataprofiler.core.ui.utils.OpeningHelpWizardDialog) WizardDialog(org.eclipse.jface.wizard.WizardDialog) AnalysisLabelParameter(org.talend.dq.analysis.parameters.AnalysisLabelParameter)

Example 3 with AnalysisLabelParameter

use of org.talend.dq.analysis.parameters.AnalysisLabelParameter in project tdq-studio-se by Talend.

the class AbstractPredefinedAnalysisAction method getStandardAnalysisWizardDialog.

protected WizardDialog getStandardAnalysisWizardDialog(AnalysisType type) {
    // MOD klliu 2011-02-17 feature 15387
    AnalysisLabelParameter parameter = null;
    Object firstElement = this.selection.getFirstElement();
    if (firstElement instanceof IRepositoryNode) {
        IRepositoryNode node = (IRepositoryNode) firstElement;
        Item item = node.getObject().getProperty().getItem();
        if (item instanceof ConnectionItem) {
            ConnectionItem connectionItem = (ConnectionItem) item;
            Connection connection = connectionItem.getConnection();
            IRepositoryNode repositoryNode = RepositoryNodeHelper.recursiveFind(connection);
            parameter = new AnalysisLabelParameter();
            parameter.setCategoryLabel(getCategoryLabel());
            parameter.setColumnNodes(getColumns());
            parameter.setConnectionRepNode(repositoryNode);
            return getStandardAnalysisWizardDialog(type, parameter);
        }
    } else if (firstElement instanceof TdTable) {
        Connection connection = ConnectionHelper.getConnection((TdTable) firstElement);
        IRepositoryNode repositoryNode = RepositoryNodeHelper.recursiveFind(connection);
        parameter = new AnalysisLabelParameter();
        parameter.setCategoryLabel(getCategoryLabel());
        parameter.setColumnNodes(getColumns());
        parameter.setConnectionRepNode(repositoryNode);
        return getStandardAnalysisWizardDialog(type, parameter);
    } else if (firstElement instanceof TdView) {
        // Added yyin 20120522 TDQ-4945, support tdView
        Connection connection = ConnectionHelper.getConnection((TdView) firstElement);
        IRepositoryNode repositoryNode = RepositoryNodeHelper.recursiveFind(connection);
        parameter = new AnalysisLabelParameter();
        parameter.setCategoryLabel(getCategoryLabel());
        parameter.setColumnNodes(getColumns());
        parameter.setConnectionRepNode(repositoryNode);
        return getStandardAnalysisWizardDialog(type, parameter);
    // ~4945
    }
    return getStandardAnalysisWizardDialog(type, null);
}
Also used : ConnectionItem(org.talend.core.model.properties.ConnectionItem) Item(org.talend.core.model.properties.Item) TdTable(org.talend.cwm.relational.TdTable) IRepositoryNode(org.talend.repository.model.IRepositoryNode) TdView(org.talend.cwm.relational.TdView) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Connection(org.talend.core.model.metadata.builder.connection.Connection) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) MetadataXmlElementTypeRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataXmlElementTypeRepositoryObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) AnalysisLabelParameter(org.talend.dq.analysis.parameters.AnalysisLabelParameter)

Example 4 with AnalysisLabelParameter

use of org.talend.dq.analysis.parameters.AnalysisLabelParameter in project tdq-studio-se by Talend.

the class AnalyzeColumnCorrelationAction method openStandardAnalysisDialog.

private int openStandardAnalysisDialog(AnalysisType type) {
    AnalysisLabelParameter parameter = new AnalysisLabelParameter();
    checkSelectedColumn();
    if (hasNumberColumn && hasDateColumn) {
        // $NON-NLS-1$
        MessageUI.openError(DefaultMessagesImpl.getString("AnalyzeColumnCorrelationAction.InvalidOperation"));
        return Window.CANCEL;
    } else if (hasNumberColumn && !hasDateColumn) {
        parameter.setCategoryLabel(AnalysisLabelParameter.NUMBERIC_CORRELATION);
    } else if (!hasNumberColumn && hasDateColumn) {
        parameter.setCategoryLabel(AnalysisLabelParameter.DATE_CORRELATION);
    } else {
        parameter.setCategoryLabel(AnalysisLabelParameter.NOMINAL_CORRELATION);
    }
    Wizard wizard = WizardFactory.createAnalysisWizard(type, parameter);
    wizard.setForcePreviousAndNextButtons(true);
    WizardDialog dialog = new WizardDialog(null, wizard);
    dialog.setPageSize(500, 340);
    return dialog.open();
}
Also used : Wizard(org.eclipse.jface.wizard.Wizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog) AnalysisLabelParameter(org.talend.dq.analysis.parameters.AnalysisLabelParameter)

Example 5 with AnalysisLabelParameter

use of org.talend.dq.analysis.parameters.AnalysisLabelParameter in project tdq-studio-se by Talend.

the class ColumnWizard method composePredefinedColumnIndicator.

protected ModelElementIndicator[] composePredefinedColumnIndicator(IndicatorEnum[] allowedEnum) {
    List<IRepositoryNode> nodes;
    // from the right menu
    if (selectionPage == null) {
        nodes = Arrays.asList(((AnalysisLabelParameter) parameter).getColumnNodes());
    } else {
        // TDQ-11240: get all the column nodes
        nodes = Arrays.asList(RepositoryNodeHelper.getAllColumnNodes(selectionPage.nodes.toArray(new IRepositoryNode[selectionPage.nodes.size()])));
    }
    ModelElementIndicator[] predefinedColumnIndicator = new ModelElementIndicator[nodes.size()];
    for (int i = 0; i < nodes.size(); i++) {
        IRepositoryNode columnNode = nodes.get(i);
        ModelElementIndicator columnIndicator = ModelElementIndicatorHelper.createModelElementIndicator(columnNode);
        for (IndicatorEnum oneEnum : allowedEnum) {
            columnIndicator.addTempIndicatorEnum(oneEnum);
            if (oneEnum.getChildren() != null) {
                for (IndicatorEnum childEnum : oneEnum.getChildren()) {
                    // MOD by zshen:need language to decide DatePatternFrequencyIndicator whether can be choose by
                    // user.
                    IRepositoryViewObject object = columnNode.getObject();
                    ModelElement element = null;
                    if (object instanceof MetadataColumnRepositoryObject) {
                        element = ((MetadataColumnRepositoryObject) object).getTdColumn();
                    } else if (object instanceof MetadataXmlElementTypeRepositoryObject) {
                        element = ((MetadataXmlElementTypeRepositoryObject) object).getModelElement();
                    }
                    if (element != null && ModelElementIndicatorRule.patternRule(childEnum, element, ExecutionLanguage.SQL)) {
                        columnIndicator.addTempIndicatorEnum(childEnum);
                    }
                }
            }
        }
        columnIndicator.storeTempIndicator();
        predefinedColumnIndicator[i] = columnIndicator;
    }
    return predefinedColumnIndicator;
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) IRepositoryNode(org.talend.repository.model.IRepositoryNode) IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) MetadataXmlElementTypeRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataXmlElementTypeRepositoryObject) AnalysisLabelParameter(org.talend.dq.analysis.parameters.AnalysisLabelParameter) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Aggregations

AnalysisLabelParameter (org.talend.dq.analysis.parameters.AnalysisLabelParameter)5 Wizard (org.eclipse.jface.wizard.Wizard)2 WizardDialog (org.eclipse.jface.wizard.WizardDialog)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)2 MetadataXmlElementTypeRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataXmlElementTypeRepositoryObject)2 OpeningHelpWizardDialog (org.talend.dataprofiler.core.ui.utils.OpeningHelpWizardDialog)2 AnalysisType (org.talend.dataquality.analysis.AnalysisType)2 IRepositoryNode (org.talend.repository.model.IRepositoryNode)2 IContext (org.eclipse.help.IContext)1 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 Connection (org.talend.core.model.metadata.builder.connection.Connection)1 ConnectionItem (org.talend.core.model.properties.ConnectionItem)1 Item (org.talend.core.model.properties.Item)1 FolderProvider (org.talend.cwm.management.api.FolderProvider)1 TdTable (org.talend.cwm.relational.TdTable)1