Search in sources :

Example 1 with OverviewIndUIElement

use of org.talend.dataprofiler.core.model.OverviewIndUIElement in project tdq-studio-se by Talend.

the class OverviewResultPage method createResultSection.

@Override
protected void createResultSection(Composite parent) {
    statisticalSection = this.createSection(form, parent, DefaultMessagesImpl.getString("ConnectionMasterDetailsPage.statisticalinformations"), // $NON-NLS-1$
    null);
    Composite sectionClient = toolkit.createComposite(statisticalSection);
    sectionClient.setLayout(new GridLayout());
    catalogTableViewer = new TableViewer(sectionClient, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
    Table catalogTable = catalogTableViewer.getTable();
    TableUtils.addActionTooltip(catalogTable);
    catalogTable.setHeaderVisible(true);
    catalogTable.setBackgroundMode(SWT.INHERIT_FORCE);
    catalogTable.setLinesVisible(true);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(catalogTable);
    List<Catalog> catalogs = getCatalogs();
    boolean containSubSchema = false;
    for (Catalog catalog : catalogs) {
        List<Schema> schemas = CatalogHelper.getSchemas(catalog);
        if (schemas.size() > 0) {
            containSubSchema = true;
            break;
        }
    }
    if (catalogs.size() > 0 && containSubSchema) {
        createCatalogSchemaColumns(catalogTable);
        provider = new CatalogSchemaViewerProvier();
        addColumnSorters(catalogTableViewer, catalogTable.getColumns(), catalogWithSchemaSorters);
        createSchemaTableViewer(sectionClient);
        schemaTableViewer.addSelectionChangedListener(new DisplayTableAndViewListener());
        catalogTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {

            public void selectionChanged(SelectionChangedEvent event) {
                StructuredSelection selection = (StructuredSelection) event.getSelection();
                OverviewIndUIElement firstElement = (OverviewIndUIElement) selection.getFirstElement();
                List<OverviewIndUIElement> cataUIEleList = new ArrayList<OverviewIndUIElement>();
                if (firstElement != null) {
                    Indicator overviewIndicator = firstElement.getOverviewIndicator();
                    // selection.getFirstElement();
                    CatalogIndicator catalogIndicator = (CatalogIndicator) overviewIndicator;
                    // MOD qiongli bug 13093,2010-7-2,
                    // selection.getFirstElement();
                    currentCatalogIndicator = (SchemaIndicator) overviewIndicator;
                    // MOD xqliu 2009-11-30 bug 9114
                    if (catalogIndicator != null) {
                        EList<SchemaIndicator> schemaIndicators = catalogIndicator.getSchemaIndicators();
                        for (SchemaIndicator schemaIndicator : schemaIndicators) {
                            RepositoryNode schemaNode = RepositoryNodeHelper.recursiveFind(schemaIndicator.getAnalyzedElement());
                            OverviewIndUIElement cataUIEle = new OverviewIndUIElement();
                            cataUIEle.setNode(schemaNode);
                            cataUIEle.setOverviewIndicator(schemaIndicator);
                            cataUIEleList.add(cataUIEle);
                        }
                        schemaTableViewer.setInput(cataUIEleList);
                        schemaTableViewer.getTable().setVisible(true);
                        addColumnSorters(schemaTableViewer, schemaTableViewer.getTable().getColumns(), schemaSorters);
                    }
                }
            // ~
            }
        });
        createContextMenuFor(schemaTableViewer);
    } else {
        if (catalogs.size() > 0) {
            createCatalogTableColumns(catalogTable);
            provider = new CatalogViewerProvier();
        } else {
            createSchemaTableColumns(catalogTable);
            provider = new SchemaViewerProvier();
        }
        addColumnSorters(catalogTableViewer, catalogTable.getColumns(), schemaSorters);
        catalogTableViewer.addSelectionChangedListener(new DisplayTableAndViewListener());
    }
    catalogTableViewer.setLabelProvider(provider);
    catalogTableViewer.setContentProvider(provider);
    doSetInput();
    tableAndViewComposite = new Composite(sectionClient, SWT.NONE);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(tableAndViewComposite);
    GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = 0;
    layout.horizontalSpacing = 50;
    tableAndViewComposite.setLayout(layout);
    tableAndViewComposite.setVisible(false);
    sectionClient.layout();
    statisticalSection.setClient(sectionClient);
    createContextMenuFor(catalogTableViewer);
}
Also used : SchemaIndicator(org.talend.dataquality.indicators.schema.SchemaIndicator) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) Schema(orgomg.cwm.resource.relational.Schema) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) CatalogIndicator(org.talend.dataquality.indicators.schema.CatalogIndicator) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) Catalog(orgomg.cwm.resource.relational.Catalog) CatalogIndicator(org.talend.dataquality.indicators.schema.CatalogIndicator) SchemaIndicator(org.talend.dataquality.indicators.schema.SchemaIndicator) Indicator(org.talend.dataquality.indicators.Indicator) TableIndicator(org.talend.dataquality.indicators.schema.TableIndicator) ViewIndicator(org.talend.dataquality.indicators.schema.ViewIndicator) GridLayout(org.eclipse.swt.layout.GridLayout) EList(org.eclipse.emf.common.util.EList) OverviewIndUIElement(org.talend.dataprofiler.core.model.OverviewIndUIElement) List(java.util.List) ArrayList(java.util.ArrayList) EList(org.eclipse.emf.common.util.EList) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 2 with OverviewIndUIElement

use of org.talend.dataprofiler.core.model.OverviewIndUIElement in project tdq-studio-se by Talend.

the class OverviewResultPage method wapperInput.

/**
 * DOC klliu Comment method "wapperInput". relations
 *
 * @param indicatorTableList
 * @param parentNode
 * @return
 */
private List<OverviewIndUIElement> wapperInput(EList<TableIndicator> indicatorTableList, IRepositoryNode parentNode) {
    List<OverviewIndUIElement> cataUIEleList = new ArrayList<OverviewIndUIElement>();
    List<IRepositoryNode> children = parentNode.getChildren();
    for (IRepositoryNode folderNode : children) {
        if (folderNode instanceof DBTableFolderRepNode) {
            List<IRepositoryNode> tableNodes = folderNode.getChildren();
            // MOD 20120315 klliu&yyin TDQ-2391, avoid getting many times for table nodes.
            for (TableIndicator indicator : indicatorTableList) {
                boolean equals = false;
                for (IRepositoryNode tableNode : tableNodes) {
                    MetadataTable table = ((MetadataTableRepositoryObject) tableNode.getObject()).getTable();
                    String name = table.getName();
                    String tableName = indicator.getTableName();
                    // String connUuid = ResourceHelper.getUUID(table);
                    // String anaUuid = ResourceHelper.getUUID(indicator.getAnalyzedElement());
                    equals = name.equals(tableName);
                    if (equals) {
                        OverviewIndUIElement tableUIEle = new OverviewIndUIElement();
                        tableUIEle.setNode(tableNode);
                        tableUIEle.setOverviewIndicator(indicator);
                        if (DqRepositoryViewService.isComeFromRefrenceProject(getTdDataProvider()) && ColumnSetHelper.getColumns((ColumnSet) table).isEmpty()) {
                            tableUIEle.setVirtualNode(true);
                        }
                        cataUIEleList.add(tableUIEle);
                        break;
                    }
                }
                if (!equals) {
                    OverviewIndUIElement tableUIEle = new OverviewIndUIElement();
                    tableUIEle.setOverviewIndicator(indicator);
                    tableUIEle.setVirtualNode(true);
                    cataUIEleList.add(tableUIEle);
                }
            }
        }
    }
    return cataUIEleList;
}
Also used : DBTableFolderRepNode(org.talend.dq.nodes.DBTableFolderRepNode) TableIndicator(org.talend.dataquality.indicators.schema.TableIndicator) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ArrayList(java.util.ArrayList) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) OverviewIndUIElement(org.talend.dataprofiler.core.model.OverviewIndUIElement) MetadataTableRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject)

Example 3 with OverviewIndUIElement

use of org.talend.dataprofiler.core.model.OverviewIndUIElement in project tdq-studio-se by Talend.

the class ConnectionAnalysisDetailsPage method getSchemaIndicators.

@Override
public List<OverviewIndUIElement> getSchemaIndicators() {
    ConnectionIndicator conIndicator = (ConnectionIndicator) getCurrentModelElement().getResults().getIndicators().get(0);
    Connection analyzedElement = (Connection) conIndicator.getAnalyzedElement();
    EList<SchemaIndicator> schemaIndicators = conIndicator.getSchemaIndicators();
    List<OverviewIndUIElement> cataUIEleList = new ArrayList<OverviewIndUIElement>();
    RepositoryNode connNode = RepositoryNodeHelper.recursiveFind(analyzedElement);
    for (Indicator indicator : schemaIndicators) {
        if (connNode != null) {
            for (IRepositoryNode schemaNode : connNode.getChildren()) {
                String nodeUuid = ResourceHelper.getUUID(((MetadataSchemaRepositoryObject) schemaNode.getObject()).getSchema());
                String anaUuid = ResourceHelper.getUUID(indicator.getAnalyzedElement());
                if (nodeUuid.equals(anaUuid)) {
                    OverviewIndUIElement cataUIEle = new OverviewIndUIElement();
                    cataUIEle.setNode(schemaNode);
                    cataUIEle.setOverviewIndicator(indicator);
                    cataUIEleList.add(cataUIEle);
                    break;
                }
            }
        }
    }
    return cataUIEleList;
}
Also used : SchemaIndicator(org.talend.dataquality.indicators.schema.SchemaIndicator) IRepositoryNode(org.talend.repository.model.IRepositoryNode) Connection(org.talend.core.model.metadata.builder.connection.Connection) ArrayList(java.util.ArrayList) OverviewIndUIElement(org.talend.dataprofiler.core.model.OverviewIndUIElement) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) ConnectionIndicator(org.talend.dataquality.indicators.schema.ConnectionIndicator) CatalogIndicator(org.talend.dataquality.indicators.schema.CatalogIndicator) ConnectionIndicator(org.talend.dataquality.indicators.schema.ConnectionIndicator) SchemaIndicator(org.talend.dataquality.indicators.schema.SchemaIndicator) Indicator(org.talend.dataquality.indicators.Indicator)

Example 4 with OverviewIndUIElement

use of org.talend.dataprofiler.core.model.OverviewIndUIElement in project tdq-studio-se by Talend.

the class AbstractStatisticalViewerProvider method getColumnText.

public String getColumnText(Object element, int columnIndex) {
    String text = PluginConstant.EMPTY_STRING;
    if (element instanceof OverviewIndUIElement) {
        SchemaIndicator indicator = (SchemaIndicator) ((OverviewIndUIElement) element).getOverviewIndicator();
        switch(columnIndex) {
            case 0:
                // for TDQ-8833 vertica database has a catalog and the name of it is PluginConstant.EMPTY_STRING
                ModelElement analyzedElement = indicator.getAnalyzedElement();
                if (analyzedElement.getClass() == orgomg.cwm.resource.relational.impl.CatalogImpl.class) {
                    if (PluginConstant.EMPTY_STRING.equals(analyzedElement.getName())) {
                        return text = org.talend.dataquality.PluginConstant.DEFAULT_STRING;
                    }
                }
                // ~
                text = analyzedElement.getName();
                return text;
            case 1:
                text = PluginConstant.EMPTY_STRING + indicator.getTableRowCount();
                return text;
            default:
                break;
        }
        return getOtherColumnText(columnIndex, indicator);
    }
    return text;
}
Also used : SchemaIndicator(org.talend.dataquality.indicators.schema.SchemaIndicator) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) OverviewIndUIElement(org.talend.dataprofiler.core.model.OverviewIndUIElement)

Example 5 with OverviewIndUIElement

use of org.talend.dataprofiler.core.model.OverviewIndUIElement in project tdq-studio-se by Talend.

the class CatalogAnalysisDetailsPage method getCatalogIndicators.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataprofiler.core.ui.editor.analysis.AbstractFilterMetadataPage#getCatalogIndicators()
     */
@Override
protected List<OverviewIndUIElement> getCatalogIndicators() {
    List<OverviewIndUIElement> cataUIEleList = new ArrayList<OverviewIndUIElement>();
    EList<Indicator> indicators = getCurrentModelElement().getResults().getIndicators();
    catalogIndicatorList.clear();
    IRepositoryNode connNode = getCurrentConnectionRepNode();
    for (Indicator indicator : indicators) {
        if (connNode != null) {
            for (IRepositoryNode catalogNode : connNode.getChildren()) {
                String nodeUuid = ResourceHelper.getUUID(((MetadataCatalogRepositoryObject) catalogNode.getObject()).getCatalog());
                String anaUuid = ResourceHelper.getUUID(indicator.getAnalyzedElement());
                if (nodeUuid.equals(anaUuid)) {
                    OverviewIndUIElement cataUIEle = new OverviewIndUIElement();
                    cataUIEle.setNode(catalogNode);
                    cataUIEle.setOverviewIndicator(indicator);
                    cataUIEleList.add(cataUIEle);
                    break;
                }
            }
        }
    }
    return cataUIEleList;
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) ArrayList(java.util.ArrayList) OverviewIndUIElement(org.talend.dataprofiler.core.model.OverviewIndUIElement) CatalogIndicator(org.talend.dataquality.indicators.schema.CatalogIndicator) Indicator(org.talend.dataquality.indicators.Indicator)

Aggregations

OverviewIndUIElement (org.talend.dataprofiler.core.model.OverviewIndUIElement)10 ArrayList (java.util.ArrayList)8 IRepositoryNode (org.talend.repository.model.IRepositoryNode)7 Indicator (org.talend.dataquality.indicators.Indicator)5 MetadataTable (org.talend.core.model.metadata.builder.connection.MetadataTable)4 CatalogIndicator (org.talend.dataquality.indicators.schema.CatalogIndicator)4 SchemaIndicator (org.talend.dataquality.indicators.schema.SchemaIndicator)4 RepositoryNode (org.talend.repository.model.RepositoryNode)4 MetadataTableRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject)3 TableIndicator (org.talend.dataquality.indicators.schema.TableIndicator)3 ViewIndicator (org.talend.dataquality.indicators.schema.ViewIndicator)3 List (java.util.List)2 EList (org.eclipse.emf.common.util.EList)2 TableViewer (org.eclipse.jface.viewers.TableViewer)2 Menu (org.eclipse.swt.widgets.Menu)2 Table (org.eclipse.swt.widgets.Table)2 Connection (org.talend.core.model.metadata.builder.connection.Connection)2 ConnectionIndicator (org.talend.dataquality.indicators.schema.ConnectionIndicator)2 Catalog (orgomg.cwm.resource.relational.Catalog)2 IMenuListener (org.eclipse.jface.action.IMenuListener)1