Skip to content
Snippets Groups Projects
Commit f890c0a1 authored by Thomas's avatar Thomas
Browse files

fixed bug with missing occurence constraints on role groups

parent b2fe96b2
No related branches found
No related tags found
No related merge requests found
...@@ -31,7 +31,24 @@ rule RoleGroup ...@@ -31,7 +31,24 @@ rule RoleGroup
if(cards.size()>1) { if(cards.size()>1) {
t.upper = cards[1]; t.upper = cards[1];
} }
} }
//only transform if the role type is in a compartment type
if(s.getContainer().getParent().getType==(source!Type#CompartmentType)) {
//get the crom equivalent to compartment type the role type is in
var compartmentType = s.getContainer.getParent().equivalent();
//check if a part with that role does not already is added to the compartment type
var partAlreadyAdded = false;
for(alreadyAddedPart : target!Part in compartmentType.getParts()) {
if(alreadyAddedPart.role == s.~transformed) partAlreadyAdded = true;
}
if(not(partAlreadyAdded)) {
//create a new part with the role
var part = new target!Part;
part.role = s.~transformed;
part.whole = compartmentType;
//add the part to the compartment type the role type
compartmentType.getParts().add(part);
} }
//transform children //transform children
var children = s.`model`; var children = s.`model`;
if (not (children == null)) { if (not (children == null)) {
......
...@@ -25,7 +25,7 @@ rule RoleGroupWithOccurenceConstraints ...@@ -25,7 +25,7 @@ rule RoleGroupWithOccurenceConstraints
guard : not(s.getContainer().getParent() == null) and guard : not(s.getContainer().getParent() == null) and
s.getContainer().getParent().getType==(source!Type#CompartmentType) and s.getContainer().getParent().getType==(source!Type#CompartmentType) and
s.~features.get("Occurrence_Constraints") s.~features.get("Occurrence_Constraints")
//parse the lower and upper bound from the role //parse the lower and upper bound from the role
var desc = s.description; var desc = s.description;
if (not (desc == null)) { if (not (desc == null)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment