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));
}
}
}
}
}
use of org.talend.designer.abstractmap.model.tableentry.IColumnEntry in project tdi-studio-se by Talend.
the class ProblemsAnalyser method checkProblems.
public List<Problem> checkProblems(ExternalDbMapData externalData) {
problems.clear();
if (externalData != null) {
List<IConnection> incomingConnections = new ArrayList<IConnection>(this.mapperManager.getComponent().getIncomingConnections());
List<IConnection> outgoingConnections = new ArrayList<IConnection>(this.mapperManager.getComponent().getOutgoingConnections());
ExternalDataConverter converter = new ExternalDataConverter(mapperManager);
MapperMain mapperMain = mapperManager.getComponent().getMapperMain();
List<IOConnection> inputsIOConnections = mapperMain.createIOConnections(incomingConnections);
ArrayList<InputTable> inputTables = converter.prepareInputTables(inputsIOConnections, externalData);
List<IOConnection> outputsIOConnections = mapperMain.createIOConnections(outgoingConnections);
ArrayList<OutputTable> outputTables = converter.prepareOutputTables(outputsIOConnections, this.mapperManager.getComponent().getMetadataList(), externalData);
List<? super AbstractInOutTable> tablesWriteMode = new ArrayList<AbstractInOutTable>();
tablesWriteMode.addAll(inputTables);
tablesWriteMode.addAll(outputTables);
List<? extends AbstractInOutTable> tablesReadMode = (List<? extends AbstractInOutTable>) tablesWriteMode;
ProblemsManager problemsManager = new ProblemsManager(mapperManager);
ArrayList<Problem> problemsLocal = new ArrayList<Problem>();
for (AbstractInOutTable table : tablesReadMode) {
List<IColumnEntry> columnEntries = table.getColumnEntries();
problemsManager.checkProblemsForAllEntries(columnEntries);
for (IColumnEntry entry : columnEntries) {
List<Problem> problemsOfEntry = entry.getProblems();
if (problemsOfEntry != null) {
problemsLocal.addAll(problemsOfEntry);
}
}
}
problems.addAll(problemsLocal);
}
return getProblems();
}
Aggregations