Beispiel #1
0
 private void WriteNonDataType(string relationshipName, BeanProperty property, object @object)
 {
     if (property.Collection)
     {
         if (ListElementUtil.IsCollection(@object))
         {
             ListElementUtil.AddAllElements(property.Get(), @object);
         }
         else
         {
             this.log.Info("Warning mapping HL7 single property to Teal collection. Property=" + relationshipName);
             ListElementUtil.AddElement(property.Get(), @object);
         }
     }
     else
     {
         if (property.Writable)
         {
             if (@object != null)
             {
                 property.Set(@object);
             }
         }
         else
         {
             throw new MarshallingException("Cannot write to " + property.Name + " of " + this.sorter.GetBean().GetType());
         }
     }
 }
Beispiel #2
0
        public void ShouldAddToHl7List()
        {
            Object list = new LISTImpl <ST, String>(typeof(STImpl)).BareValue;

            ListElementUtil.AddElement(list, new STImpl("Betty"));
            Assert.AreEqual(1, ListElementUtil.Count(list), "count");
        }
Beispiel #3
0
        private void WriteDataType(BeanProperty property, BareANY value, string dataTypeName)
        {
            BareANY field = new DataTypeFieldHelper(property.Bean, property.Name).Get <BareANY>();

            if (field == null)
            {
                //this is required for the case sure when we collapse an association with cardinality > 1
                //into a List of data types. See DevicePrescriptionSummaryQueryCriteriaBean#getRxDispenseIndicator
                if (property.Collection)
                {
                    ListElementUtil.AddElement(property.Get(), value.BareValue);
                }
            }
            else
            {
                value = this.adapterProvider.GetAdapter(dataTypeName, field.GetType()).Adapt(field.GetType(), value);
                if (value.HasNullFlavor())
                {
                    new DataTypeFieldHelper(property.Bean, property.Name).SetNullFlavor(value.NullFlavor);
                }
                if (field is ANYMetaData && value is ANYMetaData)
                {
                    // preserve any meta data (yes, this is not ideal)
                    ((ANYMetaData)field).Language     = ((ANYMetaData)value).Language;
                    ((ANYMetaData)field).DisplayName  = ((ANYMetaData)value).DisplayName;
                    ((ANYMetaData)field).OriginalText = ((ANYMetaData)value).OriginalText;
                    ((ANYMetaData)field).Translations.AddAll(((ANYMetaData)value).Translations);
                }
                ((BareANYImpl)field).BareValue = value.BareValue;
                field.DataType = value.DataType;
            }
        }
Beispiel #4
0
        public void ShouldAddToHl7RawList()
        {
            IList <String> list = new LISTImpl <ST, String>(typeof(STImpl)).RawList();

            list.Add("Fred");
            list.Add("Barney");
            list.Add("Wilma");

            ListElementUtil.AddElement(list, "Betty");
            Assert.AreEqual(4, list.Count, "count");
            Assert.IsTrue(list.Contains("Betty"));
        }