protected virtual void CloneTree(openehr.openehr.am.archetype.constraint_model.C_COMPLEX_OBJECT adlComplexObject, C_COMPLEX_OBJECT parentComplexObject, int depth) { CloneConstraintVisitor nodeVisitor = NewInstance(); openehr.openehr.am.archetype.constraint_model.C_ATTRIBUTE adlAttribute; parentComplexObject.attributes = new C_ATTRIBUTE[adlComplexObject.attributes().count()]; for (int i = 1; i <= adlComplexObject.attributes().count(); i++) { adlAttribute = adlComplexObject.attributes().i_th(i) as openehr.openehr.am.archetype.constraint_model.C_ATTRIBUTE; C_ATTRIBUTE attributeNode = nodeVisitor.CloneAttribute(adlAttribute); attributeNode.children = new C_OBJECT[adlAttribute.children().count()]; parentComplexObject.attributes[i - 1] = attributeNode; for (int j = 1; j <= adlAttribute.children().count(); j++) { openehr.openehr.am.archetype.constraint_model.C_OBJECT child = adlAttribute.children().i_th(j) as openehr.openehr.am.archetype.constraint_model.C_OBJECT; object childNode = nodeVisitor.Visit(child, depth); attributeNode.children[j - 1] = childNode as C_OBJECT; if (child is openehr.openehr.am.archetype.constraint_model.Impl.C_COMPLEX_OBJECT) { CloneTree(child as openehr.openehr.am.archetype.constraint_model.C_COMPLEX_OBJECT, childNode as C_COMPLEX_OBJECT, ++depth); } } } }
protected override C_ATTRIBUTE CloneAttribute(openehr.openehr.am.archetype.constraint_model.C_ATTRIBUTE currentObject) { C_ATTRIBUTE result = base.CloneAttribute(currentObject); openehr.openehr.am.archetype.constraint_model.C_COMPLEX_OBJECT parent = currentObject.parent() as openehr.openehr.am.archetype.constraint_model.C_COMPLEX_OBJECT; if (parent != null) { string parentTypeName = parent.rm_type_name().to_cil(); string attrName = result.rm_attribute_name; if ((parentTypeName == "COMPOSITION" && attrName == "context") || (parentTypeName == "COMPOSITION" && attrName == "content") || (parentTypeName == "EVENT_CONTEXT" && attrName == "other_context") || (parentTypeName == "EVENT_CONTEXT" && attrName == "heath_care_facility") || (parentTypeName == "EVENT_CONTEXT" && attrName == "end_time") || (parentTypeName == "EVENT_CONTEXT" && attrName == "participations") || (parentTypeName == "EVENT_CONTEXT" && attrName == "location") || (parentTypeName == "SECTION" && attrName == "items") || (entries.Contains(parentTypeName) && attrName == "other_participations") || (entries.Contains(parentTypeName) && attrName == "provider") || (entries.Contains(parentTypeName) && attrName == "workflow_id") || (careEntries.Contains(parentTypeName) && attrName == "protocol") || (careEntries.Contains(parentTypeName) && attrName == "guideline_id") || (parentTypeName == "OBSERVATION" && attrName == "state") || (parentTypeName == "INSTRUCTION" && attrName == "activities") || (parentTypeName == "INSTRUCTION" && attrName == "expiry_time") || (parentTypeName == "INSTRUCTION" && attrName == "wf_definition") || (parentTypeName == "ACTION" && attrName == "instruction_details") || (parentTypeName == "INSTRUCTION_DETAILS" && attrName == "wf_details") || (parentTypeName == "ISM_TRANSITION" && attrName == "careflow_step") || (parentTypeName == "ITEM_TREE" && attrName == "items") || (parentTypeName == "ITEM_TABLE" && attrName == "rows") || (parentTypeName == "ITEM_LIST" && attrName == "items") || (parentTypeName == "HISTORY" && attrName == "events") || (parentTypeName == "HISTORY" && attrName == "period") || (events.Contains(parentTypeName) && attrName == "state") || (parentTypeName == "ELEMENT" && attrName == "value") || (parentTypeName == "ELEMENT" && attrName == "null_flavour") || (regexDvInterval.IsMatch(parentTypeName) && (attrName == "lower" || attrName == "upper")) ) { result.existence = new IntervalOfInteger(); result.existence.lower = 0; result.existence.upper = 1; result.existence.lowerSpecified = true; result.existence.upperSpecified = true; result.existence.lower_included = true; result.existence.upper_included = true; result.existence.lower_includedSpecified = true; result.existence.upper_includedSpecified = true; } } return(result); }