public Archetype copy() { String parentId = parentArchetypeId == null ? null : parentArchetypeId.toString(); Archetype archetype = new Archetype(adlVersion, archetypeId.toString(), parentId, concept, getOriginalLanguage(), getTranslations(), null, getRevisionHistory(), isControlled(), uid, (CComplexObject) definition.copy(), ontology, invariants, null); reloadNodeMaps(); // set c_obj.parent()? return archetype; }
public Archetype copy() { String parentId = parentArchetypeId == null ? null : parentArchetypeId.toString(); Archetype archetype = new Archetype(adlVersion, archetypeId.toString(), parentId, concept, getOriginalLanguage(), getTranslations(), null, getRevisionHistory(), isControlled(), uid, (CComplexObject) definition.copy(), ontology, invariants, null); reloadNodeMaps(); // set c_obj.parent()? return archetype; }
/** * Checks the validity of the archetype specialisation parent identifier, i.e. * that the archetype identifier stated in the specialise clause is the * identifier of the immediate specialisation parent archetype. * * @param archetype * @param errors */ public void checkSpecializationParentIdentifierValidity(Archetype archetype, List<ValidationError> errors) { if (archetype.getParentArchetypeId() == null) { return; // no specialise clause at all } ArchetypeID atId = archetype.getArchetypeId(); String base = atId.base(); String calculatedBaseForParent = base.substring(0, base.lastIndexOf("-")); if (!calculatedBaseForParent.equals(archetype.getParentArchetypeId().base())) { ValidationError error = new ValidationError( ErrorType.VASID, "NORMAL", archetype.getArchetypeId().toString(), archetype.getParentArchetypeId().toString()); errors.add(error); } if (archetype.getParentArchetypeId().versionID().endsWith("draft")) { ValidationError error = new ValidationError( ErrorType.VASID, "DEPRECATED", archetype.getParentArchetypeId().toString()); errors.add(error); } }
protected void printHeader(Archetype archetype, Element out) { Element originalLanguage = new Element("original_language", defaultNamespace); out.getChildren().add(originalLanguage); printCodePhrase(archetype.getOriginalLanguage(), originalLanguage); printString("is_controlled", archetype.isControlled() ? "true" : "false", out); printDescription(archetype.getDescription(), out); printTranslations(archetype.getTranslations(), out); if (archetype.getUid() != null) { Element uid = new Element("uid", defaultNamespace); out.getChildren().add(uid); printString("value", archetype.getUid().toString(), uid); } Element archetypeId = new Element("archetype_id", defaultNamespace); out.getChildren().add(archetypeId); printString("value", archetype.getArchetypeId().toString(), archetypeId); printString("adl_version", archetype.getAdlVersion(), out); printString("concept", archetype.getConcept(), out); final ArchetypeID parentID = archetype.getParentArchetypeId(); if(parentID != null) { Element parentArchetypeId = new Element("parent_archetype_id", defaultNamespace); out.getChildren().add(parentArchetypeId); printString("value", parentID.toString(), parentArchetypeId); } }
private Archetype flattenItem(Archetype parentArchetype, ITEM item) throws FlatteningException { String aid = parentArchetype == null ? "null" : parentArchetype.getArchetypeId().toString(); log.debug("flattening item on parentArchetype " + aid + " at path " + item.getPath()); Archetype archetype = retrieveArchetype(item.getArchetypeId()); applyTemplateConstraints(archetype, item); fillArchetypeSlot(parentArchetype, archetype, item.getPath(), item.getName()); return archetype; }
private Archetype flattenItem(Archetype parentArchetype, ITEM item) throws FlatteningException { String aid = parentArchetype == null ? "null" : parentArchetype.getArchetypeId().toString(); log.debug("flattening item on parentArchetype " + aid + " at path " + item.getPath()); Archetype archetype = retrieveArchetype(item.getArchetypeId()); applyTemplateConstraints(archetype, item); fillArchetypeSlot(parentArchetype, archetype, item.getPath(), item.getName()); return archetype; }
private void fillArchetypeSlot(Archetype parentArchetype, Archetype archetype, String path, String name) throws FlatteningException { String archetypeId = archetype.getArchetypeId().toString(); CComplexObject root = archetype.getDefinition(); if (parentArchetype != null) { // TODO has a quick-fix for the following path syntax // "/activities[at0001 and name/value='Medication activity']/description" // WILL NOT WORK IN OTHER CASES!! int hybridStart = path.indexOf(" and name/value='"); if (hybridStart > 0) { int index = path.indexOf("]"); path = path.substring(0, hybridStart) + path.substring(index); log.debug("hybrid path detected, converted physical path: " + path); } CAttribute attribute = getParentAttribute(parentArchetype, path); if (attribute == null) { throw new FlatteningException("CAttribute not found at " + path); } removeArchetypeSlots(attribute); root.setNodeId(archetypeId); String pathSegment = archetypeId; if (name != null) { checkSiblingNodeIdAndName(attribute, archetypeId, name); pathSegment = namedNodeSegment(archetypeId, name); } setPathPrefixOnCObjectTree(root, attribute.path() + "[" + pathSegment + "]"); attribute.addChild(root); } }
Archetype archetype, String path, String name) throws FlatteningException { String archetypeId = archetype.getArchetypeId().toString(); CComplexObject root = archetype.getDefinition();
Archetype archetype, String path, String name) throws FlatteningException { String archetypeId = archetype.getArchetypeId().toString(); CComplexObject root = archetype.getDefinition();
nodeId = archetype.getArchetypeId().toString();
void applyRule(Archetype archetype, Statement rule) throws FlatteningException { log.debug("apply rule [" + rule + "] on archetype: " + archetype.getArchetypeId().toString()); String path = rule.getPath(); ArchetypeConstraint constraint = archetype.node(rule.getPath()); if (constraint == null) { throw new FlatteningException("no constraint on path: " + path + " of " + archetype.getArchetypeId()); } constraint = applyNameConstraint(archetype, constraint, rule.getName(), path); applyOccurrencesConstraints(archetype, constraint, rule); applyDefaultValueConstraint(constraint, rule.getDefault()); applyHideOnFormConstraint(constraint, rule.getHideOnForm()); applyAnnotationConstraint(constraint, rule.getAnnotation()); applyValueConstraint(archetype, constraint, rule); archetype.updatePathNodeMap((CObject) constraint); if (constraint != null) { log.debug("newly set Occurrences: " + ((CObject) constraint).getOccurrences()); } }
archetype.getArchetypeId().toString());
archetype.getArchetypeId().toString());