From 6497a39e3f9e346aeb5ee75a9a3fb387bdb98f7e Mon Sep 17 00:00:00 2001 From: phact Date: Sun, 2 Aug 2020 22:49:21 -0400 Subject: [PATCH] map support, FROZEN is broken --- .../main/node/docsys/pages/ui/build/index.vue | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/docsys/src/main/node/docsys/pages/ui/build/index.vue b/docsys/src/main/node/docsys/pages/ui/build/index.vue index d85105b32..24c1c5f4f 100644 --- a/docsys/src/main/node/docsys/pages/ui/build/index.vue +++ b/docsys/src/main/node/docsys/pages/ui/build/index.vue @@ -162,7 +162,32 @@ allColumns.forEach(column => { let recipe = basictypes.bindings[column.type+"val"]; if (recipe == undefined){ - alert("Could not generate recipe for type: " + column.type + " for column: " + column.name) + const chars = new antlr4.InputStream(column.type); + const lexer = new CQL3Lexer.CQL3Lexer(chars); + lexer.strictMode = false; // do not use js strictMode + const tokens = new antlr4.CommonTokenStream(lexer); + const parser = new CQL3Parser.CQL3Parser(tokens); + + const typeContext = parser.column_type(); + const collectionTypeContext = typeContext.data_type().collection_type(); + const collectionType = collectionTypeContext.children[0].getText(); + if (collectionType.toLowerCase() == "set"){ + const type = collectionTypeContext.children[2].getText(); + recipe = "Set(HashRange(1,<>),"+basictypes.bindings[type+"val"]+") -> java.util.Set" + } + else if (collectionType.toLowerCase() == "list"){ + const type = collectionTypeContext.children[2].getText(); + recipe = "List(HashRange(1,<>),"+basictypes.bindings[type+"val"]+") -> java.util.List" + + } + else if (collectionType.toLowerCase() == "map"){ + const type1 = collectionTypeContext.children[2].getText(); + const type2 = collectionTypeContext.children[4].getText(); + recipe = "Map(HashRange(1,<>),"+basictypes.bindings[type1+"val"]+","+basictypes.bindings[type2+"val"]+") -> java.util.Map" + } + else{ + alert("Could not generate recipe for type: " + column.type + " for column: " + column.name) + } } defaultYaml.bindings[column.name] = recipe createTableStatement = createTableStatement+ column.name+ " " + column.type + ",\n";