Skip to content

Commit

Permalink
Disallowed multi-cardinality role assignments, sets now map to thrift…
Browse files Browse the repository at this point in the history
… sets.
  • Loading branch information
BuckeyHack committed Mar 23, 2016
1 parent d7a2c72 commit bb6e3c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ struct «d.name» {
}

def String getThriftTypeName(String type) {
if (type.startsWith("set"))
return "set<" + getThriftTypeName(EDLUtils.stripSet(type)) + ">"

switch type {
case PrimitiveTypes.INT:
"i32"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ class EDLValidator extends AbstractEDLValidator implements ITypeResolutionContex
if (!EDLUtils.convertible(queryType, fieldType)) {
error("Invalid assignment - field and query types do not correspond. Field type: " + fieldType + " Query type: " + queryType, rule, EdlPackage.Literals.EXCHANGE_RULE__FIELD)
}

if (queryType.equals(fieldType) && !EDLUtils.stripSet(fieldType).startsWith("set") && ensemble.roles.exists[it.cardinalityMax != 1 && rule.field.toParts().get(0).equals(it.name)]) {
error("Invalid assignment - it is not allowed to change the members of a role in knowledge exchange rules." , rule, EdlPackage.Literals.EXCHANGE_RULE__FIELD)
}
}

for (RoleDefinition roleDefinition : ensemble.roles) {
Expand Down

0 comments on commit bb6e3c5

Please sign in to comment.