Search in sources :

Example 1 with ExternalDataConverter

use of org.talend.designer.dbmap.external.converter.ExternalDataConverter in project tdi-studio-se by Talend.

the class MapperMain method createModelFromExternalData.

public void createModelFromExternalData(List<IOConnection> inputs, List<IOConnection> outputs, List<IMetadataTable> outputMetadataTables, ExternalDbMapData externalData, boolean checkProblems) {
    if (externalData == null) {
        externalData = new ExternalDbMapData();
    }
    mapperManager.getUiManager().setUiProperties(externalData.getUiProperties());
    ExternalDataConverter converter = new ExternalDataConverter(mapperManager);
    if (this.mapperModel == null) {
        this.mapperModel = converter.prepareModel(inputs, outputs, outputMetadataTables, externalData, checkProblems);
    }
}
Also used : ExternalDataConverter(org.talend.designer.dbmap.external.converter.ExternalDataConverter) ExternalDbMapData(org.talend.designer.dbmap.external.data.ExternalDbMapData)

Example 2 with ExternalDataConverter

use of org.talend.designer.dbmap.external.converter.ExternalDataConverter in project tdi-studio-se by Talend.

the class ProblemsAnalyser method checkProblems.

public List<Problem> checkProblems(ExternalDbMapData externalData) {
    problems.clear();
    if (externalData != null) {
        List<IConnection> incomingConnections = new ArrayList<IConnection>(this.mapperManager.getComponent().getIncomingConnections());
        List<IConnection> outgoingConnections = new ArrayList<IConnection>(this.mapperManager.getComponent().getOutgoingConnections());
        ExternalDataConverter converter = new ExternalDataConverter(mapperManager);
        MapperMain mapperMain = mapperManager.getComponent().getMapperMain();
        List<IOConnection> inputsIOConnections = mapperMain.createIOConnections(incomingConnections);
        ArrayList<InputTable> inputTables = converter.prepareInputTables(inputsIOConnections, externalData);
        List<IOConnection> outputsIOConnections = mapperMain.createIOConnections(outgoingConnections);
        ArrayList<OutputTable> outputTables = converter.prepareOutputTables(outputsIOConnections, this.mapperManager.getComponent().getMetadataList(), externalData);
        List<? super AbstractInOutTable> tablesWriteMode = new ArrayList<AbstractInOutTable>();
        tablesWriteMode.addAll(inputTables);
        tablesWriteMode.addAll(outputTables);
        List<? extends AbstractInOutTable> tablesReadMode = (List<? extends AbstractInOutTable>) tablesWriteMode;
        ProblemsManager problemsManager = new ProblemsManager(mapperManager);
        ArrayList<Problem> problemsLocal = new ArrayList<Problem>();
        for (AbstractInOutTable table : tablesReadMode) {
            List<IColumnEntry> columnEntries = table.getColumnEntries();
            problemsManager.checkProblemsForAllEntries(columnEntries);
            for (IColumnEntry entry : columnEntries) {
                List<Problem> problemsOfEntry = entry.getProblems();
                if (problemsOfEntry != null) {
                    problemsLocal.addAll(problemsOfEntry);
                }
            }
        }
        problems.addAll(problemsLocal);
    }
    return getProblems();
}
Also used : ExternalDataConverter(org.talend.designer.dbmap.external.converter.ExternalDataConverter) ArrayList(java.util.ArrayList) AbstractInOutTable(org.talend.designer.dbmap.model.table.AbstractInOutTable) IConnection(org.talend.core.model.process.IConnection) IColumnEntry(org.talend.designer.abstractmap.model.tableentry.IColumnEntry) OutputTable(org.talend.designer.dbmap.model.table.OutputTable) InputTable(org.talend.designer.dbmap.model.table.InputTable) IOConnection(org.talend.designer.dbmap.external.connection.IOConnection) ArrayList(java.util.ArrayList) List(java.util.List) Problem(org.talend.core.model.process.Problem) MapperMain(org.talend.designer.dbmap.MapperMain) ProblemsManager(org.talend.designer.dbmap.managers.ProblemsManager)

Aggregations

ExternalDataConverter (org.talend.designer.dbmap.external.converter.ExternalDataConverter)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 IConnection (org.talend.core.model.process.IConnection)1 Problem (org.talend.core.model.process.Problem)1 IColumnEntry (org.talend.designer.abstractmap.model.tableentry.IColumnEntry)1 MapperMain (org.talend.designer.dbmap.MapperMain)1 IOConnection (org.talend.designer.dbmap.external.connection.IOConnection)1 ExternalDbMapData (org.talend.designer.dbmap.external.data.ExternalDbMapData)1 ProblemsManager (org.talend.designer.dbmap.managers.ProblemsManager)1 AbstractInOutTable (org.talend.designer.dbmap.model.table.AbstractInOutTable)1 InputTable (org.talend.designer.dbmap.model.table.InputTable)1 OutputTable (org.talend.designer.dbmap.model.table.OutputTable)1