Пример #1
0
        /// <summary>
        /// CloseCriterium("patient.name=\"Teun\"") -> "patient IN (id1,id2)"
        /// </summary>
        /// <param name="resourceType"></param>
        /// <param name="crit"></param>
        /// <returns></returns>
        private Criterium CloseCriterium(Criterium crit, string resourceType, int level)
        {
            List <string> targeted = crit.GetTargetedReferenceTypes(resourceType);
            List <string> allKeys  = new List <string>();
            var           errors   = new List <Exception>();

            foreach (var target in targeted)
            {
                try {
                    Criterium innerCriterium = (Criterium)crit.Operand;
                    var       keys           = CollectKeys(target, new List <Criterium> {
                        innerCriterium
                    }, ++level);                                                                                   //Recursive call to CollectKeys!
                    allKeys.AddRange(keys.Select(k => k.ToString()));
                }
                catch (Exception ex)
                {
                    errors.Add(ex);
                }
            }
            if (errors.Count == targeted.Count())
            {
                //It is possible that some of the targets don't support the current parameter. But if none do, there is a serious problem.
                throw new ArgumentException(String.Format("None of the possible target resources support querying for parameter {0}", crit.ParamName));
            }
            crit.Operator = Operator.IN;
            crit.Operand  = ChoiceValue.Parse(String.Join(",", allKeys));
            return(crit);
        }
Пример #2
0
        /// <summary>
        /// CloseCriterium("patient.name=\"Teun\"") -> "patient=id1,id2"
        /// </summary>
        /// <param name="resourceType"></param>
        /// <param name="crit"></param>
        /// <returns></returns>
        private Criterium CloseCriterium(Criterium crit, string resourceType)
        {
            List <string> targeted = crit.GetTargetedReferenceTypes(resourceType);
            List <string> allKeys  = new List <string>();

            foreach (var target in targeted)
            {
                var keys = CollectKeys(target, new List <Criterium> {
                    (Criterium)crit.Operand
                });                                                                                            //Recursive call to CollectKeys!
                allKeys.AddRange(keys.Select(k => k.ToString()));
            }
            crit.Type    = Operator.IN;
            crit.Operand = ChoiceValue.Parse(String.Join(",", allKeys));
            return(crit);
        }
Пример #3
0
 /// <summary>
 /// CloseCriterium("patient.name=\"Teun\"") -> "patient=id1,id2"
 /// </summary>
 /// <param name="resourceType"></param>
 /// <param name="crit"></param>
 /// <returns></returns>
 private Criterium CloseCriterium(Criterium crit, string resourceType)
 {
     List<string> targeted = crit.GetTargetedReferenceTypes(resourceType);
     List<string> allKeys = new List<string>();
     foreach (var target in targeted)
     {
         var keys = CollectKeys(target, new List<Criterium> { (Criterium)crit.Operand });               //Recursive call to CollectKeys!
         allKeys.AddRange(keys.Select(k => k.ToString()));
     }
     crit.Type = Operator.IN;
     crit.Operand = ChoiceValue.Parse(String.Join(",", allKeys));
     return crit;
 }
Пример #4
0
        /// <summary>
        /// CloseCriterium("patient.name=\"Teun\"") -> "patient IN (id1,id2)"
        /// </summary>
        /// <param name="resourceType"></param>
        /// <param name="crit"></param>
        /// <returns></returns>
        private Criterium CloseCriterium(Criterium crit, string resourceType, int level)
        {

            List<string> targeted = crit.GetTargetedReferenceTypes(resourceType);
            List<string> allKeys = new List<string>();
            var errors = new List<Exception>();
            foreach (var target in targeted)
            {
                try {
                    Criterium innerCriterium = (Criterium)crit.Operand;
                    var keys = CollectKeys(target, new List<Criterium> { innerCriterium }, ++level);               //Recursive call to CollectKeys!
                    allKeys.AddRange(keys.Select(k => k.ToString()));
                }
                catch (Exception ex)
                {
                    errors.Add(ex);
                }
                }
            if (errors.Count == targeted.Count())
            {
                //It is possible that some of the targets don't support the current parameter. But if none do, there is a serious problem.
                throw new ArgumentException(String.Format("None of the possible target resources support querying for parameter {0}", crit.ParamName));
            }
            crit.Operator = Operator.IN;
            crit.Operand = ChoiceValue.Parse(String.Join(",", allKeys));
            return crit;
        }