Search in sources :

Example 6 with MetadataSchemaRepositoryObject

use of org.talend.core.repository.model.repositoryObject.MetadataSchemaRepositoryObject in project tdq-studio-se by Talend.

the class TableViewFilterActionProvider method fillContextMenu.

@Override
public void fillContextMenu(IMenuManager menu) {
    // MOD mzhao user readonly role on svn repository mode.
    if (!isShowMenu()) {
        return;
    }
    TreeSelection currentSelection = ((TreeSelection) this.getContext().getSelection());
    Object obj = currentSelection.getFirstElement();
    if (obj instanceof RepositoryNode) {
        RepositoryNode node = (RepositoryNode) obj;
        if (ENodeType.TDQ_REPOSITORY_ELEMENT.equals(node.getType())) {
            // MOD gdbu 2011-12-29 TDQ-4283 Remove the "Table/View filter" menu under AnalysisSubFolderRepNode.
            if (node.getParent() instanceof AnalysisSubFolderRepNode) {
                return;
            }
            // ~TDQ-4283
            IRepositoryViewObject viewObject = node.getObject();
            if (viewObject instanceof MetadataSchemaRepositoryObject) {
                MetadataSchemaRepositoryObject schemaObject = (MetadataSchemaRepositoryObject) viewObject;
                // MOD yyin TDQ-4959 20120503
                TableViewFilterAction tvfAction = new TableViewFilterAction(schemaObject.getSchema(), node);
                menu.add(tvfAction);
            } else if (viewObject instanceof MetadataCatalogRepositoryObject) {
                MetadataCatalogRepositoryObject catalogObject = (MetadataCatalogRepositoryObject) viewObject;
                // MOD yyin TDQ-4959 20120503
                TableViewFilterAction tvfAction = new TableViewFilterAction(catalogObject.getCatalog(), node);
                menu.add(tvfAction);
            }
        }
    }
}
Also used : TableViewFilterAction(org.talend.dataprofiler.core.ui.action.actions.TableViewFilterAction) TreeSelection(org.eclipse.jface.viewers.TreeSelection) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataCatalogRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataSchemaRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataSchemaRepositoryObject) MetadataCatalogRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject) RepositoryNode(org.talend.repository.model.RepositoryNode) AnalysisSubFolderRepNode(org.talend.dq.nodes.AnalysisSubFolderRepNode) MetadataSchemaRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataSchemaRepositoryObject)

Example 7 with MetadataSchemaRepositoryObject

use of org.talend.core.repository.model.repositoryObject.MetadataSchemaRepositoryObject 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 MetadataSchemaRepositoryObject

use of org.talend.core.repository.model.repositoryObject.MetadataSchemaRepositoryObject in project tdq-studio-se by Talend.

the class AnalysisSubFolderRepNode method doSwichNode.

/**
 * DOC klliu Comment method "doSwichNode".
 *
 * @param analyzedElement
 * @return
 */
private IRepositoryNode doSwichNode(ModelElement analyzedElement, AnalysisSubFolderRepNode childNodeFolder) {
    Property anaEleProperty = PropertyHelper.getProperty(analyzedElement);
    IRepositoryViewObject medataViewObject = null;
    try {
        medataViewObject = ProxyRepositoryFactory.getInstance().getLastVersion(anaEleProperty.getId());
    } catch (Exception e) {
        log.error(e);
    }
    // }
    if (medataViewObject != null) {
        if (analyzedElement instanceof DatabaseConnection) {
            DBConnectionRepNode connNode = new DBConnectionRepNode(medataViewObject, this, ENodeType.REPOSITORY_ELEMENT, getProject());
            connNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CONNECTIONS);
            connNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CONNECTIONS);
            medataViewObject.setRepositoryNode(connNode);
            return connNode;
        } else if (analyzedElement instanceof Catalog) {
            RepositoryNode catalogNode = DQRepNodeCreateFactory.createDBCatalogRepNode(new MetadataCatalogRepositoryObject(medataViewObject, (Catalog) analyzedElement), this, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
            catalogNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CON_CATALOG);
            catalogNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_CATALOG);
            medataViewObject.setRepositoryNode(catalogNode);
            return catalogNode;
        } else if (analyzedElement instanceof Schema) {
            RepositoryNode schemaNode = new DBSchemaRepNode(new MetadataSchemaRepositoryObject(medataViewObject, (Schema) analyzedElement), this, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
            schemaNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CON_SCHEMA);
            schemaNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_SCHEMA);
            medataViewObject.setRepositoryNode(schemaNode);
            return schemaNode;
        } else if (analyzedElement instanceof TdTable) {
            DBTableRepNode tableNode = new DBTableRepNode(new TdTableRepositoryObject(medataViewObject, (TdTable) analyzedElement), childNodeFolder, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
            tableNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CON_TABLE);
            tableNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_TABLE);
            medataViewObject.setRepositoryNode(tableNode);
            return tableNode;
        } else if (analyzedElement instanceof TdView) {
            DBViewRepNode viewNode = new DBViewRepNode(new TdViewRepositoryObject(medataViewObject, (TdView) analyzedElement), childNodeFolder, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
            viewNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CON_VIEW);
            viewNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_VIEW);
            medataViewObject.setRepositoryNode(viewNode);
            return viewNode;
        } else if (analyzedElement instanceof MetadataColumn) {
            RepositoryNode columnNode = null;
            if (analyzedElement instanceof TdColumn) {
                columnNode = new DBColumnRepNode(new MetadataColumnRepositoryObject(medataViewObject, (MetadataColumn) analyzedElement), childNodeFolder, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
            } else {
                columnNode = new DFColumnRepNode(new MetadataColumnRepositoryObject(medataViewObject, (MetadataColumn) analyzedElement), this, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
            }
            columnNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CON_COLUMN);
            columnNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_COLUMN);
            medataViewObject.setRepositoryNode(columnNode);
            return columnNode;
        }
    }
    return null;
}
Also used : TdTable(org.talend.cwm.relational.TdTable) Schema(orgomg.cwm.resource.relational.Schema) MetadataCatalogRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) TdViewRepositoryObject(org.talend.core.repository.model.repositoryObject.TdViewRepositoryObject) Catalog(orgomg.cwm.resource.relational.Catalog) MetadataSchemaRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataSchemaRepositoryObject) MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) TdColumn(org.talend.cwm.relational.TdColumn) TdView(org.talend.cwm.relational.TdView) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) TdTableRepositoryObject(org.talend.core.repository.model.repositoryObject.TdTableRepositoryObject) Property(org.talend.core.model.properties.Property)

Example 9 with MetadataSchemaRepositoryObject

use of org.talend.core.repository.model.repositoryObject.MetadataSchemaRepositoryObject in project tdq-studio-se by Talend.

the class DBViewFolderRepNode method createParentNode.

/**
 * create the node of parent.
 *
 * @return
 */
private RepositoryNode createParentNode() {
    RepositoryNode dbParentRepNode = null;
    if (viewObject instanceof MetadataCatalogRepositoryObject) {
        dbParentRepNode = DQRepNodeCreateFactory.createDBCatalogRepNode(viewObject, null, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
    } else if (viewObject instanceof MetadataSchemaRepositoryObject) {
        dbParentRepNode = new DBSchemaRepNode(viewObject, null, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
    }
    viewObject.setRepositoryNode(dbParentRepNode);
    return dbParentRepNode;
}
Also used : MetadataCatalogRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) MetadataSchemaRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataSchemaRepositoryObject)

Example 10 with MetadataSchemaRepositoryObject

use of org.talend.core.repository.model.repositoryObject.MetadataSchemaRepositoryObject in project tdq-studio-se by Talend.

the class DBCatalogRepNode method createRepositoryNodeSchema.

/**
 * Create SchemaRepositoryNode under CatalogRepositoryNode.
 *
 * @param node parent CatalogRepositoryNode
 * @param metadataCatalog parent CatalogViewObject
 * @param schema the schema should to be added under the catalog
 */
private List<IRepositoryNode> createRepositoryNodeSchema(List<Schema> schemas) {
    if (!schemaChildren.isEmpty()) {
        return schemaChildren;
    }
    for (Schema schema : schemas) {
        MetadataSchemaRepositoryObject metadataSchema = new MetadataSchemaRepositoryObject(((MetadataCatalogRepositoryObject) getObject()).getViewObject(), schema);
        metadataSchema.setParentCatalogObject(metadataCatalogObject);
        RepositoryNode schemaNode = new DBSchemaRepNode(metadataSchema, this, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
        schemaNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CON_SCHEMA);
        schemaNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_SCHEMA);
        metadataSchema.setRepositoryNode(schemaNode);
        schemaChildren.add(schemaNode);
    }
    return schemaChildren;
}
Also used : Schema(orgomg.cwm.resource.relational.Schema) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) MetadataSchemaRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataSchemaRepositoryObject)

Aggregations

MetadataSchemaRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataSchemaRepositoryObject)11 IRepositoryNode (org.talend.repository.model.IRepositoryNode)7 RepositoryNode (org.talend.repository.model.RepositoryNode)7 Schema (orgomg.cwm.resource.relational.Schema)7 MetadataCatalogRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject)6 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)5 Connection (org.talend.core.model.metadata.builder.connection.Connection)3 DBSchemaRepNode (org.talend.dq.nodes.DBSchemaRepNode)3 Catalog (orgomg.cwm.resource.relational.Catalog)3 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)2 PackagesAnalyisParameter (org.talend.dq.analysis.parameters.PackagesAnalyisParameter)2 Package (orgomg.cwm.objectmodel.core.Package)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 Test (org.junit.Test)1