use of org.talend.designer.abstractmap.model.tableentry.ITableEntry in project tdi-studio-se by Talend.
the class ProblemsManager method checkProblemsForAllEntries.
public boolean checkProblemsForAllEntries(List<? extends ITableEntry> entriesList) {
boolean errorsHasChanged = false;
for (ITableEntry entry : entriesList) {
boolean haveProblemsBefore = entry.getProblems() != null;
mapperManager.getProblemsManager().checkProblemsForTableEntry(entry, false);
boolean haveProblemsAfter = entry.getProblems() != null;
if (haveProblemsBefore != haveProblemsAfter) {
errorsHasChanged = true;
}
}
return errorsHasChanged;
}
use of org.talend.designer.abstractmap.model.tableentry.ITableEntry in project tdi-studio-se by Talend.
the class TableEntriesManager method renameEntryName.
/**
* DOC amaumont Comment method "renameEntryName".
*
* @param dataMapTableEntry
* @param newColumnName
* @param newColumnName
*/
public void renameEntryName(ITableEntry dataMapTableEntry, String previousColumnName, String newColumnName) {
TableEntryLocation tableEntryLocationKey = new TableEntryLocation(dataMapTableEntry.getParentName(), previousColumnName);
// TableEntriesManager.buildLocation(dataMapTableEntry);
ITableEntry entry = tableEntries.get(tableEntryLocationKey);
if (entry != dataMapTableEntry) {
//$NON-NLS-1$
throw new IllegalStateException(Messages.getString("TableEntriesManager.exceptionMessage.tableEntriesNotSame"));
}
tableEntries.remove(tableEntryLocationKey);
tableEntryLocationKey.columnName = newColumnName;
tableEntries.put(tableEntryLocationKey, dataMapTableEntry);
// update matching column
IMetadataColumn metadataColumn = null;
InputTable inputTable = isPhysicalTable(dataMapTableEntry.getParent());
if (inputTable != null) {
metadataColumn = getColumnFromDbTable(inputTable.getName(), dataMapTableEntry.getName());
removeMetadataColumnFromDbTable(inputTable.getTableName(), dataMapTableEntry.getName());
addMetadataColumnFromDbTable(inputTable.getTableName(), newColumnName, metadataColumn);
}
dataMapTableEntry.setName(newColumnName);
}
use of org.talend.designer.abstractmap.model.tableentry.ITableEntry in project tdi-studio-se by Talend.
the class LinkManager method registerLevelForNewLink.
/**
* DOC amaumont Comment method "registerLevelForNewLink".
*
* @param link
* @param graphicalLinksFromTarget
*/
protected void registerLevelForNewLink(IMapperLink link, Set<IMapperLink> graphicalLinksFromTarget) {
boolean hasAlreadyInputTarget = false;
boolean hasAlreadyVarTarget = false;
ITableEntry sourceEntry = link.getPointLinkDescriptor1().getTableEntry();
ITableEntry targetEntry = link.getPointLinkDescriptor2().getTableEntry();
boolean hasSameZone = sourceEntry.getClass() == targetEntry.getClass();
boolean isInput = targetEntry instanceof InputColumnTableEntry;
boolean isOutput = targetEntry instanceof OutputColumnTableEntry;
if (hasSameZone) {
List<List<IMapperLink>> leveledLinks = null;
if (isInput) {
leveledLinks = getInputLinksForLevels();
}
if (isOutput) {
leveledLinks = getOutputLinksForLevels();
}
int lstSize = leveledLinks.size();
for (int indexOfLeveledLink = 0; indexOfLeveledLink < lstSize; indexOfLeveledLink++) {
List<IMapperLink> linksFromLevelsList = leveledLinks.get(indexOfLeveledLink);
if (linksFromLevelsList != null && linksFromLevelsList.size() > 0) {
IMapperLink linkFromLevelsList = linksFromLevelsList.get(0);
ITableEntry sourceTableEntry = linkFromLevelsList.getPointLinkDescriptor1().getTableEntry();
ITableEntry targetTableEntry = linkFromLevelsList.getPointLinkDescriptor2().getTableEntry();
if (targetEntry == targetTableEntry) {
if (sourceTableEntry instanceof InputColumnTableEntry && targetTableEntry instanceof InputColumnTableEntry) {
hasAlreadyInputTarget = true;
}
if (sourceTableEntry instanceof VarTableEntry && targetTableEntry instanceof VarTableEntry) {
hasAlreadyVarTarget = true;
}
if (hasAlreadyInputTarget || hasAlreadyVarTarget) {
linksFromLevelsList.add(link);
link.setLevel(indexOfLeveledLink + 1);
break;
}
}
}
}
if (isInput && !hasAlreadyInputTarget) {
ArrayList<IMapperLink> list = new ArrayList<IMapperLink>();
int firstEmptyIndex = searchFirstEmptyIndexLeveledList(leveledLinks);
link.setLevel(firstEmptyIndex + 1);
list.add(link);
if (firstEmptyIndex < leveledLinks.size()) {
leveledLinks.set(firstEmptyIndex, list);
} else {
leveledLinks.add(list);
}
}
}
}
use of org.talend.designer.abstractmap.model.tableentry.ITableEntry in project tdi-studio-se by Talend.
the class SearchZoneMapper method getSelectedKeyAtSelectedTableItem.
public Integer getSelectedKeyAtSelectedTableItem(Map<Integer, Map<Integer, ITableEntry>> searchMaps) {
Integer selectKey = 0;
TableViewerCreator tableViewerCreator = null;
if (uiManager.getCurrentSelectedInputTableView() != null) {
tableViewerCreator = uiManager.getCurrentSelectedInputTableView().getTableViewerCreatorForColumns();
if (tableViewerCreator != null && tableViewerCreator.getTableViewer() != null) {
ISelection selection = tableViewerCreator.getTableViewer().getSelection();
if (selection == null || selection.isEmpty()) {
if (uiManager.getCurrentSelectedOutputTableView() != null) {
tableViewerCreator = uiManager.getCurrentSelectedOutputTableView().getTableViewerCreatorForColumns();
if (tableViewerCreator != null && tableViewerCreator.getTableViewer() != null) {
selection = tableViewerCreator.getTableViewer().getSelection();
if (selection == null || selection.isEmpty()) {
if (uiManager.getCurrentSelectedVarsTableView() != null) {
tableViewerCreator = uiManager.getCurrentSelectedVarsTableView().getTableViewerCreatorForColumns();
}
}
}
} else if (uiManager.getCurrentSelectedVarsTableView() != null) {
tableViewerCreator = uiManager.getCurrentSelectedVarsTableView().getTableViewerCreatorForColumns();
}
}
}
} else if (uiManager.getCurrentSelectedVarsTableView() != null) {
tableViewerCreator = uiManager.getCurrentSelectedVarsTableView().getTableViewerCreatorForColumns();
} else if (uiManager.getCurrentSelectedOutputTableView() != null) {
tableViewerCreator = uiManager.getCurrentSelectedOutputTableView().getTableViewerCreatorForColumns();
}
if (tableViewerCreator != null && tableViewerCreator.getTableViewer() != null) {
ISelection selection = tableViewerCreator.getTableViewer().getSelection();
if (selection != null && !selection.isEmpty()) {
List<ITableEntry> list = uiManager.extractSelectedTableEntries(selection);
if (list != null && !list.isEmpty()) {
ITableEntry tableEntry = list.get(0);
if (tableEntry != null) {
Iterator iter = searchMaps.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
Map<Integer, ITableEntry> map = (Map<Integer, ITableEntry>) entry.getValue();
if (map.containsValue(tableEntry)) {
Iterator it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry e = (Map.Entry) it.next();
if (e.getValue() != null && e.getValue() instanceof ITableEntry) {
ITableEntry tableEntryTemp = (ITableEntry) e.getValue();
if (tableEntry.equals(tableEntryTemp)) {
tableViewerCreator.getTableViewer().getTable().deselectAll();
return (Integer) entry.getKey();
}
}
}
}
}
}
}
}
}
return selectKey;
}
use of org.talend.designer.abstractmap.model.tableentry.ITableEntry 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);
}
}
}
Aggregations