use of org.talend.designer.abstractmap.model.tableentry.IColumnEntry 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.abstractmap.model.tableentry.IColumnEntry 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.abstractmap.model.tableentry.IColumnEntry in project tdi-studio-se by Talend.
the class MapperManager method addNewColumnEntry.
/**
* 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.
*
* @param dataMapTableView
* @param metadataColumn, can be null if added in VarsTable
* @param index
*/
public IColumnEntry addNewColumnEntry(DataMapTableView dataMapTableView, IMetadataColumn metadataColumn, Integer index) {
IDataMapTable abstractDataMapTable = dataMapTableView.getDataMapTable();
IColumnEntry dataMapTableEntry = null;
if (dataMapTableView.getZone() == Zone.INPUTS) {
dataMapTableEntry = new InputColumnTableEntry(abstractDataMapTable, metadataColumn);
} else if (dataMapTableView.getZone() == Zone.OUTPUTS) {
dataMapTableEntry = new OutputColumnTableEntry(abstractDataMapTable, metadataColumn);
} else {
//$NON-NLS-1$
throw new IllegalArgumentException(Messages.getString("MapperManager.exceptionMessage.useOtherSignature"));
}
tableEntriesManager.addTableEntry(dataMapTableEntry, index);
return dataMapTableEntry;
}
use of org.talend.designer.abstractmap.model.tableentry.IColumnEntry in project tdi-studio-se by Talend.
the class MapperManager method findUniqueLocation.
public TableEntryLocation findUniqueLocation(final TableEntryLocation proposedLocation, IDataMapTable table) {
TableEntryLocation tableEntryLocation = new TableEntryLocation(proposedLocation);
int counter = 1;
boolean exists = true;
while (exists) {
boolean found = false;
if (table != null) {
for (IColumnEntry entry : table.getColumnEntries()) {
// TDI-26953: drag-and-drop column name should case-sensitive
if (entry.getName().equalsIgnoreCase(tableEntryLocation.columnName)) {
found = true;
break;
}
}
}
exists = found;
if (!exists) {
break;
}
//$NON-NLS-1$
tableEntryLocation.columnName = proposedLocation.columnName + "_" + counter++;
}
return tableEntryLocation;
}
use of org.talend.designer.abstractmap.model.tableentry.IColumnEntry in project tdi-studio-se by Talend.
the class ProblemsAnalyser method checkKeysProblems.
/**
* DOC amaumont Comment method "checkKeysProblems".
*
* @param incomingConnections
* @param inputTables
*/
private void checkKeysProblems(ArrayList<InputTable> inputTables) {
ILanguage currentLanguage = LanguageProvider.getCurrentLanguage();
if (!mapperManager.isAdvancedMap()) {
for (InputTable table : inputTables) {
if (table.isMainConnection()) {
continue;
}
String tableName = table.getName();
List<IColumnEntry> columnEntries = table.getColumnEntries();
for (IColumnEntry entry : columnEntries) {
InputColumnTableEntry inputEntry = (InputColumnTableEntry) entry;
String columnName = entry.getName();
if (mapperManager.checkEntryHasInvalidUncheckedKey(inputEntry)) {
String description = //$NON-NLS-1$
"Key of " + currentLanguage.getLocation(tableName, columnName) + //$NON-NLS-1$
" input entry should be checked or expression should be removed. ";
addProblem(new Problem(null, description, ProblemStatus.WARNING));
}
if (mapperManager.checkEntryHasInvalidCheckedKey(inputEntry)) {
String description = //$NON-NLS-1$
"Key of " + currentLanguage.getLocation(tableName, columnName) + //$NON-NLS-1$
" input entry should be unchecked or expression should be filled. ";
addProblem(new Problem(null, description, ProblemStatus.WARNING));
}
}
}
}
}
Aggregations