use of org.talend.designer.dbmap.model.tableentry.TableEntryLocation in project tdi-studio-se by Talend.
the class DataMapExpressionParser method parseTableEntryLocations.
public TableEntryLocation[] parseTableEntryLocations(String expression) {
resultList.clear();
if (expression != null) {
matcher.setMultiline(true);
if (patternMatcherInput == null) {
patternMatcherInput = new PatternMatcherInput(expression);
} else {
patternMatcherInput.setInput(expression);
}
recompilePatternIfNecessary(EXPRESSION_PATTERN);
while (matcher.contains(patternMatcherInput, pattern)) {
MatchResult matchResult = matcher.getMatch();
TableEntryLocation location = null;
if (matchResult.group(1) != null) {
// context.schema.context.table.comlumn
location = new TableEntryLocation(matchResult.group(2) + DOT_STR + matchResult.group(3) + DOT_STR + matchResult.group(4) + DOT_STR + matchResult.group(5), matchResult.group(6));
} else if (matchResult.group(7) != null) {
// context.schema.table.comlumn | schema.context.table.comlumn
location = new TableEntryLocation(matchResult.group(8) + DOT_STR + matchResult.group(9) + DOT_STR + matchResult.group(10), matchResult.group(11));
} else if (matchResult.group(12) != null) {
// schema.table.column
location = new TableEntryLocation(matchResult.group(13) + DOT_STR + matchResult.group(14), matchResult.group(15));
} else if (matchResult.group(16) != null) {
// table.column
location = new TableEntryLocation(matchResult.group(17), matchResult.group(18));
}
if (location != null) {
resultList.add(location);
}
}
}
return resultList.toArray(new TableEntryLocation[resultList.size()]);
}
Aggregations