Skip to content
Snippets Groups Projects
Commit f85989a1 authored by npedot's avatar npedot
Browse files

adds parse inclusion,double inclusion,multivalued schema constraint

parent d2a08206
No related branches found
No related tags found
No related merge requests found
......@@ -12,10 +12,26 @@ object SchemaCmdParser {
}
fun parseFunctionals(tableName: String,setExpression: String): Set<Constraint> {
return parseConstraint(setExpression, tableName, Constraint.TYPE.FUNCTIONAL.name)
}
fun parseMultivalued(tableName: String,setExpression: String): Set<Constraint> {
return parseConstraint(setExpression, tableName, Constraint.TYPE.MULTIVALUED.name)
}
fun parseInclusion(tableName: String,setExpression: String): Set<Constraint> {
return parseConstraint(setExpression, tableName, Constraint.TYPE.INCLUSION.name)
}
fun parseDoubleInclusion(tableName: String,setExpression: String): Set<Constraint> {
return parseConstraint(setExpression, tableName, Constraint.TYPE.DOUBLE_INCLUSION.name)
}
private fun parseConstraint(setExpression: String, tableName: String, type:String): Set<Constraint> {
val constraintsToAdd = Constraint.set(setExpression)
for (constraint in constraintsToAdd) {
constraint.name = tableName + ".functional"
constraint.type = Constraint.TYPE.FUNCTIONAL.name
constraint.name = "$tableName.$type"
constraint.type = type
constraint.source.table = tableName
constraint.target.table = tableName
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment