use of org.talend.designer.abstractmap.model.table.IDataMapTable in project tdi-studio-se by Talend.
the class MapperManager method addNewVarEntry.
/**
* This method is called when "addMetadataTableEditorEntry" is called (event on list of MetadataEditor) , so if you
* want keep synchronisation between inputs/outputs DataMaps and MetadataEditors don't call this method.
*
* For other uses such as add an entry to VarsTable or add entries to inputs or outputs DataMaps when
* MetadataEditors are not active, call it.
*
* @param dataMapTableView
* @param index
* @param type TODO
* @param metadataColumn, can be null if added in VarsTable
*/
public VarTableEntry addNewVarEntry(DataMapTableView dataMapTableView, String name, Integer index, String type) {
IDataMapTable abstractDataMapTable = dataMapTableView.getDataMapTable();
VarTableEntry dataMapTableEntry = null;
if (dataMapTableView.getZone() == Zone.VARS) {
dataMapTableEntry = new VarTableEntry(abstractDataMapTable, name, null, type);
} else {
//$NON-NLS-1$
throw new IllegalArgumentException(Messages.getString("MapperManager.exceptionMessage.useOtherSignature"));
}
AddVarEntryCommand varEntryCommand = new AddVarEntryCommand(tableEntriesManager, dataMapTableEntry, index);
executeCommand(varEntryCommand);
return dataMapTableEntry;
}
use of org.talend.designer.abstractmap.model.table.IDataMapTable in project tdi-studio-se by Talend.
the class MapperManager method replacePreviousLocationInAllExpressions.
/**
* DOC amaumont Comment method "replacePreviousLocationInAllExpressions".
*/
public void replacePreviousLocationInAllExpressions(final TableEntryLocation previousLocation, final TableEntryLocation newLocation) {
DataMapExpressionParser dataMapExpressionParser = new DataMapExpressionParser(LanguageProvider.getCurrentLanguage());
Collection<IDataMapTable> tablesData = getTablesData();
for (IDataMapTable table : tablesData) {
List<IColumnEntry> columnEntries = table.getColumnEntries();
if (table instanceof AbstractInOutTable) {
replaceLocation(previousLocation, newLocation, dataMapExpressionParser, table, ((AbstractInOutTable) table).getExpressionFilter());
}
for (IColumnEntry entry : columnEntries) {
replaceLocation(previousLocation, newLocation, dataMapExpressionParser, table, entry);
}
if (table instanceof OutputTable) {
List<FilterTableEntry> constraintEntries = ((OutputTable) table).getFilterEntries();
for (FilterTableEntry entry : constraintEntries) {
replaceLocation(previousLocation, newLocation, dataMapExpressionParser, table, entry);
}
}
}
uiManager.refreshBackground(false, false);
}
use of org.talend.designer.abstractmap.model.table.IDataMapTable in project tdi-studio-se by Talend.
the class TableEntriesManager method addTableEntry.
/**
* DOC amaumont Comment method "addTableEntry".
*
* @param dataMapTableEntry
* @param index
*/
public void addTableEntry(ITableEntry dataMapTableEntry, Integer index) {
if (dataMapTableEntry == null) {
throw new IllegalArgumentException(Messages.getString(//$NON-NLS-1$
"TableEntriesManager.exceptionMessage.dataMapTableEntryCannotNull"));
}
add(dataMapTableEntry);
IDataMapTable dataMapTable = dataMapTableEntry.getParent();
if (dataMapTableEntry instanceof IColumnEntry) {
if (index == null) {
dataMapTable.addColumnEntry((IColumnEntry) dataMapTableEntry);
} else {
dataMapTable.addColumnEntry((IColumnEntry) dataMapTableEntry, index);
}
} else if (dataMapTableEntry instanceof FilterTableEntry) {
if (index == null) {
((OutputTable) dataMapTable).addFilterEntry((FilterTableEntry) dataMapTableEntry);
} else {
((OutputTable) dataMapTable).addFilterEntry((FilterTableEntry) dataMapTableEntry, index);
}
} else if (dataMapTableEntry instanceof GlobalMapEntry) {
if (index == null) {
((InputTable) dataMapTable).addGlobalMapEntry((GlobalMapEntry) dataMapTableEntry);
} else {
((InputTable) dataMapTable).addGlobalMapEntry((GlobalMapEntry) dataMapTableEntry, index);
}
} else {
String exceptionMessage = Messages.getString("TableEntriesManager.exceptionMessage.typeIsNotValid", //$NON-NLS-1$
dataMapTableEntry.getClass().toString());
throw new IllegalArgumentException(exceptionMessage);
}
// TableEntriesManagerEvent event = new TableEntriesManagerEvent(EVENT_TYPE.ADD);
// event.entry = dataMapTableEntry;
// fireEvent(event);
}
use of org.talend.designer.abstractmap.model.table.IDataMapTable in project tdi-studio-se by Talend.
the class ExternalDataConverter method loadInExternalData.
private void loadInExternalData(Collection<? extends IDataMapTable> tables) {
for (IDataMapTable table : tables) {
ExternalDbMapTable externalMapperTable = new ExternalDbMapTable();
fillExternalTable(table, externalMapperTable);
ArrayList<ExternalDbMapEntry> perTableEntries = new ArrayList<ExternalDbMapEntry>();
boolean isInputTable = table instanceof InputTable;
for (ITableEntry dataMapTableEntry : table.getColumnEntries()) {
ExternalDbMapEntry externalMapperTableEntry = new ExternalDbMapEntry();
externalMapperTableEntry.setExpression(dataMapTableEntry.getExpression());
externalMapperTableEntry.setName(dataMapTableEntry.getName());
if (isInputTable) {
externalMapperTableEntry.setOperator(((InputColumnTableEntry) dataMapTableEntry).getOperator());
externalMapperTableEntry.setJoin(((InputColumnTableEntry) dataMapTableEntry).isJoin());
}
perTableEntries.add(externalMapperTableEntry);
}
externalMapperTable.setMetadataTableEntries(perTableEntries);
}
}
Aggregations