use of org.talend.designer.dbmap.model.tableentry.FilterTableEntry in project tdi-studio-se by Talend.
the class TableEntriesManager method retrieveTableItem.
TableItem retrieveTableItem(ITableEntry dataMapTableEntry) {
DataMapTableView dataMapTableView = this.mapperManager.retrieveIDataMapTableView(dataMapTableEntry.getParent());
TableItem[] tableItems = new TableItem[0];
if (dataMapTableEntry instanceof IColumnEntry) {
tableItems = dataMapTableView.getTableViewerCreatorForColumns().getTable().getItems();
} else if (dataMapTableEntry instanceof FilterTableEntry) {
if (FilterTableEntry.OTHER_FILTER.equals(((FilterTableEntry) dataMapTableEntry).getFilterKind())) {
tableItems = dataMapTableView.getTableViewerCreatorForOtherFilters().getTable().getItems();
} else {
tableItems = dataMapTableView.getTableViewerCreatorForWhereFilters().getTable().getItems();
}
} else {
//$NON-NLS-1$
throw new IllegalArgumentException(Messages.getString("TableEntriesManager.exceptionMessage.caseNotFound"));
}
TableItem tableItem = null;
for (TableItem tableItem2 : tableItems) {
if (tableItem2.getData() == dataMapTableEntry) {
tableItem = tableItem2;
break;
}
}
getTableEntryProperties(dataMapTableEntry).setTableItem(tableItem);
return tableItem;
}
use of org.talend.designer.dbmap.model.tableentry.FilterTableEntry 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(//$NON-NLS-1$
Messages.getString("TableEntriesManager.exceptionMessage.dataMapTableEntryCannotNull"));
}
addInternal(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 (FilterTableEntry.WHERE_FILTER.equals(((FilterTableEntry) dataMapTableEntry).getFilterKind())) {
if (index == null) {
((OutputTable) dataMapTable).addWhereFilterEntry((FilterTableEntry) dataMapTableEntry);
} else {
((OutputTable) dataMapTable).addWhereFilterEntry((FilterTableEntry) dataMapTableEntry, index);
}
} else if (FilterTableEntry.OTHER_FILTER.equals(((FilterTableEntry) dataMapTableEntry).getFilterKind())) {
if (index == null) {
((OutputTable) dataMapTable).addOtherFilterEntry((FilterTableEntry) dataMapTableEntry);
} else {
((OutputTable) dataMapTable).addOtherFilterEntry((FilterTableEntry) 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.dbmap.model.tableentry.FilterTableEntry in project tdi-studio-se by Talend.
the class MapperManager method changeEntryExpression.
/**
* DOC amaumont Comment method "changeEntryExpression".
*
* @param currentEntry
* @param text
*/
public void changeEntryExpression(ITableEntry currentEntry, String text) {
currentEntry.setExpression(text);
getProblemsManager().checkProblemsForTableEntry(currentEntry, true);
DataMapTableView dataMapTableView = retrieveDataMapTableView(currentEntry);
TableViewer tableViewer = null;
if (currentEntry instanceof IColumnEntry) {
tableViewer = dataMapTableView.getTableViewerCreatorForColumns().getTableViewer();
} else if (currentEntry instanceof FilterTableEntry) {
if (FilterTableEntry.OTHER_FILTER.equals(((FilterTableEntry) currentEntry).getFilterKind())) {
tableViewer = dataMapTableView.getTableViewerCreatorForOtherFilters().getTableViewer();
} else {
tableViewer = dataMapTableView.getTableViewerCreatorForWhereFilters().getTableViewer();
}
}
if (currentEntry.getProblems() != null) {
tableViewer.getTable().deselectAll();
}
tableViewer.refresh(currentEntry);
uiManager.parseNewExpression(text, currentEntry, false);
uiManager.refreshSqlExpression();
}
use of org.talend.designer.dbmap.model.tableentry.FilterTableEntry 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<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);
}
}
}
// for the OutputTables
for (OutputTable outputTable : outputTables) {
// OutputTable Filters
for (FilterTableEntry entry : outputTable.getWhereFilterEntries()) {
if (entry.getExpression() != null && matcher.matches(entry.getExpression())) {
Map<Integer, ITableEntry> map = new HashMap<Integer, ITableEntry>();
map.put(0, entry);
index++;
searchMaps.put(index, map);
}
}
for (FilterTableEntry entry : outputTable.getOtherFilterEntries()) {
if (entry.getExpression() != null && matcher.matches(entry.getExpression())) {
Map<Integer, ITableEntry> map = new HashMap<Integer, ITableEntry>();
map.put(0, entry);
index++;
searchMaps.put(index, map);
}
}
// OutputTable Columns
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);
}
}
}
}
use of org.talend.designer.dbmap.model.tableentry.FilterTableEntry in project tdi-studio-se by Talend.
the class ExternalDataConverter method fillExternalTable.
/**
* DOC amaumont Comment method "process".
*
* @param externalMapperTable
* @param table
*/
private void fillExternalTable(OutputTable table, ExternalDbMapTable externalMapperTable) {
externalMapperTable.setMinimized(table.isMinimized());
externalMapperTable.setName(table.getUniqueName());
externalMapperTable.setTableName(table.getTableName());
/**
* set custom where conditions entries
*/
ArrayList<ExternalDbMapEntry> constraintTableEntries = new ArrayList<ExternalDbMapEntry>();
for (FilterTableEntry constraintWhereTableEntry : table.getWhereFilterEntries()) {
ExternalDbMapEntry externalMapperTableEntry = new ExternalDbMapEntry();
externalMapperTableEntry.setExpression(constraintWhereTableEntry.getExpression());
externalMapperTableEntry.setName(constraintWhereTableEntry.getName());
constraintTableEntries.add(externalMapperTableEntry);
}
externalMapperTable.setCustomWhereConditionsEntries(constraintTableEntries);
/**
* set custom other conditions entries
*/
constraintTableEntries = new ArrayList<ExternalDbMapEntry>();
for (FilterTableEntry constraintOtherTableEntry : table.getOtherFilterEntries()) {
ExternalDbMapEntry externalMapperTableEntry = new ExternalDbMapEntry();
externalMapperTableEntry.setExpression(constraintOtherTableEntry.getExpression());
externalMapperTableEntry.setName(constraintOtherTableEntry.getName());
constraintTableEntries.add(externalMapperTableEntry);
}
externalMapperTable.setCustomOtherConditionsEntries(constraintTableEntries);
outputTables.add(externalMapperTable);
}
Aggregations