use of org.talend.designer.mapper.model.tableentry.FilterTableEntry 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) {
if (entry.getExpression() == null || entry.getExpression().trim().length() == 0) {
return false;
}
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 = retrieveAbstractDataMapTableView(table);
TableViewerCreator tableViewerCreator = null;
if (entry instanceof IColumnEntry || entry instanceof FilterTableEntry) {
if (entry instanceof IColumnEntry) {
tableViewerCreator = dataMapTableView.getTableViewerCreatorForColumns();
} else if (entry instanceof FilterTableEntry) {
tableViewerCreator = dataMapTableView.getTableViewerCreatorForFilters();
}
tableViewerCreator.getTableViewer().refresh(entry);
} else if (entry instanceof ExpressionFilterEntry) {
dataMapTableView.getExpressionFilterText().setText(currentExpression);
}
uiManager.parseExpression(currentExpression, entry, false, true, false);
return true;
}
return false;
}
use of org.talend.designer.mapper.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, ExternalMapperTable externalMapperTable) {
fillExternalTableWithCommonsData(table, externalMapperTable);
externalMapperTable.setReject(table.isReject());
externalMapperTable.setRejectInnerJoin(table.isRejectInnerJoin());
externalMapperTable.setErrorRejectTable(table.isErrorRejectTable());
externalMapperTable.setIsJoinTableOf(table.getIsJoinTableOf());
externalMapperTable.setActivateExpressionFilter(table.isActivateExpressionFilter());
externalMapperTable.setActivateCondensedTool(table.isActivateCondensedTool());
externalMapperTable.setActivateColumnNameFilter(table.isActivateColumnNameFilter());
externalMapperTable.setExpressionFilter(table.getExpressionFilter() != null && isFilterEqualsToDefault(table.getExpressionFilter().getExpression()) ? null : table.getExpressionFilter().getExpression());
externalMapperTable.setId(table.getId());
if (mapperManager.isAdvancedMap()) {
externalMapperTable.setConstraintTableEntries(null);
} else {
ArrayList<ExternalMapperTableEntry> constraintTableEntries = new ArrayList<ExternalMapperTableEntry>();
for (FilterTableEntry constraintTableEntry : table.getFilterEntries()) {
ExternalMapperTableEntry externalMapperTableEntry = new ExternalMapperTableEntry();
externalMapperTableEntry.setExpression(constraintTableEntry.getExpression());
externalMapperTableEntry.setName(constraintTableEntry.getName());
constraintTableEntries.add(externalMapperTableEntry);
}
externalMapperTable.setConstraintTableEntries(constraintTableEntries);
}
outputTables.add(externalMapperTable);
}
use of org.talend.designer.mapper.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(final ITableEntry currentEntry, String text) {
currentEntry.setExpression(text);
DataMapTableView dataMapTableView = retrieveDataMapTableView(currentEntry);
TableViewer tableViewer = null;
if (currentEntry instanceof IColumnEntry || currentEntry instanceof FilterTableEntry) {
getProblemsManager().checkProblemsForTableEntryWithDelayLimiter(currentEntry);
if (currentEntry instanceof IColumnEntry) {
tableViewer = dataMapTableView.getTableViewerCreatorForColumns().getTableViewer();
} else if (currentEntry instanceof FilterTableEntry) {
tableViewer = dataMapTableView.getTableViewerCreatorForFilters().getTableViewer();
}
if (currentEntry.getProblems() != null) {
tableViewer.getTable().deselectAll();
}
tableViewer.refresh(currentEntry);
} else if (currentEntry instanceof ExpressionFilterEntry) {
dataMapTableView.getExpressionFilterText().setTextWithoutNotifyListeners(text);
if (!dataMapTableView.getExpressionFilterText().isFocusControl()) {
dataMapTableView.checkProblemsForExpressionFilterWithDelay();
}
}
uiManager.parseNewExpression(text, currentEntry, false);
}
use of org.talend.designer.mapper.model.tableentry.FilterTableEntry in project tdi-studio-se by Talend.
the class StyleLinkFactory method getStyleLink.
// public static DrawableLinkFactory getInstance() {
// if (instance == null) {
// instance = new DrawableLinkFactory();
// }
// return instance;
// }
//
// public IDrawableLink getDrawableLink(IMapperLink link) {
// IDrawableLink drawableLink = null;
// PointLinkDescriptor pointLinkDescriptorSource = link.getPointLinkDescriptorSource();
// PointLinkDescriptor pointLinkDescriptorTarget = link.getPointLinkDescriptorTarget();
// if (pointLinkDescriptorSource.getZone() != pointLinkDescriptorTarget.getZone()) {
// drawableLink = new HorizontalBezierLink();
// } else if (pointLinkDescriptorSource.getZone() == pointLinkDescriptorTarget.getZone()) {
// drawableLink = new VerticalRoundedCornerLink();
// }
// return drawableLink;
// }
//
public IStyleLink getStyleLink(IMapperLink link) {
ILinkState linkState = link.getState();
PointLinkDescriptor pointLinkDescriptorSource = link.getPointLinkDescriptor1();
PointLinkDescriptor pointLinkDescriptorTarget = link.getPointLinkDescriptor2();
ITableEntry targetTableEntry = pointLinkDescriptorTarget.getTableEntry();
boolean targetIsConstraint = false;
if (targetTableEntry instanceof FilterTableEntry || targetTableEntry instanceof ExpressionFilterEntry) {
targetIsConstraint = true;
}
boolean targetIsGlobalMap = false;
if (targetTableEntry instanceof GlobalMapEntry) {
targetIsGlobalMap = true;
}
IStyleLink style = null;
if (pointLinkDescriptorSource.getZone() != pointLinkDescriptorTarget.getZone()) {
if (linkState == LinkState.SELECTED) {
if (targetIsConstraint) {
style = selectedZoneToZoneFilterStyle;
} else {
style = selectedZoneToZoneStyle;
}
} else if (linkState == LinkState.UNSELECTED) {
if (targetIsConstraint) {
style = unselectedZoneToZoneFilterStyle;
} else {
style = unselectedZoneToZoneStyle;
}
}
} else if (pointLinkDescriptorSource.getZone() == Zone.INPUTS && pointLinkDescriptorSource.getZone() == pointLinkDescriptorTarget.getZone()) {
if (linkState == LinkState.SELECTED) {
if (pointLinkDescriptorTarget.getTableEntry() instanceof ExpressionFilterEntry) {
style = selectedSameZoneFilterStyle;
} else if (pointLinkDescriptorTarget.getTableEntry() instanceof GlobalMapEntry) {
style = selectedSameZoneGlobalMapStyle;
} else {
style = selectedSameInputZoneStyle;
}
} else if (linkState == LinkState.UNSELECTED) {
if (pointLinkDescriptorTarget.getTableEntry() instanceof ExpressionFilterEntry) {
style = unselectedSameZoneFilterStyle;
} else if (pointLinkDescriptorTarget.getTableEntry() instanceof GlobalMapEntry) {
style = unselectedSameZoneGlobalMapStyle;
} else {
style = unselectedSameInputZoneStyle;
}
}
} else if (pointLinkDescriptorSource.getZone() == Zone.VARS && pointLinkDescriptorSource.getZone() == pointLinkDescriptorTarget.getZone()) {
if (linkState == LinkState.SELECTED) {
style = selectedSameVarsZoneStyle;
} else if (linkState == LinkState.UNSELECTED) {
style = unselectedSameVarsZoneStyle;
}
}
return style;
}
use of org.talend.designer.mapper.model.tableentry.FilterTableEntry 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(LanguageProvider.getCurrentLanguage());
Collection<IDataMapTable> tablesData = getTablesData();
for (IDataMapTable table : tablesData) {
List<IColumnEntry> columnEntries = table.getColumnEntries();
if (table instanceof AbstractInOutTable) {
replaceLocation(previousLocation, newLocation, dataMapExpressionParser, table, ((AbstractInOutTable) table).getExpressionFilter());
}
for (IColumnEntry entry : columnEntries) {
replaceLocation(previousLocation, newLocation, dataMapExpressionParser, table, entry);
}
if (table instanceof OutputTable) {
List<FilterTableEntry> constraintEntries = ((OutputTable) table).getFilterEntries();
for (FilterTableEntry entry : constraintEntries) {
replaceLocation(previousLocation, newLocation, dataMapExpressionParser, table, entry);
}
}
}
uiManager.refreshBackground(false, false);
}
Aggregations