Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 10
0
        public void Write(Definition definition, string value)
        {
            if (definition.Argument != null)
                value = definition.Argument.GroomElement(value);

            document.Write(definition.ParamName, value);
        }
Ejemplo n.º 11
0
 public void Write(Definition definition, Code code)
 {
     if (code != null)
     {
         Write(definition, code.Value);
     }
 }
Ejemplo n.º 12
0
 public void Replace(Definition definition)
 {
     definitions.RemoveAll(d => (d.Resource == definition.Resource) && (d.ParamName == definition.ParamName));
     definitions.Add(definition);
     // for manual correction
 }
Ejemplo n.º 13
0
 public void Add(Definition definition)
 {
     this.definitions.Add(definition);
 }
Ejemplo n.º 14
0
 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());
 }
Ejemplo n.º 15
0
 public void Write(Definition definition, List<FhirString> list)
 {
     foreach (FhirString fs in list)
     {
         Write(definition, Cast(fs));
     }
 }
Ejemplo n.º 16
0
 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);
         }
     }
 }
Ejemplo n.º 17
0
 public void Write(Definition definition, Enum item)
 {
     var coding = new Coding();
     coding.Code = getEnumLiteral(item);
     Write(definition, coding);
 }
Ejemplo n.º 18
0
 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);
     }
 }
Ejemplo n.º 19
0
 public void Add(Definition definition)
 {
     this.definitions.Add(definition);
 }