Search in sources :

Example 6 with IExternalData

use of org.talend.core.model.process.IExternalData in project tdi-studio-se by Talend.

the class DesignerMapperService method updateMapperTableEntries.

public void updateMapperTableEntries(IExternalNode externalNode, String schemaId, IMetadataTable metadataTable) {
    if (externalNode == null || schemaId == null || metadataTable == null) {
        return;
    }
    if (externalNode instanceof MapperComponent) {
        MapperComponent component = (MapperComponent) externalNode;
        IExternalData nodeData = externalNode.getExternalData();
        if (nodeData != null && nodeData instanceof ExternalMapperData) {
            ExternalMapperData mapperData = (ExternalMapperData) nodeData;
            List<ExternalMapperTable> outputTables = mapperData.getOutputTables();
            if (outputTables != null && outputTables.size() > 0) {
                for (ExternalMapperTable outputTable : outputTables) {
                    updateEntriesByMetaColumns(schemaId, metadataTable, outputTable, component);
                }
            }
        }
    }
}
Also used : IExternalData(org.talend.core.model.process.IExternalData) ExternalMapperTable(org.talend.designer.mapper.external.data.ExternalMapperTable) ExternalMapperData(org.talend.designer.mapper.external.data.ExternalMapperData)

Example 7 with IExternalData

use of org.talend.core.model.process.IExternalData in project tdi-studio-se by Talend.

the class MapperComponent method restoreMapModelFromInternalData.

private IExternalData restoreMapModelFromInternalData() {
    super.restoreMapperModelFromInternalData();
    externalData = mapperMain.buildTMAPExternalData();
    IExternalData data = null;
    try {
        data = externalData.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    sortOutputsConnectionsLikeVisualOrder();
    return data;
}
Also used : IExternalData(org.talend.core.model.process.IExternalData)

Example 8 with IExternalData

use of org.talend.core.model.process.IExternalData in project tdi-studio-se by Talend.

the class MapperComponent method getTMapExternalData.

public IExternalData getTMapExternalData() {
    initMapperMain(true);
    mapperMain.createModelFromExternalData(getIODataComponents(), getMetadataList(), externalData, true);
    IExternalData data = restoreMapModelFromInternalData();
    try {
        mapperMain.getMapperManager().setOriginalExternalData(externalData.clone());
    } catch (CloneNotSupportedException e) {
        if (MapperMain.isStandAloneMode()) {
            e.printStackTrace();
        } else {
            ExceptionHandler.process(e);
        }
    }
    return data;
}
Also used : IExternalData(org.talend.core.model.process.IExternalData)

Example 9 with IExternalData

use of org.talend.core.model.process.IExternalData in project tdi-studio-se by Talend.

the class ProblemsAnalyserTest method testCheckLookupTablesKeyProblems.

@Test
public void testCheckLookupTablesKeyProblems() {
    MapperComponent mapperComponent = createMapperComponent();
    ProblemsAnalyser analyser = new ProblemsAnalyser(mapperComponent.getMapperMain().getMapperManager());
    IExternalData externalData = mapperComponent.getExternalData();
    ExternalMapperTable lookupTable = (ExternalMapperTable) externalData.getInputTables().get(1);
    // match mode:Unique Match +no expression
    lookupTable.setMatchingMode(TMAP_MATCHING_MODE.UNIQUE_MATCH.name());
    analyser.checkLookupTablesKeyProblems((ExternalMapperData) externalData);
    List<Problem> problems = analyser.getProblems();
    Assert.assertEquals(problems.size(), 1);
    Assert.assertEquals(problems.get(0).getDescription(), "The lookup table 'row2' should have at least one expression key filled.");
    // match mode:All Row +expression
    lookupTable.setMatchingMode(TMAP_MATCHING_MODE.ALL_ROWS.name());
    lookupTable.getMetadataTableEntries().get(0).setExpression("row1.newColumn1");
    analyser = new ProblemsAnalyser(mapperComponent.getMapperMain().getMapperManager());
    analyser.checkLookupTablesKeyProblems((ExternalMapperData) externalData);
    problems = analyser.getProblems();
    Assert.assertEquals(problems.size(), 1);
    Assert.assertEquals(problems.get(0).getDescription(), "The expression key can't be used in lookup table 'row2' with match mode 'All Rows'.");
}
Also used : Problem(org.talend.core.model.process.Problem) IExternalData(org.talend.core.model.process.IExternalData) ExternalMapperTable(org.talend.designer.mapper.external.data.ExternalMapperTable) MapperComponent(org.talend.designer.mapper.MapperComponent) Test(org.junit.Test)

Aggregations

IExternalData (org.talend.core.model.process.IExternalData)9 ExternalMapperTable (org.talend.designer.mapper.external.data.ExternalMapperTable)4 ExternalMapperData (org.talend.designer.mapper.external.data.ExternalMapperData)3 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Point (org.eclipse.draw2d.geometry.Point)1 EList (org.eclipse.emf.common.util.EList)1 Command (org.eclipse.gef.commands.Command)1 CommandStack (org.eclipse.gef.commands.CommandStack)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)1 PartInitException (org.eclipse.ui.PartInitException)1 Test (org.junit.Test)1 PersistenceException (org.talend.commons.exception.PersistenceException)1 Project (org.talend.core.model.general.Project)1 ColumnNameChanged (org.talend.core.model.metadata.ColumnNameChanged)1 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)1 IElementParameter (org.talend.core.model.process.IElementParameter)1 IExternalNode (org.talend.core.model.process.IExternalNode)1 INode (org.talend.core.model.process.INode)1