Search in sources :

Example 1 with AnalysisParameter

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

the class MatchWizardTest method testInitCWMResourceBuilder.

/**
 * Test method for
 * {@link org.talend.dataprofiler.core.ui.wizard.analysis.column.MatchWizard#initCWMResourceBuilder()}.
 */
@Test
public void testInitCWMResourceBuilder() {
    AnalysisParameter anaParameter = new AnalysisParameter();
    // $NON-NLS-1$
    anaParameter.setName("analysis1");
    anaParameter.setAnalysisTypeName(AnalysisType.COLUMN.getName());
    MatchWizard matchWizard = new MatchWizard(anaParameter);
    // Default value should be 10000
    Analysis ana = (Analysis) matchWizard.initCWMResourceBuilder();
    AnalysisHandler anaHandler = AnalysisHandler.createHandler(ana);
    IPreferenceStore preferenceStore = CorePlugin.getDefault().getPreferenceStore();
    int maxRows = preferenceStore.getInt(PluginConstant.MAX_NB_ROWS_ANALYSIS_EDITOR);
    Assert.assertEquals(String.valueOf(maxRows), anaHandler.getDefaultLoadedRowCount());
    // after setting the value, result should be changed too
    // $NON-NLS-1$
    String rowCountValue = "100";
    TaggedValueHelper.setTaggedValue(ana, TaggedValueHelper.PREVIEW_ROW_NUMBER, rowCountValue);
    anaHandler = AnalysisHandler.createHandler(ana);
    Assert.assertEquals(rowCountValue, anaHandler.getDefaultLoadedRowCount());
}
Also used : AnalysisHandler(org.talend.dq.analysis.AnalysisHandler) Analysis(org.talend.dataquality.analysis.Analysis) AnalysisParameter(org.talend.dq.analysis.parameters.AnalysisParameter) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) Test(org.junit.Test)

Example 2 with AnalysisParameter

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

the class AnalysisMetadataWizardPage method createExtendedControl.

/*
     * (non-Javadoc)
     * 
     * @seeorg.talend.dataprofiler.core.ui.wizard.MetadataWizardPage# createExtendedControl()
     */
@Override
protected void createExtendedControl(Composite container) {
    GridData dataForTypeText = new GridData();
    dataForTypeText.widthHint = 200;
    Label typeLabel = new Label(container, SWT.NONE);
    // $NON-NLS-1$
    typeLabel.setText(DefaultMessagesImpl.getString("AnalysisMetadataWizardPage.type"));
    typeText = new Text(container, SWT.BORDER);
    AnalysisParameter parameter = (AnalysisParameter) getParameter();
    // $NON-NLS-1$
    typeText.setText(parameter.getAnalysisTypeName() != null ? parameter.getAnalysisTypeName() : "");
    typeText.setLayoutData(dataForTypeText);
    typeText.setEnabled(false);
}
Also used : AnalysisParameter(org.talend.dq.analysis.parameters.AnalysisParameter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text)

Example 3 with AnalysisParameter

use of org.talend.dq.analysis.parameters.AnalysisParameter 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 4 with AnalysisParameter

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

the class CreateDuplicatesAnalysisAction method createDefaultAnalysisParameter.

/**
 * DOC xqliu Comment method "createDefaultAnalysisParameter".
 *
 * @param columnSet
 * @return
 */
private AnalysisParameter createDefaultAnalysisParameter(ColumnSet columnSet) {
    AnalysisParameter result = new AnalysisParameter();
    // $NON-NLS-1$
    result.setStatus("development");
    result.setAuthor(ProjectManager.getInstance().getCurrentProject().getAuthor().getLogin());
    // $NON-NLS-1$
    result.setPurpose("");
    // $NON-NLS-1$
    result.setDescription("Analysis the duplicated columns on the table " + columnSet.getName());
    result.setVersion(VersionUtils.DEFAULT_VERSION);
    return result;
}
Also used : AnalysisParameter(org.talend.dq.analysis.parameters.AnalysisParameter)

Example 5 with AnalysisParameter

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

the class CreateDateAnalysisAction method getPredefinedDialog.

@Override
protected WizardDialog getPredefinedDialog() {
    AnalysisParameter parameter = new AnalysisParameter();
    parameter.setConnectionRepNode(getColumns()[0]);
    ColumnWizard wizard = (ColumnWizard) WizardFactory.createAnalysisWizard(AnalysisType.MULTIPLE_COLUMN, parameter);
    wizard.setForcePreviousAndNextButtons(true);
    TimeSliceOptionPage page = new TimeSliceOptionPage();
    wizard.setExtenalPages(new WizardPage[] { page });
    return new OpeningHelpWizardDialog(null, wizard, FormEnum.TimeSlicesForm.getHelpHref(), page);
}
Also used : AnalysisParameter(org.talend.dq.analysis.parameters.AnalysisParameter) OpeningHelpWizardDialog(org.talend.dataprofiler.core.ui.utils.OpeningHelpWizardDialog) ColumnWizard(org.talend.dataprofiler.core.ui.wizard.analysis.column.ColumnWizard)

Aggregations

AnalysisParameter (org.talend.dq.analysis.parameters.AnalysisParameter)8 IWizardPage (org.eclipse.jface.wizard.IWizardPage)2 OpeningHelpWizardDialog (org.talend.dataprofiler.core.ui.utils.OpeningHelpWizardDialog)2 AnalysisMetadataWizardPage (org.talend.dataprofiler.core.ui.wizard.analysis.AnalysisMetadataWizardPage)2 IContext (org.eclipse.help.IContext)1 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)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 Wizard (org.eclipse.jface.wizard.Wizard)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 GridData (org.eclipse.swt.layout.GridData)1 Label (org.eclipse.swt.widgets.Label)1 Text (org.eclipse.swt.widgets.Text)1 Test (org.junit.Test)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