@Override public CAttribute copy() { return new CMultipleAttribute(path(), getRmAttributeName(), getExistence(), cardinality, copyChildren()); }
@Override public CAttribute copy() { return new CMultipleAttribute(path(), getRmAttributeName(), getExistence(), cardinality, copyChildren()); }
attribute = new CSingleAttribute(path, name, existence, children); } else { attribute = new CMultipleAttribute(path, name, existence, cardinality, children);
itemsAttribute = new CMultipleAttribute(path, ITEMS, Existence.OPTIONAL, Cardinality.LIST, alternatives); root.addAttribute(itemsAttribute);
attribute = new CSingleAttribute(path, name, existence, children); } else { attribute = new CMultipleAttribute(path, name, existence, cardinality, children);
itemsAttribute = new CMultipleAttribute(path, ITEMS, Existence.OPTIONAL, Cardinality.LIST, alternatives); root.addAttribute(itemsAttribute);
itemsAttribute = new CMultipleAttribute(path, ITEMS, Existence.OPTIONAL, Cardinality.LIST, alternatives); root.addAttribute(itemsAttribute);
contentAttribute = new CMultipleAttribute(path, CONTENT, Existence.OPTIONAL, Cardinality.LIST, alternatives); archetype.getDefinition().addAttribute(contentAttribute);
private Archetype flattenComposition(COMPOSITION composition) throws FlatteningException { log.debug("flattening composition on archetype: " + composition.getArchetypeId()); Archetype archetype = retrieveArchetype(composition.getArchetypeId()); CComplexObject root = archetype.getDefinition(); CAttribute contentAttribute = root.getAttribute(CONTENT); removeArchetypeSlots(contentAttribute); // handle "/content" attribute ContentItem[] items = composition.getContentArray(); if (items != null && items.length > 0) { String path = "/" + CONTENT; if (contentAttribute == null) { List<CObject> alternatives = new ArrayList<>(); contentAttribute = new CMultipleAttribute(path, CONTENT, Existence.OPTIONAL, Cardinality.LIST, alternatives); archetype.getDefinition().addAttribute(contentAttribute); } for (ContentItem item : items) { log.debug("flattening composition.content.."); flattenContentItem(archetype, item); } } // TODO handle "/context" attribute // log.warn("flattening composition.context..not implemented"); applyRules(archetype, composition.getRuleArray()); applyNameConstraint(archetype, archetype.getDefinition(), composition.getName(), "/"); return archetype; }
contentAttribute = new CMultipleAttribute(path, CONTENT, Existence.OPTIONAL, Cardinality.LIST, alternatives); archetype.getDefinition().addAttribute(contentAttribute);