}
private void readMemberships(List<Element> membershipElements) {
for (Element membershipElement : membershipElements) {
String userName = membershipElement.attributeValue("user");
User user = users.get(userName);
if (user == null)
throw new JbpmException("unexisting membership user '" + userName + "'");
String groupName = membershipElement.attributeValue("group");
Group group = groups.get(groupName);
if (group == null)
throw new JbpmException("unexisting membership group '" + groupName + "'");
Membership membership = new Membership();
membership.setRole(membershipElement.attributeValue("role"));
group.addMembership(membership);
user.addMembership(membership);
entities.add(membership);
}
}