コード例 #1
0
        protected virtual RESOURCE_DESCRIPTION CloneDescription(openehr.openehr.rm.common.resource.RESOURCE_DESCRIPTION o)
        {
            RESOURCE_DESCRIPTION result = new RESOURCE_DESCRIPTION();

            result.original_author = CloneHashTableAny(o.original_author());

            if (o.other_contributors() != null && o.other_contributors().count() > 0)
            {
                result.other_contributors = new string[o.other_contributors().count()];

                for (int i = 1; i < result.other_contributors.Length; i++)
                    result.other_contributors[i - 1] = (([email protected]_8)o.other_contributors().i_th(i)).to_cil();
            }

            result.lifecycle_state = o.lifecycle_state().to_cil();

            if (o.resource_package_uri() != null)
                result.resource_package_uri = o.resource_package_uri().ToString();

            result.other_details = CloneHashTableAny(o.other_details());

            // 0..1 parent_resource AUTHORED_RESOURCE (does not occur in NHS archetypes, do later)
            //if (o.parent_resource() != null)
            //result.parent_resource = CloneAuthoredResource(o.parent_resource());            

            if (o.details().count() > 0)
            {
                RESOURCE_DESCRIPTION_ITEM[] details = new RESOURCE_DESCRIPTION_ITEM[o.details().count()];
                o.details().start();

                for (int i = 1; i <= o.details().count(); i++)
                {
                    openehr.openehr.rm.common.resource.Impl.RESOURCE_DESCRIPTION_ITEM item = o.details().item_for_iteration() as openehr.openehr.rm.common.resource.Impl.RESOURCE_DESCRIPTION_ITEM;
                    details[i - 1] = new RESOURCE_DESCRIPTION_ITEM();
                    details[i - 1].language = CloneCodePhrase(item.language());

                    if (item.purpose() != null)
                        details[i - 1].purpose = item.purpose().ToString();

                    if (item.use() != null)
                        details[i - 1].use = item.use().ToString();

                    if (item.misuse() != null)
                        details[i - 1].misuse = item.misuse().ToString();

                    if (item.copyright() != null)
                        details[i - 1].copyright = item.copyright().ToString();

                    if (item.original_resource_uri() != null && item.original_resource_uri().count() > 0)
                        result.resource_package_uri = item.original_resource_uri().ToString();

                    // 0..* other_details StringDictionaryItem
                    //cloneObject.other_details = CloneHashTableAny(item.other_details());

                    if (item.keywords() != null && item.keywords().count() > 0)
                    {
                        string[] keywords = new string[item.keywords().count()];
                        details[i - 1].keywords = keywords;

                        for (int j = 1; j <= keywords.Length; j++)
                        {
                            if (item.keywords().i_th(j) != null)
                                keywords[j - 1] = item.keywords().i_th(j).ToString();
                        }
                    }

                    o.details().forth();
                }

                result.details = details;
            }

            return result;
        }