ComponentReference<?> ownedComponentTarget = parseComponentReference(composite.getName(), owned, true);
String property = parseString(composite.getName(), owned, ATT_PROPERTY, false);
String values = parseString(composite.getName(), owned, ATT_VALUE, property != null);
OwnedComponentDeclaration ownedComponent = new OwnedComponentDeclaration(ownedComponentTarget, property, new HashSet<String>(list(values,true)));
/*
* parse optional grants
*/
for (Element grant : optional(owned.getElements(GRANT, APAM))) {
ComponentReference<?> definingComponent = parseComponentReference(composite.getName(), grant, true);
String identifier = parseString(composite.getName(), grant, ATT_RELATION, false);
identifier = identifier != null ? identifier : ownedComponent.getComponent().getName();
RelationDeclaration.Reference relation = new RelationDeclaration.Reference(definingComponent, identifier);
String states = parseString(composite.getName(), grant, ATT_WHEN, true);
GrantDeclaration grantDeclaration = new GrantDeclaration(relation, new HashSet<String>(list(states,true)));
ownedComponent.getGrants().add(grantDeclaration);
}
/*
* parse explicit denies
*/
for (Element deny : optional(owned.getElements(DENY, APAM))) {
ComponentReference<?> definingComponent = parseComponentReference(composite.getName(), deny, true);
String identifier = parseString(composite.getName(), deny, ATT_RELATION, false);
identifier = identifier != null ? identifier : ownedComponent.getComponent().getName();
RelationDeclaration.Reference relation = new RelationDeclaration.Reference(definingComponent, identifier);
String states = parseString(composite.getName(), deny, ATT_WHEN, true);
GrantDeclaration denyDeclaration = new GrantDeclaration(relation, new HashSet<String>(list(states,true)));
ownedComponent.getDenies().add(denyDeclaration);
}
composite.getOwnedComponents().add(ownedComponent);
}
}