Search in sources :

Example 6 with PackagesAnalyisParameter

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

the class AnalyzeColumnSetAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
public void run() {
    PackagesAnalyisParameter packaFilterParameter = new PackagesAnalyisParameter();
    if (nodeColumns != null) {
        DQRepositoryNode tFolder = (DQRepositoryNode) nodeColumns.getParent();
        if (tFolder != null) {
            IRepositoryNode node = tFolder.getParent();
            if (node instanceof DBCatalogRepNode) {
                IRepositoryNode connNode = ((DBCatalogRepNode) node).getParent();
                packaFilterParameter.setConnectionRepNode(connNode);
                catalogs.add(node);
                packaFilterParameter.setPackages(catalogs);
            } else if (node instanceof DBSchemaRepNode) {
                schemaNode = (DBSchemaRepNode) node;
                RepositoryNode parent = schemaNode.getParent();
                if (parent instanceof DBCatalogRepNode) {
                    catalogs.add(parent);
                    packaFilterParameter.setConnectionRepNode(parent);
                } else {
                    catalogs.add(schemaNode);
                    packaFilterParameter.setConnectionRepNode(schemaNode);
                }
                packaFilterParameter.setPackages(catalogs);
            }
        }
    }
    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 (opencolumnSetAnalysisDialog(packaFilterParameter) == Window.OK) {
        AnalysisEditor editor = (AnalysisEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
        if (editor != null) {
            ColumnSetAnalysisDetailsPage page = (ColumnSetAnalysisDetailsPage) editor.getMasterPage();
            if (this.needselection && !this.selection.isEmpty()) {
                IRepositoryNode[] nodeArray = new IRepositoryNode[selection.size()];
                Iterator it = this.selection.iterator();
                int i = 0;
                while (it.hasNext()) {
                    nodeArray[i] = (IRepositoryNode) it.next();
                    i++;
                }
                page.setTreeViewInput(nodeArray);
            } else if (!this.needselection && null != this.nodeColumns) {
                List<IRepositoryNode> column = new ArrayList<IRepositoryNode>();
                for (IRepositoryNode columnFolder : nodeColumns.getChildren()) {
                    if (columnFolder instanceof DBColumnFolderRepNode) {
                        column.addAll(columnFolder.getChildren());
                    }
                }
                page.setTreeViewInput(column.toArray());
            }
            page.doSave(null);
        }
    }
}
Also used : DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Connection(org.talend.core.model.metadata.builder.connection.Connection) DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) DBColumnFolderRepNode(org.talend.dq.nodes.DBColumnFolderRepNode) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Item(org.talend.core.model.properties.Item) DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) PackagesAnalyisParameter(org.talend.dq.analysis.parameters.PackagesAnalyisParameter) ColumnSetAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.ColumnSetAnalysisDetailsPage) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) AnalysisEditor(org.talend.dataprofiler.core.ui.editor.analysis.AnalysisEditor)

Example 7 with PackagesAnalyisParameter

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

the class SchemaAnalysisDPSelectionPage method addListeners.

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

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

        public void selectionChanged(SelectionChangedEvent event) {
            Object object = ((IStructuredSelection) event.getSelection()).getFirstElement();
            PackagesAnalyisParameter schemaPanameter = (PackagesAnalyisParameter) getConnectionParams();
            List<IRepositoryNode> nodes = new ArrayList<IRepositoryNode>();
            if (object instanceof DBSchemaRepNode) {
                DBSchemaRepNode schemaNode = (DBSchemaRepNode) object;
                Schema schema = ((MetadataSchemaRepositoryObject) schemaNode.getObject()).getSchema();
                Connection tdProvider = ConnectionHelper.getTdDataProvider(SwitchHelpers.PACKAGE_SWITCH.doSwitch(schema));
                RepositoryNode parent = schemaNode.getParent();
                if (tdProvider != null && schemaPanameter != null) {
                    if (parent instanceof DBCatalogRepNode) {
                        schemaPanameter.setConnectionRepNode((DBConnectionRepNode) parent.getParent());
                    } else {
                        schemaPanameter.setConnectionRepNode((DBConnectionRepNode) parent);
                    }
                    schemaPanameter.setTdDataProvider(tdProvider);
                }
                nodes.add(schemaNode);
                schemaPanameter.setPackages(nodes);
                setPageComplete(true);
            } else {
                setPageComplete(false);
            }
        }
    });
}
Also used : DBConnectionRepNode(org.talend.dq.nodes.DBConnectionRepNode) DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) Schema(orgomg.cwm.resource.relational.Schema) 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) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) PackagesAnalyisParameter(org.talend.dq.analysis.parameters.PackagesAnalyisParameter) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) MetadataSchemaRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataSchemaRepositoryObject) ArrayList(java.util.ArrayList) List(java.util.List)

Example 8 with PackagesAnalyisParameter

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

the class CatalogAnalysisWizard method initCWMResourceBuilder.

@Override
public ModelElement initCWMResourceBuilder() {
    Analysis analysis = (Analysis) super.initCWMResourceBuilder();
    if (getAnalysisBuilder() != null) {
        // DOC 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();
        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()) {
            CatalogIndicator createCatalogIndicator = SchemaFactory.eINSTANCE.createCatalogIndicator();
            // MOD xqliu 2009-1-21 feature 4715
            DefinitionHandler.getInstance().setDefaultIndicatorDefinition(createCatalogIndicator);
            Catalog catalog = ((MetadataCatalogRepositoryObject) node.getObject()).getCatalog();
            modelElement[i] = catalog;
            createCatalogIndicator.setAnalyzedElement(catalog);
            indicators[i] = createCatalogIndicator;
            i++;
        }
        getAnalysisBuilder().addElementsToAnalyze(modelElement, indicators);
    }
    return analysis;
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Connection(org.talend.core.model.metadata.builder.connection.Connection) CatalogIndicator(org.talend.dataquality.indicators.schema.CatalogIndicator) MetadataCatalogRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject) CatalogIndicator(org.talend.dataquality.indicators.schema.CatalogIndicator) Indicator(org.talend.dataquality.indicators.Indicator) Catalog(orgomg.cwm.resource.relational.Catalog) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) PackagesAnalyisParameter(org.talend.dq.analysis.parameters.PackagesAnalyisParameter) Analysis(org.talend.dataquality.analysis.Analysis)

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