Beispiel #1
0
        /// /// <summary>
        /// Returns a C_COMPLEX_OBJECT class
        /// </summary>
        /// <param name="an_attribute">The attribute that has the C_COMPLEX_OBJECT as a child</param>
        /// <param name="reference_model_class_name">The name of the reference model class as a string</param>
        /// <returns>an AOM C_Complex_object that has these features set</returns>
        public C_COMPLEX_OBJECT MakeComplexObject(C_ATTRIBUTE an_attribute, string reference_model_class_name)
        {
            C_COMPLEX_OBJECT result = MakeComplexObject(reference_model_class_name);

            add_object(an_attribute, result);
            return(result);
        }
Beispiel #2
0
        /// /// <summary>
        /// Returns a C_COMPLEX_OBJECT class
        /// </summary>
        /// <param name="an_attribute">The attribute that has the C_COMPLEX_OBJECT as a child</param>
        /// <param name="reference_model_class_name">The name of the reference model class as a string</param>
        /// <param name="node_id">The node id of this class</param>
        /// <param name="an_occurrences">The occurrences as an object</param>
        /// <returns>an AOM C_Complex_object that has these features set</returns>
        public C_COMPLEX_OBJECT MakeComplexObject(C_ATTRIBUTE an_attribute, string reference_model_class_name, string node_id, IntervalOfInteger an_occurrences)
        {
            C_COMPLEX_OBJECT result = MakeComplexObject(reference_model_class_name, node_id, an_occurrences);

            add_object(an_attribute, result);
            return(result);
        }
Beispiel #3
0
        protected virtual object Visit(openehr.openehr.am.archetype.constraint_model.Impl.C_COMPLEX_OBJECT o, int depth)
        {
            C_COMPLEX_OBJECT result = new C_COMPLEX_OBJECT();

            CloneC_Object(result, o);
            return(result);
        }
Beispiel #4
0
        /// <summary>
        /// Returns a C_COMPLEX_OBJECT class
        /// </summary>
        /// <param name="reference_model_class_name">The name of the reference model class as a string</param>
        /// <param name="an_occurrence">The number occurrences of this object</param>
        /// <returns>an AOM C_Complex_object that has these features set</returns>
        public C_COMPLEX_OBJECT MakeComplexObject(string reference_model_class_name, IntervalOfInteger an_occurrence)
        {
            C_COMPLEX_OBJECT result = new C_COMPLEX_OBJECT();

            result.rm_type_name = reference_model_class_name;
            result.node_id      = "";
            result.occurrences  = an_occurrence;
            return(result);
        }
Beispiel #5
0
        /// <summary>
        /// Returns a C_COMPLEX_OBJECT class
        /// </summary>
        /// <param name="reference_model_class_name">The name of the reference model class as a string</param>
        /// <returns>an AOM C_Complex_object that has these features set</returns>
        public C_COMPLEX_OBJECT MakeComplexObject(string reference_model_class_name)
        {
            C_COMPLEX_OBJECT result = new C_COMPLEX_OBJECT();

            result.rm_type_name = reference_model_class_name;
            result.node_id      = "";
            result.occurrences  = default_occurrences();
            return(result);
        }
Beispiel #6
0
        /// <summary>
        /// Returns a C_COMPLEX_OBJECT class
        /// </summary>
        /// <param name="reference_model_class_name">The name of the reference model class as a string</param>
        /// <param name="node_id">The node id of this class</param>
        /// <param name="an_occurrences">The occurrences as an object</param>
        /// <returns>an AOM C_Complex_object that has these features set</returns>
        //public C_COMPLEX_OBJECT MakeComplexObject(string reference_model_class_name, string node_id, interval_of_integer an_occurrences)
        public C_COMPLEX_OBJECT MakeComplexObject(string reference_model_class_name, string node_id, IntervalOfInteger an_occurrences)//JAR: 30APR2007, AE-42 Support XML Schema 1.0.1
        {
            C_COMPLEX_OBJECT result = new C_COMPLEX_OBJECT();

            result.rm_type_name = reference_model_class_name;
            result.node_id      = node_id;
            result.occurrences  = an_occurrences;
            return(result);
        }
Beispiel #7
0
        //public C_SINGLE_ATTRIBUTE MakeSingleAttribute(C_COMPLEX_OBJECT an_object, string name) //JAR: 30APR2007, AE-42 Support XML Schema 1.0.1
        public C_SINGLE_ATTRIBUTE MakeSingleAttribute(C_COMPLEX_OBJECT an_object, string name, IntervalOfInteger existence)
        {
            C_SINGLE_ATTRIBUTE result = new C_SINGLE_ATTRIBUTE();

            result.rm_attribute_name = name;
            result.existence         = existence; //JAR: 30APR2007, AE-42 Support XML Schema 1.0.1
            add_attribute(an_object, result);
            return(result);
        }
Beispiel #8
0
        C_COMPLEX_OBJECT VisitComplexObjectConstraint(C_COMPLEX_OBJECT objectConstraint)
        {
            System.Diagnostics.Trace.Assert(objectConstraint != null, "objectConstraint must not be null");

            C_COMPLEX_OBJECT result = new C_COMPLEX_OBJECT();

            CloneObjectConstraint(objectConstraint, result);
            result.attributes = VisitAttributes(objectConstraint.attributes);

            return(result);
        }
Beispiel #9
0
        //public C_MULTIPLE_ATTRIBUTE MakeMultipleAttribute(C_COMPLEX_OBJECT an_object, string name, CARDINALITY a_cardinality)//, int capacity) //JAR: 30APR2007, AE-42 Support XML Schema 1.0.1
        public C_MULTIPLE_ATTRIBUTE MakeMultipleAttribute(C_COMPLEX_OBJECT an_object, string name, CARDINALITY a_cardinality, IntervalOfInteger existence)//, int capacity)
        {
            C_MULTIPLE_ATTRIBUTE result = new C_MULTIPLE_ATTRIBUTE();

            result.rm_attribute_name = name;
            result.cardinality       = a_cardinality;
            result.existence         = existence; //JAR: 30APR2007, AE-42 Support XML Schema 1.0.1
            //result.children = Array.CreateInstance(typeof(XMLParser.C_OBJECT), capacity) as C_OBJECT[];
            add_attribute(an_object, result);
            return(result);
        }
Beispiel #10
0
        /// <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);
        }
Beispiel #11
0
        public static CComplexObject Map(this C_COMPLEX_OBJECT model)
        {
            var complexObject = new CComplexObject();

            foreach (C_ATTRIBUTE attribute in model.attributes)
            {
                complexObject.Attributes.Add(attribute.Map());
            }
            complexObject.NodeId = model.node_id;
            complexObject.ReferenceModelTypeName = model.rm_type_name;
            complexObject.Occurences             = model.occurrences.Map();
            complexObject.AnyAllowed             = model.any_allowed;

            return(complexObject);
        }
Beispiel #12
0
        private void add_attribute(C_COMPLEX_OBJECT an_object, C_ATTRIBUTE an_attribute)
        {
            int i;

            if (an_object.attributes == null)
            {
                an_object.attributes = Array.CreateInstance(typeof(C_ATTRIBUTE), 1) as C_ATTRIBUTE[];
                i = 0;
            }
            else
            {
                C_ATTRIBUTE[] new_attributes = an_object.attributes;
                i = new_attributes.Length;
                Array.Resize(ref new_attributes, i + 1);
                an_object.attributes = new_attributes;
            }
            an_object.attributes[i] = an_attribute;
        }
Beispiel #13
0
        private void get_paths(System.Collections.ArrayList list, C_COMPLEX_OBJECT node, string path)
        {
            if (path != "")
            {
                if (!string.IsNullOrEmpty(node.node_id))
                {
                    path += "[" + node.node_id + "]";
                }
                list.Add(path);
            }

            if (node.attributes != null)
            {
                foreach (C_ATTRIBUTE attrib in node.attributes)
                {
                    if (attrib.children != null)
                    {
                        if (attrib.GetType() == typeof(C_MULTIPLE_ATTRIBUTE))
                        {
                            foreach (C_OBJECT obj in attrib.children)
                            {
                                C_COMPLEX_OBJECT co = obj as C_COMPLEX_OBJECT;

                                if (co != null && !string.IsNullOrEmpty(co.node_id))
                                {
                                    get_paths(list, co, path + "/" + attrib.rm_attribute_name);
                                }
                            }
                        }
                        else //single attribute
                        {
                            C_COMPLEX_OBJECT co = attrib.children[0] as C_COMPLEX_OBJECT;

                            if (co != null)
                            {
                                get_paths(list, co, path + "/" + attrib.rm_attribute_name);
                            }
                        }
                    }
                }
            }
        }
Beispiel #14
0
        C_OBJECT[] VisitChildren(C_OBJECT[] children)
        {
            C_OBJECT[] result = null;

            if (children != null)
            {
                List <C_OBJECT> objectConstraintList = new List <C_OBJECT>();

                foreach (C_OBJECT objectConstraint in children)
                {
                    C_OBJECT         newObjectConstraint;
                    C_COMPLEX_OBJECT complexObjectConstraint = objectConstraint as C_COMPLEX_OBJECT;

                    if (complexObjectConstraint != null)
                    {
                        newObjectConstraint = VisitComplexObjectConstraint(complexObjectConstraint);
                    }
                    else
                    {
                        C_PRIMITIVE_OBJECT primitiveObjectConstraint = objectConstraint as C_PRIMITIVE_OBJECT;

                        if (primitiveObjectConstraint != null)
                        {
                            newObjectConstraint = VisitPrimitiveObjectConstraint(primitiveObjectConstraint);
                        }
                        else
                        {
                            newObjectConstraint = objectConstraint;
                        }
                    }

                    System.Diagnostics.Debug.Assert(newObjectConstraint != null, "newObject must not be null");
                    objectConstraintList.Add(newObjectConstraint);
                }

                result = objectConstraintList.ToArray();
            }

            return(result);
        }
Beispiel #15
0
        private void AddTerms(ArrayList result, C_OBJECT obj)
        {
            if (obj.GetType() == typeof(C_COMPLEX_OBJECT))
            {
                C_COMPLEX_OBJECT co = (C_COMPLEX_OBJECT)obj;

                //Add the node id
                if (!string.IsNullOrEmpty(obj.node_id) && !result.Contains(obj.node_id))
                {
                    result.Add(obj.node_id);
                }

                if (co.attributes != null)
                {
                    foreach (C_ATTRIBUTE attribute in co.attributes)
                    {
                        if (attribute.children != null)
                        {
                            foreach (C_OBJECT obj_1 in attribute.children)
                            {
                                AddTerms(result, obj_1);
                            }
                        }
                    }
                }
            }
            else if (obj.GetType() == typeof(ARCHETYPE_SLOT))
            {
                if (!string.IsNullOrEmpty(obj.node_id) && !result.Contains(obj.node_id))
                {
                    result.Add(obj.node_id);
                }
            }
            //check for internal codes
            else if (obj.GetType() == typeof(C_CODE_PHRASE))
            {
                C_CODE_PHRASE ct = (C_CODE_PHRASE)obj;

                //Check reference
                if (ct.terminology_id != null)
                {
                    if (ct.terminology_id.value.ToString().ToLowerInvariant() == "local" && ct.code_list != null)
                    {
                        foreach (string code in ct.code_list)
                        {
                            if (!result.Contains(code))
                            {
                                result.Add(code);
                            }
                        }
                    }
                }
            }
            //Ordinals use internal codes
            else if (obj.GetType() == typeof(C_DV_ORDINAL))
            {
                C_DV_ORDINAL co = (C_DV_ORDINAL)obj;

                if (co.list != null && co.list.Length > 0)
                {
                    foreach (DV_ORDINAL o in co.list)
                    {
                        if (o.symbol != null && o.symbol.defining_code != null)
                        {
                            if (!result.Contains(o.symbol.defining_code.code_string))
                            {
                                result.Add(o.symbol.defining_code.code_string);
                            }
                        }
                    }
                }
            }
            //Constraint references us acXXXX codes
            else if (obj.GetType() == typeof(CONSTRAINT_REF))
            {
                CONSTRAINT_REF cr = (CONSTRAINT_REF)obj;

                if (cr.reference != null)
                {
                    if (!result.Contains(cr.reference))
                    {
                        result.Add(cr.reference);
                    }
                }
            }
        }
Beispiel #16
0
        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);
                    }
                }
            }
        }