use of org.talend.designer.abstractmap.model.tableentry.IColumnEntry in project tdi-studio-se by Talend.
the class TableManager method removeTable.
/**
* DOC amaumont Comment method "removeTable".
*
* @param dataTable
*/
Object removeTable(IDataMapTable dataTable) {
List<IColumnEntry> dataMapTableEntries = dataTable.getColumnEntries();
TableEntriesManager tableEntriesManager = mapperManager.getTableEntriesManager();
tableEntriesManager.removeAll(dataMapTableEntries, isPhysicalInputTable(dataTable.getName()));
if (dataTable instanceof OutputTable) {
List<FilterTableEntry> whereConstraintEntries = ((OutputTable) dataTable).getWhereFilterEntries();
tableEntriesManager.removeAll(whereConstraintEntries, false);
List<FilterTableEntry> otherConstraintEntries = ((OutputTable) dataTable).getOtherFilterEntries();
tableEntriesManager.removeAll(otherConstraintEntries, false);
}
getMatchedList(dataTable).remove(dataTable);
DataMapTableView view = abstractDataMapTableToView.remove(dataTable);
swtTableToView.remove(view.getTableViewerCreatorForColumns().getTable());
if (view.getTableViewerCreatorForWhereFilters() != null) {
swtTableToView.remove(view.getTableViewerCreatorForWhereFilters().getTable());
}
if (view.getTableViewerCreatorForOtherFilters() != null) {
swtTableToView.remove(view.getTableViewerCreatorForOtherFilters().getTable());
}
return view;
}
use of org.talend.designer.abstractmap.model.tableentry.IColumnEntry 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(getCurrentLanguage());
Collection<IDataMapTable> tablesData = getTablesData();
for (IDataMapTable table : tablesData) {
List<IColumnEntry> columnEntries = table.getColumnEntries();
for (IColumnEntry entry : columnEntries) {
replaceLocation(previousLocation, newLocation, dataMapExpressionParser, table, entry);
}
if (table instanceof OutputTable) {
List<FilterTableEntry> whereConstraintEntries = ((OutputTable) table).getWhereFilterEntries();
for (FilterTableEntry entry : whereConstraintEntries) {
replaceLocation(previousLocation, newLocation, dataMapExpressionParser, table, entry);
}
List<FilterTableEntry> otherConstraintEntries = ((OutputTable) table).getOtherFilterEntries();
for (FilterTableEntry entry : otherConstraintEntries) {
replaceLocation(previousLocation, newLocation, dataMapExpressionParser, table, entry);
}
}
}
uiManager.refreshBackground(false, false);
}
use of org.talend.designer.abstractmap.model.tableentry.IColumnEntry in project tdi-studio-se by Talend.
the class MapperManager method replaceLocation.
/**
*
* DOC amaumont Comment method "replaceLocation".
*
* @param previousLocation
* @param newLocation
* @param dataMapExpressionParser
* @param table
* @param entry
* @return true if expression of entry has changed
*/
private boolean replaceLocation(final TableEntryLocation previousLocation, final TableEntryLocation newLocation, DataMapExpressionParser dataMapExpressionParser, IDataMapTable table, ITableEntry entry) {
boolean expressionHasChanged = false;
String currentExpression = entry.getExpression();
TableEntryLocation[] tableEntryLocations = dataMapExpressionParser.parseTableEntryLocations(currentExpression);
// loop on all locations of current expression
for (TableEntryLocation currentLocation : tableEntryLocations) {
if (currentLocation.equals(previousLocation)) {
currentExpression = dataMapExpressionParser.replaceLocation(currentExpression, previousLocation, newLocation);
expressionHasChanged = true;
}
}
if (expressionHasChanged) {
entry.setExpression(currentExpression);
DataMapTableView dataMapTableView = retrieveIDataMapTableView(table);
TableViewerCreator tableViewerCreator = null;
if (entry instanceof IColumnEntry) {
tableViewerCreator = dataMapTableView.getTableViewerCreatorForColumns();
} else if (entry instanceof FilterTableEntry) {
if (FilterTableEntry.OTHER_FILTER.equals(((FilterTableEntry) entry).getFilterKind())) {
tableViewerCreator = dataMapTableView.getTableViewerCreatorForOtherFilters();
} else {
tableViewerCreator = dataMapTableView.getTableViewerCreatorForWhereFilters();
}
}
tableViewerCreator.getTableViewer().refresh(entry);
uiManager.parseExpression(currentExpression, entry, false, true, false);
return true;
}
return false;
}
use of org.talend.designer.abstractmap.model.tableentry.IColumnEntry in project tdi-studio-se by Talend.
the class SearchZoneMapper method search.
public void search(Map<Integer, Map<Integer, ITableEntry>> searchMaps, String searchValue) {
if (searchValue.equals("")) {
uiManager.unselectAllEntriesOfAllTables();
return;
}
// SearchPattern
matcher.setPattern("*" + searchValue.trim() + "*");
List<InputTable> inputTables = mapperManager.getInputTables();
List<VarsTable> varsTables = mapperManager.getVarsTables();
List<OutputTable> outputTables = mapperManager.getOutputTables();
int index = -1;
// for the InputTables
for (InputTable inputTable : inputTables) {
for (IColumnEntry column : inputTable.getColumnEntries()) {
int i = -1;
Map<Integer, ITableEntry> map = new HashMap<Integer, ITableEntry>();
boolean modified = false;
if (column.getExpression() != null && matcher.matches(column.getExpression())) {
i++;
map.put(i, column);
modified = true;
}
if (column.getName() != null && matcher.matches(column.getName())) {
i++;
map.put(i, column);
modified = true;
}
if (modified) {
index++;
searchMaps.put(index, map);
}
}
// ExpressionFilter
ExpressionFilterEntry expressionFilterEntry = inputTable.getExpressionFilter();
if (expressionFilterEntry.getExpression() != null && matcher.matches(expressionFilterEntry.getExpression())) {
Map<Integer, ITableEntry> map = new HashMap<Integer, ITableEntry>();
map.put(0, expressionFilterEntry);
index++;
searchMaps.put(index, map);
}
}
// for the VarsTables
for (VarsTable varsTable : varsTables) {
for (IColumnEntry column : varsTable.getColumnEntries()) {
int i = -1;
Map<Integer, ITableEntry> map = new HashMap<Integer, ITableEntry>();
boolean modified = false;
if (column.getExpression() != null && matcher.matches(column.getExpression())) {
i++;
map.put(i, column);
modified = true;
}
if (column.getName() != null && matcher.matches(column.getName())) {
i++;
map.put(i, column);
modified = true;
}
if (modified) {
index++;
searchMaps.put(index, map);
}
}
}
// for the OutputTables
for (OutputTable outputTable : outputTables) {
for (IColumnEntry column : outputTable.getColumnEntries()) {
int i = -1;
Map<Integer, ITableEntry> map = new HashMap<Integer, ITableEntry>();
boolean modified = false;
if (column.getExpression() != null && matcher.matches(column.getExpression())) {
i++;
map.put(i, column);
modified = true;
}
if (column.getName() != null && matcher.matches(column.getName())) {
i++;
map.put(i, column);
modified = true;
}
if (modified) {
index++;
searchMaps.put(index, map);
}
}
// ExpressionFilter
ExpressionFilterEntry expressionFilterEntry = outputTable.getExpressionFilter();
if (expressionFilterEntry.getExpression() != null && matcher.matches(expressionFilterEntry.getExpression())) {
Map<Integer, ITableEntry> map = new HashMap<Integer, ITableEntry>();
map.put(0, expressionFilterEntry);
index++;
searchMaps.put(index, map);
}
}
}
use of org.talend.designer.abstractmap.model.tableentry.IColumnEntry in project tdi-studio-se by Talend.
the class AutoMapper method map.
/**
* DOC amaumont Comment method "map".
*/
public void map() {
List<InputTable> inputTables = mapperManager.getInputTables();
List<OutputTable> outputTables = mapperManager.getOutputTables();
IDbLanguage currentLanguage = mapperManager.getCurrentLanguage();
HashMap<String, InputTable> nameToInputTable = new HashMap<String, InputTable>(inputTables.size());
for (InputTable inputTable : inputTables) {
nameToInputTable.put(inputTable.getName(), inputTable);
}
// output tables are the references
for (OutputTable outputTable : outputTables) {
List<IColumnEntry> outputEntries = outputTable.getColumnEntries();
boolean mapFound = false;
for (IColumnEntry outputEntry : outputEntries) {
mapFound = false;
if (mapperManager.checkEntryHasEmptyExpression(outputEntry)) {
String outputColumnName = outputEntry.getName();
for (InputTable inputTable : inputTables) {
List<IColumnEntry> inputColumnEntries = inputTable.getColumnEntries();
for (IColumnEntry inputEntry : inputColumnEntries) {
if (inputEntry.getName().equalsIgnoreCase(outputColumnName)) {
outputEntry.setExpression(currentLanguage.getLocation(inputTable.getName(), inputEntry.getName()));
mapFound = true;
break;
}
}
if (mapFound) {
break;
}
}
}
}
DataMapTableView view = mapperManager.retrieveIDataMapTableView(outputTable);
view.getTableViewerCreatorForColumns().getTableViewer().refresh();
}
mapperManager.getProblemsManager().checkProblems();
List<DataMapTableView> outputsTablesView = mapperManager.getUiManager().getOutputsTablesView();
for (DataMapTableView view : outputsTablesView) {
mapperManager.getUiManager().parseAllExpressions(view, true);
mapperManager.getProblemsManager().checkProblemsForAllEntries(view, true);
}
mapperManager.getUiManager().refreshBackground(true, false);
}
Aggregations