Commit beebc16e authored by npedot's avatar npedot
Browse files

adds var attribute to column and table

parent 614f9e72
......@@ -32,6 +32,8 @@ class Column (): Labelled by Labeller() {
var default: Any? = null
@JacksonXmlProperty(isAttribute = true)
var dbtable: String? = null
@JacksonXmlProperty(isAttribute = true)
var `var`: String? = null
@JsonCreator
constructor(
......
......@@ -37,6 +37,9 @@ class Table (): Labelled by Labeller(){
get() = if (labelsAsString().isEmpty()) null else labelsAsString()
set(value) { field = resetLabels(value?:"") }
@JacksonXmlProperty(isAttribute = true)
var `var`: String? = null
fun hasColumn(nameToFind:String): Boolean {
for (col in columns) {
if (col.name.equals(nameToFind)) return true
......
......@@ -32,7 +32,7 @@ class ColumnTest {
val colJson = jacksonObjectMapper().writeValueAsString(col)
// then
val result = """
{"name":"colA","id":"","dbname":null,"nullable":false,"dbtype":"","type":null,"unit":null,"cardinality":null,"role":null,"labels":null,"default":null,"dbtable":""}
{"name":"colA","id":"","dbname":null,"nullable":false,"dbtype":"","type":null,"unit":null,"cardinality":null,"role":null,"labels":null,"default":null,"dbtable":"","var":null}
""".trimIndent()
assertEquals(result,colJson)
}
......@@ -46,7 +46,7 @@ class ColumnTest {
val colJson = jacksonObjectMapper().writeValueAsString(col)
// then
val result = """
{"name":"colA","id":"","dbname":null,"nullable":false,"dbtype":"","type":null,"unit":null,"cardinality":null,"role":null,"labels":"aaa","default":null,"dbtable":""}
{"name":"colA","id":"","dbname":null,"nullable":false,"dbtype":"","type":null,"unit":null,"cardinality":null,"role":null,"labels":"aaa","default":null,"dbtable":"","var":null}
""".trimIndent()
assertEquals(result,colJson)
}
......
......@@ -47,6 +47,7 @@ class YAMLSerializerDatabaseTest {
schema: null
source: null
labels: null
var: null
- name: ""
id: ""
view: ""
......@@ -57,6 +58,7 @@ class YAMLSerializerDatabaseTest {
schema: null
source: null
labels: null
var: null
constraints: []
mappings: []
source: ""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment