Search in sources :

Example 1 with PackagesAnalyisParameter

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

the class SchemaAnalysisWizard method initCWMResourceBuilder.

@Override
public ModelElement initCWMResourceBuilder() {
    Analysis analysis = (Analysis) super.initCWMResourceBuilder();
    if (getAnalysisBuilder() != null) {
        // MOD klliu 15750 2011-1-05 add the repnode on parameter
        PackagesAnalyisParameter packageParameter = getParameter();
        IRepositoryNode connectionRepNode = getParameter().getConnectionRepNode();
        ConnectionItem item = (ConnectionItem) connectionRepNode.getObject().getProperty().getItem();
        Connection tdProvider = item.getConnection();
        // Connection tdProvider = packageParameter.getTdDataProvider();
        getAnalysisBuilder().setAnalysisConnection(tdProvider);
        Indicator[] indicators = new Indicator[packageParameter.getPackages().size()];
        ModelElement[] modelElement = new ModelElement[packageParameter.getPackages().size()];
        int i = 0;
        for (IRepositoryNode node : packageParameter.getPackages()) {
            SchemaIndicator createSchemaIndicator = SchemaFactory.eINSTANCE.createSchemaIndicator();
            DBSchemaRepNode catalogNode = (DBSchemaRepNode) node;
            Schema schema = ((MetadataSchemaRepositoryObject) catalogNode.getObject()).getSchema();
            modelElement[i] = schema;
            DefinitionHandler.getInstance().setDefaultIndicatorDefinition(createSchemaIndicator);
            createSchemaIndicator.setAnalyzedElement(schema);
            indicators[i] = createSchemaIndicator;
            i++;
        }
        getAnalysisBuilder().addElementsToAnalyze(modelElement, indicators);
    }
    return analysis;
}
Also used : SchemaIndicator(org.talend.dataquality.indicators.schema.SchemaIndicator) DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Schema(orgomg.cwm.resource.relational.Schema) Connection(org.talend.core.model.metadata.builder.connection.Connection) SchemaIndicator(org.talend.dataquality.indicators.schema.SchemaIndicator) Indicator(org.talend.dataquality.indicators.Indicator) MetadataSchemaRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataSchemaRepositoryObject) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) PackagesAnalyisParameter(org.talend.dq.analysis.parameters.PackagesAnalyisParameter) Analysis(org.talend.dataquality.analysis.Analysis)

Example 2 with PackagesAnalyisParameter

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

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

the class CatalogAnalysisDPSelectionPage method addListeners.

@Override
protected void addListeners() {
    addListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            Object object = ((IStructuredSelection) event.getSelection()).getFirstElement();
            if (object instanceof Catalog) {
                advanceToNextPageOrFinish();
            }
        }
    });
    addListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            try {
                Object object = ((IStructuredSelection) event.getSelection()).getFirstElement();
                PackagesAnalyisParameter catalogPanameter = (PackagesAnalyisParameter) getConnectionParams();
                List<IRepositoryNode> nodes = new ArrayList<IRepositoryNode>();
                if (object instanceof DBCatalogRepNode) {
                    DBCatalogRepNode catalogNode = (DBCatalogRepNode) object;
                    Catalog catalog = ((MetadataCatalogRepositoryObject) catalogNode.getObject()).getCatalog();
                    Connection tdProvider = ConnectionHelper.getTdDataProvider(SwitchHelpers.PACKAGE_SWITCH.doSwitch(catalog));
                    nodes.add(catalogNode);
                    if (tdProvider != null && catalogPanameter != null) {
                        catalogPanameter.setTdDataProvider(tdProvider);
                        catalogPanameter.setConnectionRepNode((DBConnectionRepNode) catalogNode.getParent());
                        catalogPanameter.setPackages(nodes);
                    }
                    setPageComplete(true);
                } else {
                    setPageComplete(false);
                }
            } catch (Exception e) {
                log.error(e, e);
            }
        }
    });
}
Also used : DBConnectionRepNode(org.talend.dq.nodes.DBConnectionRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Connection(org.talend.core.model.metadata.builder.connection.Connection) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) Catalog(orgomg.cwm.resource.relational.Catalog) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) PackagesAnalyisParameter(org.talend.dq.analysis.parameters.PackagesAnalyisParameter) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) MetadataCatalogRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject) ArrayList(java.util.ArrayList) List(java.util.List)

Example 4 with PackagesAnalyisParameter

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

the class MatchAnalysisAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
public void run() {
    PackagesAnalyisParameter packaFilterParameter = new PackagesAnalyisParameter();
    if (needselection) {
        IRepositoryNode firstElement = (RepositoryNode) this.selection.getFirstElement();
        IRepositoryViewObject viewObject = firstElement.getObject();
        Item item = viewObject.getProperty().getItem();
        ConnectionItem connectionItem = (ConnectionItem) item;
        Connection connection = connectionItem.getConnection();
        IRepositoryNode repositoryNode = RepositoryNodeHelper.recursiveFind(connection);
        packaFilterParameter.setConnectionRepNode(repositoryNode);
    }
    if (openMatchAnalysisDialog(packaFilterParameter) == Window.OK) {
        AnalysisEditor editor = (AnalysisEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
        if (editor != null) {
            MatchAnalysisDetailsPage page = (MatchAnalysisDetailsPage) editor.getMasterPage();
            IRepositoryNode[] columns = getColumns();
            if (this.needselection && columns.length > 0) {
                page.updateAnalyzeDataLabel(columns[0]);
                page.setSelectedNodes(columns);
            }
            page.doSave(null);
        }
    }
}
Also used : ConnectionItem(org.talend.core.model.properties.ConnectionItem) Item(org.talend.core.model.properties.Item) IRepositoryNode(org.talend.repository.model.IRepositoryNode) PackagesAnalyisParameter(org.talend.dq.analysis.parameters.PackagesAnalyisParameter) ConnectionItem(org.talend.core.model.properties.ConnectionItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) Connection(org.talend.core.model.metadata.builder.connection.Connection) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) AnalysisEditor(org.talend.dataprofiler.core.ui.editor.analysis.AnalysisEditor) MatchAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.MatchAnalysisDetailsPage)

Example 5 with PackagesAnalyisParameter

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

the class OverviewAnalysisAction method run.

@Override
public void run() {
    PackagesAnalyisParameter packaFilterParameter = new PackagesAnalyisParameter();
    catalogs.clear();
    for (IRepositoryNode node : nodes) {
        if (node instanceof DBConnectionRepNode) {
            packaFilterParameter.setConnectionRepNode((DBConnectionRepNode) node);
            connNode = (DBConnectionRepNode) node;
        } else if (node instanceof DBCatalogRepNode) {
            IRepositoryNode parent = ((DBCatalogRepNode) node).getParent();
            packaFilterParameter.setConnectionRepNode((DBConnectionRepNode) parent);
            catalogs.add(node);
            packaFilterParameter.setPackages(catalogs);
            cataNode = (DBCatalogRepNode) node;
        } else if (node instanceof DBSchemaRepNode) {
            IRepositoryNode parent = ((DBSchemaRepNode) node).getParent();
            schemaNode = (DBSchemaRepNode) node;
            if (parent instanceof DBCatalogRepNode) {
                IRepositoryNode connNode = ((DBCatalogRepNode) parent).getParent();
                packaFilterParameter.setConnectionRepNode((DBConnectionRepNode) connNode);
                catalogs.add(schemaNode);
                packaFilterParameter.setPackages(catalogs);
            } else {
                catalogs.add(schemaNode);
                packaFilterParameter.setConnectionRepNode((DBConnectionRepNode) parent);
                packaFilterParameter.setPackages(catalogs);
            }
        }
    }
    Wizard wizard = null;
    if (connNode != null) {
        packaFilterParameter.setConnectionRepNode(connNode);
        wizard = WizardFactory.createAnalysisWizard(AnalysisType.CONNECTION, packaFilterParameter);
    } else if (cataNode != null) {
        wizard = WizardFactory.createAnalysisWizard(AnalysisType.CATALOG, packaFilterParameter);
    } else if (schemaNode != null) {
        wizard = WizardFactory.createAnalysisWizard(AnalysisType.SCHEMA, packaFilterParameter);
    }
    WizardDialog dialog = new WizardDialog(null, wizard);
    dialog.setPageSize(WIDTH, HEIGHT);
    dialog.open();
}
Also used : DBConnectionRepNode(org.talend.dq.nodes.DBConnectionRepNode) DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) PackagesAnalyisParameter(org.talend.dq.analysis.parameters.PackagesAnalyisParameter) Wizard(org.eclipse.jface.wizard.Wizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

PackagesAnalyisParameter (org.talend.dq.analysis.parameters.PackagesAnalyisParameter)8 IRepositoryNode (org.talend.repository.model.IRepositoryNode)7 Connection (org.talend.core.model.metadata.builder.connection.Connection)6 ConnectionItem (org.talend.core.model.properties.ConnectionItem)4 DBCatalogRepNode (org.talend.dq.nodes.DBCatalogRepNode)4 DBSchemaRepNode (org.talend.dq.nodes.DBSchemaRepNode)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)3 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)3 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)3 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)3 DBConnectionRepNode (org.talend.dq.nodes.DBConnectionRepNode)3 RepositoryNode (org.talend.repository.model.RepositoryNode)3 Item (org.talend.core.model.properties.Item)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 MetadataCatalogRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject)2 MetadataSchemaRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataSchemaRepositoryObject)2 AnalysisEditor (org.talend.dataprofiler.core.ui.editor.analysis.AnalysisEditor)2 Analysis (org.talend.dataquality.analysis.Analysis)2