Search in sources :

Example 11 with MetadataCatalogRepositoryObject

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

the class ConnectionAnalysisDetailsPage method getCatalogIndicators.

@Override
public List<OverviewIndUIElement> getCatalogIndicators() {
    ConnectionIndicator conIndicator = (ConnectionIndicator) getCurrentModelElement().getResults().getIndicators().get(0);
    Connection analyzedElement = (Connection) conIndicator.getAnalyzedElement();
    EList<CatalogIndicator> catalogIndicators = conIndicator.getCatalogIndicators();
    List<OverviewIndUIElement> cataUIEleList = new ArrayList<OverviewIndUIElement>();
    RepositoryNode connNode = RepositoryNodeHelper.recursiveFind(analyzedElement);
    for (Indicator indicator : catalogIndicators) {
        if (connNode != null) {
            for (IRepositoryNode catalogNode : connNode.getChildren()) {
                Catalog catalog = ((MetadataCatalogRepositoryObject) catalogNode.getObject()).getCatalog();
                String connUuid = ResourceHelper.getUUID(catalog);
                String anaUuid = ResourceHelper.getUUID(indicator.getAnalyzedElement());
                if (connUuid.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) Connection(org.talend.core.model.metadata.builder.connection.Connection) CatalogIndicator(org.talend.dataquality.indicators.schema.CatalogIndicator) ArrayList(java.util.ArrayList) MetadataCatalogRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) 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) Catalog(orgomg.cwm.resource.relational.Catalog) OverviewIndUIElement(org.talend.dataprofiler.core.model.OverviewIndUIElement) ConnectionIndicator(org.talend.dataquality.indicators.schema.ConnectionIndicator)

Example 12 with MetadataCatalogRepositoryObject

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

the class AbstractCommonActionProviderRealProjectTest method testGetConnectionCase6.

/**
 * Test method for
 * {@link org.talend.dataprofiler.core.ui.action.provider.AbstractCommonActionProvider#getConnection(java.lang.Object)}
 * . case6 :input parameter is DBTableFolderRepNode
 */
@Test
public void testGetConnectionCase6() {
    // create FileConnection
    // connection
    IRepositoryViewObject lastVersion = null;
    String propertyID = createConnectionItem(connectionName, null, null);
    // $NON-NLS-1$
    Catalog createCatalog = createCatalog("catalog1");
    try {
        lastVersion = factory.getLastVersion(propertyID);
        lastVersion = new MetadataCatalogRepositoryObject(lastVersion, createCatalog);
    } catch (PersistenceException e) {
        log.error(e, e);
        Assert.fail(e.getMessage());
    }
    // ~connection data
    // ~FileConnection
    // create DFColumnFolderRepNode
    Assert.assertFalse(lastVersion == null);
    RepositoryNode dbCatalogRepNode = DQRepNodeCreateFactory.createDBCatalogRepNode(lastVersion, null, ENodeType.TDQ_REPOSITORY_ELEMENT, null);
    DBTableFolderRepNode dbTableFolderRepNode = new DBTableFolderRepNode(null, dbCatalogRepNode, null, null);
    // ~DFColumnFolderRepNode
    AbstractCommonActionProvider provider = new AbstractCommonActionProvider();
    Connection connection = provider.getConnection(dbTableFolderRepNode);
    Assert.assertTrue(connection != null);
}
Also used : DBTableFolderRepNode(org.talend.dq.nodes.DBTableFolderRepNode) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) Connection(org.talend.core.model.metadata.builder.connection.Connection) MetadataCatalogRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject) RepositoryNode(org.talend.repository.model.RepositoryNode) Catalog(orgomg.cwm.resource.relational.Catalog) Test(org.junit.Test)

Example 13 with MetadataCatalogRepositoryObject

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

Example 14 with MetadataCatalogRepositoryObject

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

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

the class DBSchemaRepNode method getParentViewObject.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dq.nodes.DQRepositoryNode#getParentViewObject()
     */
@Override
protected IRepositoryViewObject getParentViewObject() {
    IRepositoryViewObject packageViewObject = null;
    Package parentPackage = PackageHelper.getParentPackage(getSchema());
    if (parentPackage == null) {
        return metadataSchemaObject.getViewObject();
    } else if (parentPackage instanceof Catalog) {
        packageViewObject = new MetadataCatalogRepositoryObject(metadataSchemaObject.getViewObject(), (Catalog) parentPackage);
    }
    return packageViewObject;
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) Package(orgomg.cwm.objectmodel.core.Package) MetadataCatalogRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject) Catalog(orgomg.cwm.resource.relational.Catalog)

Aggregations

MetadataCatalogRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject)20 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)13 RepositoryNode (org.talend.repository.model.RepositoryNode)12 Catalog (orgomg.cwm.resource.relational.Catalog)12 IRepositoryNode (org.talend.repository.model.IRepositoryNode)9 ArrayList (java.util.ArrayList)6 Connection (org.talend.core.model.metadata.builder.connection.Connection)6 MetadataSchemaRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataSchemaRepositoryObject)6 PersistenceException (org.talend.commons.exception.PersistenceException)4 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)4 Schema (orgomg.cwm.resource.relational.Schema)4 Test (org.junit.Test)3 TdTable (org.talend.cwm.relational.TdTable)3 TdView (org.talend.cwm.relational.TdView)3 Package (orgomg.cwm.objectmodel.core.Package)3 Indicator (org.talend.dataquality.indicators.Indicator)2 CatalogIndicator (org.talend.dataquality.indicators.schema.CatalogIndicator)2 PackagesAnalyisParameter (org.talend.dq.analysis.parameters.PackagesAnalyisParameter)2 List (java.util.List)1 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1