예제 #1
0
 public static Definition CreateDefinition(ModelInfo.SearchParamDefinition paramdef)
 {
     Definition definition = new Definition();
     definition.Argument = ArgumentFactory.Create(paramdef.Type);
     definition.Resource = paramdef.Resource;
     definition.ParamName = paramdef.Name;
     definition.Query = new ElementQuery(paramdef.Path);
     definition.ParamType = paramdef.Type;
     definition.Description = paramdef.Description;
     return definition;
 }
 public void Write(Definition definition, Address address)
 {
     Write(definition, address.City);
     Write(definition, address.Country);
     Write(definition, address.Line); // ienumerable
     Write(definition, address.State);
     Write(definition, address.Text);
     Write(definition, address.Use.ToString());
     Write(definition, address.PostalCode);
 }
 public void Write(Definition definition, ContactPoint contact)
 {
     Write(definition, Cast(contact.ValueElement));
 }
        public void Write(Definition definition, Identifier identifier)
        {
            string system = (identifier.System != null) ? identifier.System.ToString() : null;
            string code = (identifier.Value != null) ? identifier.Value : null;

            BsonDocument value = new BsonDocument()
                {
                    { "system", system },
                    { "code", code },
                    // eigenlijk moet het ook een Display bevatten (om dat search daarop kan zoeken bij een token)
                };
            document.Write(definition.ParamName, value);
        }
        public void Write(Definition definition, Coding coding)
        {
            string system = (coding.System != null) ? coding.System.ToString() : null;
            string code = ((coding.Code != null) && (coding.Code != null)) ? coding.Code : null;

            BsonDocument value = new BsonDocument()
                {
                    { "system", system, system != null },
                    { "code", code },
                    { "display", coding.Display, coding.Display != null }
                };

            document.Write(definition.ParamName, value);
        }
 // DSTU2: tags
 //public void Collect(Tag tag)
 //{
 //    string scheme = Assigned(tag.Scheme) ? tag.Scheme.ToString() : null;
 //    string term = tag.Term;
 //    string label = tag.Label;
 //    //string tagstring = glue("/", scheme, term);
 //    BsonDocument value = new BsonDocument()
 //        {
 //            { "scheme", scheme },
 //            { "term", term },
 //            { "label", label }
 //        };
 //    Write(InternalField.TAG, value);
 //}
 public void Write(Definition definition, Quantity quantity)
 {
     switch (definition.ParamType)
     {
         case Conformance.SearchParamType.Quantity:
         {
             BsonDocument block = quantity.ToBson();
             document.Write(definition.ParamName, block);
             break;
         }
         case Conformance.SearchParamType.Date:
         {
             break;
         }
         default: return;
     }
 }
예제 #7
0
 public void Replace(Definition definition)
 {
     definitions.RemoveAll(d => (d.Resource == definition.Resource) && (d.ParamName == definition.ParamName));
     definitions.Add(definition);
     // for manual correction
 }
        public void Write(Definition definition, Period period)
        {
            string start = definition.Argument.GroomElement(period.Start);
            string end = definition.Argument.GroomElement(period.End);

            BsonDocument value = new BsonDocument()
                {
                    { "start", start },
                    { "end", end }
                };
            document.Write(definition.ParamName, value);
        }
 public void Write(Definition definition, IEnumerable<string> items)
 {
     if (items != null)
     {
         foreach (string item in items)
         {
             Write(definition, item);
         }
     }
 }
        public void Write(Definition definition, string value)
        {
            if (definition.Argument != null)
                value = definition.Argument.GroomElement(value);

            document.Write(definition.ParamName, value);
        }
 public void Write(Definition definition, Code code)
 {
     if (code != null)
     {
         Write(definition, code.Value);
     }
 }
예제 #12
0
 public void Replace(Definition definition)
 {
     definitions.RemoveAll(d => (d.Resource == definition.Resource) && (d.ParamName == definition.ParamName));
     definitions.Add(definition);
     // for manual correction
 }
예제 #13
0
 public void Add(Definition definition)
 {
     this.definitions.Add(definition);
 }
 public void Write(Definition definition, HumanName name)
 {
     Write(definition, name.Given);
     Write(definition, name.Prefix);
     Write(definition, name.Family);
     Write(definition, name.Suffix);
     //Write(definition, name.Use.ToString());
 }
 public void Write(Definition definition, List<FhirString> list)
 {
     foreach (FhirString fs in list)
     {
         Write(definition, Cast(fs));
     }
 }
 public void Write(Definition definition, CodeableConcept concept)
 {
     document.Write(definition.ParamName + "_text", concept.Text);
     if (concept.Coding != null)
     {
         foreach (Coding coding in concept.Coding)
         {
             Write(definition, coding);
         }
     }
 }
 public void Write(Definition definition, Enum item)
 {
     var coding = new Coding();
     coding.Code = getEnumLiteral(item);
     Write(definition, coding);
 }
 public void InvokeWrite(Definition definition, object item)
 {
     if (item != null)
     {
         Type type = item.GetType();
         MethodInfo m = this.GetType().GetMethod("Write", new Type[] { typeof(Definition), type });
         if (m != null)
         {
             var result = m.Invoke(this, new object[] { definition, item });
         }
         else
         {
             string result = null;
             m = typeof(BsonIndexDocumentBuilder).GetMethod("Cast", new Type[] { type });
             if (m != null)
             {
                 var cast = m.Invoke(this, new object[] { item });
                 result = (string)cast;
             }
             else
             {
                 result = item.ToString();
                 LogNotImplemented(item);
             }
             Write(definition, result);
         }
     }
     else
     {
         Write(definition, (string)null);
     }
 }
예제 #19
0
 public void Add(Definition definition)
 {
     this.definitions.Add(definition);
 }