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);
}
}
}
}
}
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;
}
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;
}
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'.");
}
Aggregations