use of nikita.webapp.odata.NikitaODataToSQLWalker in project nikita-noark5-core by HiOA-ABI.
the class TestODataApp method main.
public static void main(String[] args) throws Exception {
System.out.println("Starting OData parser test");
System.out.println("Picks first line from odata_samples.txt in " + "resources folder.");
try {
AfterApplicationStartup afterApplicationStartup = new AfterApplicationStartup(null);
afterApplicationStartup.populateTranslatedNames();
TestODataApp app = new TestODataApp();
ODataLexer lexer = new ODataLexer(CharStreams.fromStream(app.getInputStreamForParseFile("odata" + File.separator + "odata_samples.txt")));
CommonTokenStream tokens = new CommonTokenStream(lexer);
ODataParser parser = new ODataParser(tokens);
ParseTree tree = parser.odataURL();
ParseTreeWalker walker = new ParseTreeWalker();
// Make the SQL Statement
NikitaODataToSQLWalker sqlWalker = new NikitaODataToSQLWalker();
walker.walk(sqlWalker, tree);
System.out.println(sqlWalker.getSqlStatement());
} catch (RecognitionException e) {
throw new IllegalStateException("Recognition exception");
}
}
Aggregations