Exemple #1
0
        private CodedTypeR2 <Code> ParseTranslation(XmlElement translationElement, ParseContext newContext, XmlToModelResult result
                                                    )
        {
            BareANY anyResult = this.pqrParser.Parse(newContext, translationElement, result);

            return(anyResult == null ? null : (CodedTypeR2 <Code>)anyResult.BareValue);
        }
Exemple #2
0
        public virtual void TestAdaptValueEventRelatedPeriodicInterval()
        {
            ANYImpl <EventRelatedPeriodicIntervalTime> original = new ANYImpl <EventRelatedPeriodicIntervalTime>();

            original.Value       = new EventRelatedPeriodicIntervalTime();
            original.NullFlavor  = Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NO_INFORMATION;
            original.DataType    = StandardDataType.IVL_TS;
            original.Language    = "Fr";
            original.DisplayName = "Display Name";
            original.Translations.Add(new CDImpl(Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive.CUP));
            original.Translations.Add(new CDImpl(Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive.GALLON));
            original.OriginalText = "Original Text";
            original.IsCdata      = false;
            original.Unsorted     = true;
            original.Operator     = SetOperator.CONVEX_HULL;

            BareANY adaptedValue = GenericClassUtil.AdaptValue(original);

            Assert.IsTrue(adaptedValue is SXCM_R2Impl <MbDate>);

            SXCM_R2Impl <MbDate> actualValue = (SXCM_R2Impl <MbDate>)adaptedValue;

            Assert.AreSame(original.Value, actualValue.Value);
            Assert.AreSame(original.NullFlavor, actualValue.NullFlavor);
            Assert.AreSame(original.DataType, actualValue.DataType);
            Assert.AreSame(original.Language, actualValue.Language);
            Assert.AreSame(original.DisplayName, actualValue.DisplayName);
            Assert.AreSame(original.OriginalText, actualValue.OriginalText);
            Assert.AreEqual(original.IsCdata, actualValue.IsCdata);
            Assert.AreEqual(original.Unsorted, actualValue.Unsorted);
            Assert.AreEqual(original.Operator, actualValue.Operator);
            AssertTranslations(original.Translations, actualValue.Translations);
        }
Exemple #3
0
        public virtual BareANY Adapt(Type toDataType, BareANY any)
        {
            IVL <TS, Interval <PlatformDate> > ivl = (IVL <TS, Interval <PlatformDate> >)any;

            return((BareANY) new DataTypeAdapterHelper().CopyAndReturnAdapted(any, (BareANY) new TSImpl(), ((Interval <PlatformDate>)ivl
                                                                                                            .Value).Low));
        }
Exemple #4
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;
            }
        }
Exemple #5
0
        private void ParseUseablePeriods(XmlNode node, XmlToModelResult xmlToModelResult, TelecommunicationAddress result, ParseContext
                                         context)
        {
            XmlNodeList childNodes = node.ChildNodes;

            foreach (XmlNode childNode in new XmlNodeListIterable(childNodes))
            {
                if (childNode is XmlElement)
                {
                    XmlElement useablePeriodElement = (XmlElement)childNode;
                    string     name = NodeUtil.GetLocalOrTagName(useablePeriodElement);
                    if ("useablePeriod".Equals(name))
                    {
                        BareANY tsAny  = tsR2ElementParser.Parse(TsContext(context), useablePeriodElement, xmlToModelResult);
                        MbDate  mbDate = (MbDate)tsAny.BareValue;
                        result.AddUseablePeriod(mbDate == null ? null : mbDate.Value, ((ANYMetaData)tsAny).Operator);
                    }
                    else
                    {
                        xmlToModelResult.AddHl7Error(new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, "Unexpected TEL child element: \"" + useablePeriodElement
                                                                  .Name + "\"", useablePeriodElement));
                    }
                }
            }
        }
Exemple #6
0
        /// <exception cref="Ca.Infoway.Messagebuilder.Marshalling.HL7.XmlToModelTransformationException"></exception>
        private Interval <Int32?> Parse(XmlNode node)
        {
            BareANY ivl = this.parser.Parse(ParseContextImpl.Create("IVL<INT>", typeof(Interval <object>), SpecificationVersion.V02R02
                                                                    , null, null, null, null, null, false), Arrays.AsList(node), this.result);

            return((Interval <Int32?>)(ivl.BareValue));
        }
Exemple #7
0
 private void Validate(Int32?integer, FormatContext context, BareANY bareAny)
 {
     if (integer.Value < 0)
     {
         RecordNotNegativeError(integer, context.GetPropertyPath(), context.GetModelToXmlResult());
     }
 }
Exemple #8
0
        public virtual void TestPivlPhasePeriod()
        {
            XmlToModelResult result = new XmlToModelResult();
            XmlNode          node   = CreateNode("<pivl><period unit=\"d\" value=\"1\"/><phase><low value=\"20120503\"/><high value=\"20120708\"/></phase></pivl>"
                                                 );
            ParseContext context = ParseContextImpl.Create("PIVLTSCDAR1", null, SpecificationVersion.R02_04_03, null, null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel
                                                           .MANDATORY, Cardinality.Create("1"), null, true);
            BareANY          parseResult    = this.parser.Parse(context, Arrays.AsList(node), result);
            PhysicalQuantity expectedPeriod = new PhysicalQuantity(BigDecimal.ONE, Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive
                                                                   .DAY);
            PlatformDate            dateLow             = DateUtil.GetDate(2012, 4, 3);
            DateWithPattern         dateWithPatternLow  = new DateWithPattern(dateLow, "yyyyMMdd");
            PlatformDate            dateHigh            = DateUtil.GetDate(2012, 6, 8);
            DateWithPattern         dateWithPatternHigh = new DateWithPattern(dateHigh, "yyyyMMdd");
            Interval <PlatformDate> expectedPhase       = IntervalFactory.CreateLowHigh((PlatformDate)dateWithPatternLow, (PlatformDate)dateWithPatternHigh
                                                                                        );

            Assert.IsTrue(result.IsValid());
            Assert.IsTrue(parseResult is PIVLTSCDAR1);
            PeriodicIntervalTimeR2 pivl = (PeriodicIntervalTimeR2)parseResult.BareValue;

            Assert.AreEqual(expectedPeriod.Quantity, pivl.Period.Quantity);
            Assert.AreEqual(expectedPeriod.Unit.CodeValue, pivl.Period.Unit.CodeValue);
            Assert.AreEqual(expectedPhase, pivl.Phase);
            Assert.IsNull(pivl.FrequencyRepetitions);
            Assert.IsNull(pivl.FrequencyQuantity);
        }
Exemple #9
0
 private void Validate(Int32?integer, FormatContext context, BareANY bareAny)
 {
     if (integer.Value <= 0)
     {
         RecordMustBeGreaterThanZeroError(integer, context.GetPropertyPath(), context.GetModelToXmlResult());
     }
 }
Exemple #10
0
        private Interval <PlatformDate> ParseValidTime(XmlElement node, ParseContext context, XmlToModelResult xmlToModelResult)
        {
            Interval <PlatformDate> validTime = null;
            bool        foundValidTime        = false;
            bool        loggedValidTimeError  = false;
            XmlNodeList childNodes            = node.ChildNodes;

            foreach (XmlNode childNode in new XmlNodeListIterable(childNodes))
            {
                string childElementName = NodeUtil.GetLocalOrTagName(childNode);
                bool   isValidTime      = AbstractNameR2ElementParser <V> .VALID_TIME_ELEMENT.Equals(childElementName);

                if (!loggedValidTimeError && foundValidTime)
                {
                    loggedValidTimeError = true;
                    RecordError("Only one validTime is allowed, and it must come after all name parts", (XmlElement)node, xmlToModelResult);
                }
                if (childNode is XmlElement)
                {
                    if (isValidTime)
                    {
                        foundValidTime = true;
                        ParseContext newContext = ParseContextImpl.Create("IVL<TS>", context);
                        BareANY      ivlTsAny   = this.ivlTsParser.Parse(newContext, Arrays.AsList(childNode), xmlToModelResult);
                        if (ivlTsAny != null && ivlTsAny.BareValue != null)
                        {
                            DateInterval dateInterval = (DateInterval)ivlTsAny.BareValue;
                            validTime = dateInterval == null ? null : dateInterval.Interval;
                        }
                    }
                }
            }
            return(validTime);
        }
Exemple #11
0
        public override BareANY Parse(ParseContext context, XmlNode node, XmlToModelResult result)
        {
            BareANY            codedTypeAny = DoCreateR2DataTypeInstance(context);
            XmlElement         element      = (XmlElement)node;
            CodedTypeR2 <Code> codedType    = new CodedTypeR2 <Code>();

            // attributes
            HandleNullFlavor(element, codedTypeAny, context, result);
            HandleCodeAndCodeSystem(element, codedType, context, result);
            HandleCodeSystemName(element, codedType, context, result);
            HandleCodeSystemVersion(element, codedType, context, result);
            HandleDisplayName(element, codedType, context, result);
            HandleValue(element, codedType, context, result);
            HandleQty(element, codedType, context, result);
            HandleOperator(element, codedTypeAny, codedType, context, result);
            // elements
            HandleSimpleValue(element, codedType, context, result);
            HandleOriginalText(element, codedType, context, result);
            HandleQualifier(element, codedType, context, result);
            HandleTranslation(element, codedType, context, result);
            HandleValidTime(element, codedType, context, result);
            HandleConstraints(codedType, context.GetConstraints(), element, result);
            // want to return null if no attributes or elements are present
            if (codedType.IsEmpty())
            {
                codedType = null;
            }
            ((BareANYImpl)codedTypeAny).BareValue = CodedTypeR2Helper.ConvertCodedTypeR2(codedType, context.GetExpectedReturnType());
            return(codedTypeAny);
        }
Exemple #12
0
        private string DetermineActualType(Relationship relationship, BareANY hl7Value, Hl7Errors errors, string propertyPath)
        {
            StandardDataType newTypeEnum = (hl7Value == null ? null : hl7Value.DataType);

            return(this.polymorphismHandler.DetermineActualDataType(relationship.Type, newTypeEnum, this.isCda, !this.isR2, CreateErrorLogger
                                                                        (propertyPath, errors)));
        }
Exemple #13
0
        public virtual void ShouldAdaptCorrectly()
        {
            TSImpl  ts      = new TSImpl(new PlatformDate());
            BareANY adapted = this.adapter.Adapt(StandardDataType.IVL_FULL_DATE.Type, ts);

            Assert.AreEqual(((IVL <TS, Interval <PlatformDate> >)adapted).Value.Low, ts.Value, "low");
        }
Exemple #14
0
        public virtual BareANY Adapt(string toDataTypeName, BareANY any)
        {
            BareANY element = null;

            if (any != null)
            {
                PropertyInfo property        = any.GetType().GetProperty("Value");
                object       collectionValue = property.GetValue(any, null);
                if (collectionValue != null)
                {
                    IEnumerable <BareANY> enumerable = (IEnumerable <BareANY>)collectionValue;
                    IEnumerator <BareANY> enumerator = enumerable.GetEnumerator();
                    if (enumerator.MoveNext())
                    {
                        element = enumerator.Current;
                    }
                }
            }
            if (element == null)
            {
                element = new ANYImpl <object>();
            }

            return((BareANY)element);
        }
Exemple #15
0
        protected virtual BareANY CreateDataTypeInstance(string typeName)
        {
            BareANY dataTypeInstance = DoCreateDataTypeInstance(typeName);

            SetDataType(typeName, dataTypeInstance);
            return(dataTypeInstance);
        }
Exemple #16
0
        private void PopulateValue(BareANY dataType, ParseContext context, XmlNode node, XmlToModelResult xmlToModelResult, string
                                   codeAttributeName)
        {
            Code value = ParseNonNullCodeNode(context, codeAttributeName, node, dataType, GetReturnType(context), xmlToModelResult);

            ((BareANYImpl)dataType).BareValue = value;
        }
Exemple #17
0
 private void ExerciseVisitorOverInteractionWithAttribute(BareANY attributeHl7Value, Relationship attributeRelationship)
 {
     this.attributeBridge.SetHl7Value(attributeHl7Value);
     this.visitor.VisitRootStart(this.partBridge, this.interation);
     this.visitor.VisitAttribute(this.attributeBridge, attributeRelationship, null, null, null);
     this.visitor.VisitRootEnd(this.partBridge, this.interation);
 }
Exemple #18
0
 private void RenderRealmCodes(PartBridge tealBean)
 {
     if (tealBean.GetRealmCode() != null)
     {
         string            type      = "CS";
         PropertyFormatter formatter = this.formatterRegistry.Get(type);
         Relationship      placeholderRelationship = new Relationship("realmCode", type, Cardinality.Create("0-*"));
         placeholderRelationship.DomainType = "Realm";
         FormatContext context = Ca.Infoway.Messagebuilder.Marshalling.FormatContextImpl.Create(this.result, null, placeholderRelationship
                                                                                                , version, null, null, null, this.isCda);
         foreach (Realm realm in tealBean.GetRealmCode())
         {
             BareANY any = (BareANY)DataTypeFactory.CreateDataType(type, this.isCda && this.isR2);
             if (this.isR2)
             {
                 ((BareANYImpl)any).BareValue = new CodedTypeR2 <Realm>(realm);
             }
             else
             {
                 ((BareANYImpl)any).BareValue = realm;
             }
             string xmlFragment = formatter.Format(context, any, GetIndent());
             CurrentBuffer().GetChildBuilder().Append(xmlFragment);
         }
     }
 }
Exemple #19
0
        public override string Format(FormatContext context, BareANY hl7Value, int indentLevel)
        {
            string result = base.Format(context, hl7Value, indentLevel);

            if (hl7Value != null)
            {
                string originalText  = ((ANYMetaData)hl7Value).OriginalText;
                bool   hasNullFlavor = hl7Value.HasNullFlavor();
                bool   hasAnyValues  = HasAnyValues(hl7Value);
                this.pqValidationUtils.ValidateOriginalText(context.Type, originalText, hasAnyValues, hasNullFlavor, context.GetVersion()
                                                            , null, context.GetPropertyPath(), context.GetModelToXmlResult());
                // complete hack for BC
                if (SpecificationVersion.IsExactVersion(context.GetVersion(), SpecificationVersion.V02R04_BC))
                {
                    if (hasNullFlavor && HasAnyValues(hl7Value))
                    {
                        // dump the result and rebuild, adding in NF
                        IDictionary <string, string> attributeNameValuePairs = GetAttributeNameValuePairs(context, (PhysicalQuantity)hl7Value.BareValue
                                                                                                          , hl7Value);
                        attributeNameValuePairs.PutAll(CreateNullFlavorAttributes(hl7Value.NullFlavor));
                        result = CreateElement(context, attributeNameValuePairs, indentLevel, true, true);
                    }
                }
                if (StringUtils.IsNotBlank(originalText))
                {
                    string otElement = CreateElement("originalText", null, indentLevel + 1, false, false);
                    otElement += XmlStringEscape.Escape(originalText);
                    otElement += CreateElementClosure("originalText", 0, true);
                    // pulling off the end "/>" is not the most elegant solution, but superclass would need significant refactoring otherwise
                    result = Ca.Infoway.Messagebuilder.StringUtils.Substring(result, 0, result.IndexOf("/>")) + ">" + SystemUtils.LINE_SEPARATOR
                             + otElement + CreateElementClosure(context.GetElementName(), indentLevel, true);
                }
            }
            return(result);
        }
Exemple #20
0
        private FormatContext ValidateInterval(Interval <T> value, BareANY bareAny, FormatContext context)
        {
            string         type               = context.Type;
            IList <string> errors             = new List <string>();
            string         specializationType = bareAny.DataType == null ? null : bareAny.DataType.Type;
            string         newType            = this.ivlValidationUtils.ValidateSpecializationType(type, specializationType, errors);

            RecordAnyErrors(errors, context);
            if (!StringUtils.Equals(type, newType))
            {
                // replace the context with one using the specialization type
                context = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(newType, true, context);
            }
            bool lowProvided  = RepresentationUtil.HasLow(value.Representation) && (value.Low != null || value.LowNullFlavor != null);
            bool highProvided = RepresentationUtil.HasHigh(value.Representation) && (value.High != null || value.HighNullFlavor != null
                                                                                     );
            bool centerProvided = RepresentationUtil.HasCentre(value.Representation) && (value.Centre != null || value.CentreNullFlavor
                                                                                         != null);
            bool widthProvided = RepresentationUtil.HasWidth(value.Representation) && (value.Width != null && (value.Width.Value != null ||
                                                                                                               value.Width.NullFlavor != null));

            errors = this.ivlValidationUtils.ValidateCorrectElementsProvided(type, context.GetVersion(), lowProvided, highProvided, centerProvided
                                                                             , widthProvided);
            RecordAnyErrors(errors, context);
            errors = this.ivlValidationUtils.DoOtherValidations(type, lowProvided ? value.LowNullFlavor : null, centerProvided ? value
                                                                .CentreNullFlavor : null, highProvided ? value.HighNullFlavor : null, widthProvided ? value.Width.NullFlavor : null, (widthProvided &&
                                                                                                                                                                                      value.Width is DateDiff) ? (DateDiff.ConvertDiff(value.Width)).Unit : null);
            RecordAnyErrors(errors, context);
            return(context);
        }
Exemple #21
0
 private void HandleOriginalText(XmlElement element, CodedTypeR2 <Code> codedType, ParseContext context, XmlToModelResult result
                                 )
 {
     if (OriginalTextAllowed())
     {
         IList <XmlElement> originalTextElements = GetNamedElements("originalText", element);
         if (originalTextElements.Count > 0)
         {
             if (originalTextElements.Count > 1)
             {
                 RecordError("Only one original text element is allowed.", element, context, result);
             }
             ParseContext newContext         = ParseContextImpl.Create("ED", context);
             BareANY      parsedOriginalText = this.edParser.Parse(newContext, originalTextElements[0], result);
             if (parsedOriginalText != null)
             {
                 codedType.OriginalText = (EncapsulatedData)parsedOriginalText.BareValue;
             }
         }
     }
     else
     {
         ValidateUnallowedChildNode(context.Type, element, result, "originalText");
     }
 }
Exemple #22
0
        /// <exception cref="Ca.Infoway.Messagebuilder.Marshalling.HL7.XmlToModelTransformationException"></exception>
        public override BareANY Parse(ParseContext context, XmlNode node, XmlToModelResult xmlToModelResult)
        {
            BareANY result = CreateDataTypeInstance(context != null ? GetType(context) : null);

            // RM20416 - some PQ specifications allow for NF to coexist with other properties
            if (HasValidNullFlavorAttribute(context, node, xmlToModelResult))
            {
                NullFlavor nullFlavor = ParseNullNode(context, node, xmlToModelResult);
                result.NullFlavor = nullFlavor;
            }
            PhysicalQuantity value = ParseNonNullNode(context, node, result, GetReturnType(context), xmlToModelResult);

            if (value != null && (value.Quantity != null || value.Unit != null))
            {
                ((BareANYImpl)result).BareValue = value;
            }
            XmlElement element = (XmlElement)node;
            // validation of OT done a bit later below
            string originalText = GetOriginalText(element);

            if (HasOriginalText(element))
            {
                ((PQ)result).OriginalText = originalText;
            }
            bool hasValues     = HasAnyValues(element);
            bool hasNullFlavor = HasValidNullFlavorAttribute(context, node, xmlToModelResult);

            this.pqValidationUtils.ValidateOriginalText(context.Type, originalText, hasValues, hasNullFlavor, context.GetVersion(), element
                                                        , null, xmlToModelResult);
            return(result);
        }
Exemple #23
0
        private T Wrap(object element)
        {
            BareANY bareAny = (BareANY)ClassUtil.NewInstance(originalElementType);

            ((BareANYImpl)bareAny).BareValue = element;
            return((T)bareAny);
        }
Exemple #24
0
        public virtual void TestIvlTsConstraintsInvalid()
        {
            XmlToModelResult    result      = new XmlToModelResult();
            XmlNode             node        = CreateNode("<ivl><low value=\"20120503\"/><high value=\"20120708\"/></ivl>");
            ConstrainedDatatype constraints = new ConstrainedDatatype("ivl", "IVL<TS>");

            constraints.Relationships.Add(new Relationship("low", "TS", Cardinality.Create("0")));
            constraints.Relationships.Add(new Relationship("high", "TS", Cardinality.Create("0")));
            ParseContext context = ParseContextImpl.Create("IVLTSCDAR1", null, SpecificationVersion.R02_04_03, null, null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel
                                                           .MANDATORY, Cardinality.Create("1"), constraints, true);
            BareANY                 parseResult         = this.parser.Parse(context, Arrays.AsList(node), result);
            PlatformDate            dateLow             = DateUtil.GetDate(2012, 4, 3);
            DateWithPattern         dateWithPatternLow  = new DateWithPattern(dateLow, "yyyyMMdd");
            PlatformDate            dateHigh            = DateUtil.GetDate(2012, 6, 8);
            DateWithPattern         dateWithPatternHigh = new DateWithPattern(dateHigh, "yyyyMMdd");
            Interval <PlatformDate> expectedIvl         = IntervalFactory.CreateLowHigh((PlatformDate)dateWithPatternLow, (PlatformDate)dateWithPatternHigh
                                                                                        );

            Assert.IsFalse(result.IsValid());
            Assert.AreEqual(2, result.GetHl7Errors().Count);
            Assert.IsTrue(parseResult is IVLTSCDAR1);
            DateInterval ivl = (DateInterval)parseResult.BareValue;

            Assert.AreEqual(expectedIvl, ivl.Interval);
        }
Exemple #25
0
        protected override string FormatNonNullDataType(FormatContext context, BareANY dataType, int indentLevel)
        {
            EncapsulatedData encapsulatedData = ExtractBareValue(dataType);

            HandleConstraints(encapsulatedData, context.GetConstraints(), context.GetPropertyPath(), context.GetModelToXmlResult());
            IDictionary <string, string> attributes = CreateAttributes(encapsulatedData, context);
            bool hasContent = HasContent(encapsulatedData);
            bool hasReferenceOrThumbnailOrDocument = HasReferenceOrThumbnailOrDocument(encapsulatedData);

            if (!this.isR2)
            {
                AddSpecializationType(encapsulatedData, attributes, context.Type, dataType.DataType, context.GetVersion());
                Validate(context, dataType, encapsulatedData);
            }
            StringBuilder buffer = new StringBuilder();

            buffer.Append(CreateElement(context, attributes, indentLevel, !hasContent, hasReferenceOrThumbnailOrDocument));
            if (hasContent)
            {
                WriteReference(encapsulatedData, buffer, indentLevel + 1, context);
                WriteThumbnail(encapsulatedData, buffer, indentLevel + 1, context);
                this.edContentRenderer.RenderContent(encapsulatedData, buffer, indentLevel + 1, context, hasReferenceOrThumbnailOrDocument
                                                     );
                buffer.Append(CreateElementClosure(context, hasReferenceOrThumbnailOrDocument ? indentLevel : 0, true));
            }
            return(buffer.ToString());
        }
Exemple #26
0
 protected virtual void PopulateOriginalText(BareANY dataType, ParseContext context, XmlElement element, XmlToModelResult
                                             xmlToModelResult)
 {
     if (HasOriginalText(element))
     {
         ((CD)dataType).OriginalText = GetOriginalText(element);
     }
 }
Exemple #27
0
 private void PopulateNullFlavor(BareANY dataType, ParseContext context, XmlNode node, XmlToModelResult xmlToModelResult)
 {
     if (HasValidNullFlavorAttribute(context, node, xmlToModelResult))
     {
         NullFlavor nullFlavor = ParseNullNode(context, node, xmlToModelResult);
         dataType.NullFlavor = nullFlavor;
     }
 }
Exemple #28
0
        public virtual void TestParseNullNode()
        {
            XmlNode node = CreateNode("<something nullFlavor=\"NI\" />");
            BareANY ii   = this.parser.Parse(this.context, node, this.xmlResult);

            Assert.IsNull(ii.BareValue, "null result");
            Assert.AreEqual(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NO_INFORMATION, ii.NullFlavor, "null flavor");
        }
Exemple #29
0
 private void HandleNullFlavor(XmlElement element, BareANY dataType, ParseContext context, XmlToModelResult result)
 {
     if (HasValidNullFlavorAttribute(context, element, result))
     {
         NullFlavor nullFlavor = ParseNullNode(context, element, result);
         dataType.NullFlavor = nullFlavor;
     }
 }
Exemple #30
0
        public virtual void ShouldAdaptCorrectly()
        {
            IIImpl  ii      = new IIImpl(new Identifier("1", "2"));
            BareANY adapted = this.adapter.Adapt(typeof(LISTImpl <IIImpl, Identifier>), ii);

            Assert.IsTrue(adapted is LISTImpl <IIImpl, Identifier>);
            Assert.IsTrue(((LISTImpl <IIImpl, Identifier>)adapted).Value.Contains(ii));
        }