Search in sources :

Example 16 with TableEntryLocation

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()]);
}
Also used : PatternMatcherInput(org.apache.oro.text.regex.PatternMatcherInput) TableEntryLocation(org.talend.designer.dbmap.model.tableentry.TableEntryLocation) MatchResult(org.apache.oro.text.regex.MatchResult)

Aggregations

TableEntryLocation (org.talend.designer.dbmap.model.tableentry.TableEntryLocation)16 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)6 ITableEntry (org.talend.designer.abstractmap.model.tableentry.ITableEntry)6 ArrayList (java.util.ArrayList)5 IColumnEntry (org.talend.designer.abstractmap.model.tableentry.IColumnEntry)5 DataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView)5 InputDataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.InputDataMapTableView)4 OutputDataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView)4 TableViewerCreator (org.talend.commons.ui.swt.tableviewer.TableViewerCreator)3 IDataMapTable (org.talend.designer.abstractmap.model.table.IDataMapTable)3 ExternalDbMapTable (org.talend.designer.dbmap.external.data.ExternalDbMapTable)3 List (java.util.List)2 TableViewer (org.eclipse.jface.viewers.TableViewer)2 Point (org.eclipse.swt.graphics.Point)2 MetadataTableEditor (org.talend.core.ui.metadata.editor.MetadataTableEditor)2 MetadataTableEditorView (org.talend.core.ui.metadata.editor.MetadataTableEditorView)2 ExternalDbMapEntry (org.talend.designer.dbmap.external.data.ExternalDbMapEntry)2 AbstractInOutTable (org.talend.designer.dbmap.model.table.AbstractInOutTable)2 InputTable (org.talend.designer.dbmap.model.table.InputTable)2 FilterTableEntry (org.talend.designer.dbmap.model.tableentry.FilterTableEntry)2