Search in sources :

Example 6 with MDMConnection

use of org.talend.core.model.metadata.builder.connection.MDMConnection in project tdq-studio-se by Talend.

the class TOPRepositoryService method removeAliasInSQLExplorer.

public boolean removeAliasInSQLExplorer(IRepositoryNode children) {
    boolean hasDependencyItem = true;
    // MOD klliu 2011-04-28 bug 20204 removing connection is synced to the connection view of SQL explore
    Item item = children.getObject().getProperty().getItem();
    // MOD mzhao filter the connections which is not a type of database.
    if (item != null && item instanceof ConnectionItem) {
        Connection connection = ((ConnectionItem) item).getConnection();
        if (connection instanceof DatabaseConnection || connection instanceof DelimitedFileConnection || connection instanceof MDMConnection) {
            CWMPlugin.getDefault().removeAliasInSQLExplorer(connection);
        }
    }
    return hasDependencyItem;
}
Also used : ConnectionItem(org.talend.core.model.properties.ConnectionItem) Item(org.talend.core.model.properties.Item) DatabaseConnectionItem(org.talend.core.model.properties.DatabaseConnectionItem) ConnectionItem(org.talend.core.model.properties.ConnectionItem) DatabaseConnectionItem(org.talend.core.model.properties.DatabaseConnectionItem) IMetadataConnection(org.talend.core.model.metadata.IMetadataConnection) DelimitedFileConnection(org.talend.core.model.metadata.builder.connection.DelimitedFileConnection) MDMConnection(org.talend.core.model.metadata.builder.connection.MDMConnection) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) Connection(org.talend.core.model.metadata.builder.connection.Connection) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) DelimitedFileConnection(org.talend.core.model.metadata.builder.connection.DelimitedFileConnection) MDMConnection(org.talend.core.model.metadata.builder.connection.MDMConnection)

Example 7 with MDMConnection

use of org.talend.core.model.metadata.builder.connection.MDMConnection in project tdi-studio-se by Talend.

the class MdmConceptMigrationTask method execute.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.core.model.migration.AbstractItemMigrationTask#execute(org.talend.core.model.properties.Item)
     */
@Override
public ExecutionResult execute(Item item) {
    if (item instanceof MDMConnectionItem) {
        boolean modify = false;
        MDMConnectionItem mdmConnItem = (MDMConnectionItem) item;
        if (mdmConnItem.getConnection() instanceof MDMConnection) {
            MDMConnection mdmConnection = (MDMConnection) mdmConnItem.getConnection();
            final EList<Concept> schemas = mdmConnection.getSchemas();
            for (Concept concept : schemas) {
                if (!concept.isInputModel()) {
                    concept.setConceptType(MdmConceptType.OUTPUT);
                    modify = true;
                }
            }
        }
        if (modify) {
            try {
                ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
                factory.save(item, true);
                return ExecutionResult.SUCCESS_WITH_ALERT;
            } catch (Exception e) {
                ExceptionHandler.process(e);
                return ExecutionResult.FAILURE;
            }
        }
    }
    return ExecutionResult.NOTHING_TO_DO;
}
Also used : Concept(org.talend.core.model.metadata.builder.connection.Concept) ProxyRepositoryFactory(org.talend.core.repository.model.ProxyRepositoryFactory) MDMConnectionItem(org.talend.core.model.properties.MDMConnectionItem) MDMConnection(org.talend.core.model.metadata.builder.connection.MDMConnection)

Example 8 with MDMConnection

use of org.talend.core.model.metadata.builder.connection.MDMConnection in project tdq-studio-se by Talend.

the class DQRepositoryViewLabelProvider method addWarnIconIfNeeded.

/**
 * if it is needed,add a over warning icon..eg., it is empty analysis or report; imported a MDM analysis or report.
 *
 * @param image
 * @param node
 * @param originalImageName
 * @return
 */
private Image addWarnIconIfNeeded(IRepositoryNode node, String originalImageName) {
    ModelElement modEle = RepositoryNodeHelper.getResourceModelElement(node);
    ERepositoryObjectType objectType = node.getObjectType();
    if (modEle != null) {
        if (ERepositoryObjectType.TDQ_ANALYSIS_ELEMENT == objectType) {
            Analysis analysis = (Analysis) modEle;
            AnalysisContext context = analysis.getContext();
            if (context == null) {
                return ImageLib.createInvalidIcon(originalImageName);
            }
            EList<ModelElement> analysedElements = context.getAnalysedElements();
            DataManager connection = context.getConnection();
            if (analysedElements.isEmpty() || connection instanceof MDMConnection) {
                return ImageLib.createInvalidIcon(originalImageName);
            }
        } else if (ERepositoryObjectType.TDQ_REPORT_ELEMENT == objectType) {
            TdReport report = (TdReport) modEle;
            EList<AnalysisMap> analysisMap = report.getAnalysisMap();
            if (analysisMap.isEmpty()) {
                return ImageLib.createInvalidIcon(originalImageName);
            }
            for (AnalysisMap anaMap : report.getAnalysisMap()) {
                Analysis analysis = anaMap.getAnalysis();
                if (analysis == null || analysis.getContext() == null) {
                    continue;
                }
                DataManager connection = analysis.getContext().getConnection();
                if (connection instanceof MDMConnection) {
                    return ImageLib.createInvalidIcon(originalImageName);
                }
            }
        }
    }
    return ImageLib.getImage(originalImageName);
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) EList(org.eclipse.emf.common.util.EList) Analysis(org.talend.dataquality.analysis.Analysis) TdReport(org.talend.dataquality.reports.TdReport) AnalysisMap(org.talend.dataquality.reports.AnalysisMap) DataManager(orgomg.cwm.foundation.softwaredeployment.DataManager) AnalysisContext(org.talend.dataquality.analysis.AnalysisContext) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) MDMConnection(org.talend.core.model.metadata.builder.connection.MDMConnection)

Example 9 with MDMConnection

use of org.talend.core.model.metadata.builder.connection.MDMConnection in project tdq-studio-se by Talend.

the class TOPRepositoryService method fillMetadata.

/**
 * Fill MDM connection only.
 */
public void fillMetadata(ConnectionItem connItem) {
    MetadataConnectionUtils.fillConnectionInformation(connItem);
    // MOD gdbu 2011-7-12 bug : 22598
    MDMConnection mdmConnection = (MDMConnection) connItem.getConnection();
    mdmConnection.setLabel(connItem.getProperty().getLabel() + "");
    mdmConnection.setName(connItem.getProperty().getLabel() + "");
    ElementWriterFactory.getInstance().createDataProviderWriter().save(mdmConnection);
// ~22598
}
Also used : MDMConnection(org.talend.core.model.metadata.builder.connection.MDMConnection)

Aggregations

MDMConnection (org.talend.core.model.metadata.builder.connection.MDMConnection)9 MDMConnectionItem (org.talend.core.model.properties.MDMConnectionItem)4 ArrayList (java.util.ArrayList)3 Concept (org.talend.core.model.metadata.builder.connection.Concept)3 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)3 ConnectionItem (org.talend.core.model.properties.ConnectionItem)3 EList (org.eclipse.emf.common.util.EList)2 DelimitedFileConnection (org.talend.core.model.metadata.builder.connection.DelimitedFileConnection)2 HL7Connection (org.talend.core.model.metadata.builder.connection.HL7Connection)2 XmlFileConnection (org.talend.core.model.metadata.builder.connection.XmlFileConnection)2 Item (org.talend.core.model.properties.Item)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 MetadataTableRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject)2 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Pattern (java.util.regex.Pattern)1 Point (org.eclipse.draw2d.geometry.Point)1