/// <summary> /// Clone an Eiffel ADL archetype as an OpenEhr.V1.Its.Xml.AM.ARCHETYPE. /// </summary> public ARCHETYPE CloneArchetype(openehr.openehr.am.archetype.ARCHETYPE adlArchetype) { ARCHETYPE result = CloneArchetypeDetails(adlArchetype); object rootNode = Visit(adlArchetype.definition(), 0); C_COMPLEX_OBJECT rootComplexObject = rootNode as C_COMPLEX_OBJECT; result.definition = rootComplexObject; CloneTree(adlArchetype.definition(), rootComplexObject, 0); return(result); }
public static ARCHETYPE Build(openehr.openehr.am.archetype.ARCHETYPE archetype, CloneConstraintVisitor visitor) { if (archetype == null) { throw new ArgumentNullException("archetype must not be null"); } if (visitor == null) { throw new ArgumentNullException("visitor must not be null"); } ARCHETYPE result = visitor.CloneArchetype(archetype); #if XMLParser AmSerializer.ValidateArchetype(result); #endif return(result); }
protected virtual ARCHETYPE CloneArchetypeDetails(openehr.openehr.am.archetype.ARCHETYPE archetype) { ARCHETYPE result = new ARCHETYPE(); if (archetype.uid() != null) { HIER_OBJECT_ID uid = new HIER_OBJECT_ID(); uid.value = archetype.uid().value().ToString(); result.uid = uid; } if (archetype.archetype_id() != null) { ARCHETYPE_ID archetypeId = new ARCHETYPE_ID(); archetypeId.value = archetype.archetype_id().value().ToString(); result.archetype_id = archetypeId; } if (archetype.version() != null) { result.adl_version = archetype.adl_version().ToString(); } if (archetype.concept() != null) { result.concept = archetype.concept().ToString(); } result.original_language = CloneCodePhrase(archetype.original_language()); result.is_controlled = archetype.is_controlled(); if (archetype.parent_archetype_id() != null) { ARCHETYPE_ID parentId = new ARCHETYPE_ID(); parentId.value = archetype.parent_archetype_id().value().ToString(); result.parent_archetype_id = parentId; } result.description = CloneDescription(archetype.description()); result.ontology = CloneOntology(archetype.ontology()); // 0..1 revision_history REVISION_HISTORY (does not occur in NHS archetypes, do later) //if (archetype.revision_history() != null) // result.revision_history = CloneAuthoredResource(archetype.revision_history()); if (archetype.translations() != null && archetype.translations().count() >= 0) { TRANSLATION_DETAILS[] translations = new TRANSLATION_DETAILS[archetype.translations().count()]; archetype.translations().start(); for (int i = 1; i <= archetype.translations().count(); i++) { TRANSLATION_DETAILS translation = new TRANSLATION_DETAILS(); openehr.openehr.rm.common.resource.TRANSLATION_DETAILS td = archetype.translations().item_for_iteration() as openehr.openehr.rm.common.resource.TRANSLATION_DETAILS; if (td.accreditation() != null) { translation.accreditation = td.accreditation().ToString(); } translation.author = CloneHashTableAny(td.author()); translation.language = CloneCodePhrase(td.language()); translation.other_details = CloneHashTableAny(td.other_details()); translations[i - 1] = translation; archetype.translations().forth(); } result.translations = translations; } result.invariants = CloneAssertion(archetype.invariants()); return(result); }