private bool AdaptValue(string dataType) { Hl7DataTypeName type = Hl7DataTypeName.Create(dataType); string typeName = StringUtils.DeleteWhitespace(type.GetUnqualifiedVersion().ToString()); return("LIST<SXCM<TS>>".Equals(typeName)); }
protected override string FormatDenominator(FormatContext context, PhysicalQuantity denominator, int indentLevel) { string denominatorType = Hl7DataTypeName.Create(context.Type).GetInnerTypes()[1].ToString(); FormatContext newContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(denominatorType, context .IsSpecializationType(), Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, Cardinality.Create("1"), "denominator" , context); return(this.pqFormatter.Format(newContext, new PQImpl(denominator), indentLevel)); }
//http://www.hl7.org/v3ballot/html/infrastructure/itsxml/datatypes-its-xml.htm#dtimpl-RTO protected override string FormatNumerator(FormatContext context, Money numerator, int indentLevel) { string numeratorType = Hl7DataTypeName.Create(context.Type).GetInnerTypes()[0].ToString(); FormatContext newContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(numeratorType, context .IsSpecializationType(), Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, Cardinality.Create("1"), "numerator", context); return(this.moFormatter.Format(newContext, new MOImpl(numerator), indentLevel)); }
private CollectionHelper CreateCollectionHelper(string dataType, Type expectedReturnType) { Hl7DataTypeName type = Hl7DataTypeName.Create(dataType); string typeName = StringUtils.DeleteWhitespace(type.GetUnqualifiedVersion().ToString()); CollectionHelper result = typeName.StartsWith("LIST") ? HandleListTypes(typeName, expectedReturnType) : HandleBagTypes(typeName ); if (result == null) { throw new MarshallingException("Cannot create a data type construct for data type " + dataType); } return(result); }
private CollectionHelper CreateCollectionHelper(string dataType) { Hl7DataTypeName type = Hl7DataTypeName.Create(dataType); string typeName = StringUtils.DeleteWhitespace(type.GetUnqualifiedVersion().ToString()); if ("BAG<AD>".Equals(typeName)) { return(new LISTImpl <AD, PostalAddress>(typeof(ADImpl))); } else { if ("BAG<GTS>".Equals(typeName)) { return(new LISTImpl <GTS, GeneralTimingSpecification>(typeof(GTSImpl))); } else { if ("BAG<II>".Equals(typeName)) { return(new LISTImpl <II, Identifier>(typeof(IIImpl))); } else { if ("BAG<PN>".Equals(typeName)) { return(new LISTImpl <PN, PersonName>(typeof(PNImpl))); } else { if ("BAG<ST>".Equals(typeName)) { return(new LISTImpl <ST, string>(typeof(STImpl))); } else { if ("BAG<TEL>".Equals(typeName)) { return(new LISTImpl <TEL, TelecommunicationAddress>(typeof(TELImpl))); } else { throw new MarshallingException("Cannot create a data type construct for data type " + dataType); } } } } } } }
protected override Ratio <N, D> ParseNonNullNode(ParseContext context, XmlNode node, BareANY parseResult, Type expectedReturnType , XmlToModelResult xmlToModelResult) { Ratio <N, D> result = new Ratio <N, D>(); IList <Hl7DataTypeName> innerTypes = Hl7DataTypeName.Create(context.Type).GetInnerTypes(); if (innerTypes.Count != 2) { // this should never happen unless a message set is incorrect; ok to abort with exception (parsing will continue after this datatype) throw new XmlToModelTransformationException("RTO data type must have two inner types. Type " + context.Type + " has " + innerTypes .Count + "."); } bool numeratorFound = false; bool denominatorFound = false; XmlNodeList childNodes = node.ChildNodes; foreach (XmlNode childNode in new XmlNodeListIterable(childNodes)) { if (childNode is XmlElement) { XmlElement element = (XmlElement)childNode; string name = NodeUtil.GetLocalOrTagName(element); if ("numerator".Equals(name)) { numeratorFound = true; result.Numerator = GetNumeratorValue(element, innerTypes[0].ToString(), context, xmlToModelResult); } else { if ("denominator".Equals(name)) { denominatorFound = true; result.Denominator = GetDenominatorValue(element, innerTypes[1].ToString(), context, xmlToModelResult); } } } } if (!numeratorFound) { RecordMissingElementError("Numerator", context, node, xmlToModelResult); } if (!denominatorFound) { RecordMissingElementError("Denominator", context, node, xmlToModelResult); } return(result); }
private CollectionHelper CreateCollectionHelper(string dataType) { Hl7DataTypeName type = Hl7DataTypeName.Create(dataType); string typeName = StringUtils.DeleteWhitespace(type.GetUnqualifiedVersion().ToString()); if ("SET<CV>".Equals(typeName)) { return(new SETImpl <CV, Code>(typeof(CVImpl))); } else { if ("SET<II>".Equals(typeName)) { return(new SETImpl <II, Identifier>(typeof(IIImpl))); } else { if ("SET<PIVL>".Equals(typeName)) { return(new SETImpl <PIVL, PeriodicIntervalTime>(typeof(PIVLImpl))); } else { if ("SET<PN>".Equals(typeName)) { return(new SETImpl <PN, PersonName>(typeof(PNImpl))); } else { if ("SET<RTO<PQ,PQ>>".Equals(typeName)) { return(new SETImpl <RTO <PhysicalQuantity, PhysicalQuantity>, Ratio <PhysicalQuantity, PhysicalQuantity> >(typeof(RTOImpl <object , object>))); } else { if ("SET<ST>".Equals(typeName)) { return(new SETImpl <ST, string>(typeof(STImpl))); } else { if ("SET<TEL>".Equals(typeName)) { return(new SETImpl <TEL, TelecommunicationAddress>(typeof(TELImpl))); } else { if ("SET<TS>".Equals(typeName)) { return(new SETImpl <TS, PlatformDate>(typeof(TSImpl))); } else { if ("SET<CD>".Equals(typeName)) { return(new SETImpl <CD, Code>(typeof(CDImpl))); } else { if ("SET<CS>".Equals(typeName)) { return(new SETImpl <CS, Code>(typeof(CSImpl))); } else { if ("SET<AD>".Equals(typeName)) { return(new SETImpl <AD, PostalAddress>(typeof(ADImpl))); } else { if ("SET<TN>".Equals(typeName)) { return(new SETImpl <TN, TrivialName>(typeof(TNImpl))); } else { throw new MarshallingException("Cannot create a data type construct for data type " + dataType); } } } } } } } } } } } } }
private CollectionHelper CreateCollectionHelper(string dataType) { Hl7DataTypeName type = Hl7DataTypeName.Create(dataType); string typeName = StringUtils.DeleteWhitespace(type.GetUnqualifiedVersion().ToString()); if ("LIST<AD>".Equals(typeName)) { return(new LISTImpl <AD, PostalAddress>(typeof(ADImpl))); } else { if ("LIST<GTS>".Equals(typeName)) { return(new LISTImpl <GTS, GeneralTimingSpecification>(typeof(GTSImpl))); } else { if ("LIST<II>".Equals(typeName)) { return(new LISTImpl <II, Identifier>(typeof(IIImpl))); } else { if ("LIST<PN>".Equals(typeName)) { return(new LISTImpl <PN, PersonName>(typeof(PNImpl))); } else { if ("LIST<TEL>".Equals(typeName)) { return(new LISTImpl <TEL, TelecommunicationAddress>(typeof(TELImpl))); } else { if ("LIST<ON>".Equals(typeName)) { return(new LISTImpl <ON, OrganizationName>(typeof(ONImpl))); } else { if ("LIST<CD>".Equals(typeName)) { return(new LISTImpl <CD, Code>(typeof(CDImpl))); } else { if ("LIST<CS>".Equals(typeName)) { return(new LISTImpl <CS, Code>(typeof(CSImpl))); } else { if ("LIST<CE>".Equals(typeName)) { return(new LISTImpl <CE, Code>(typeof(CEImpl))); } else { if ("LIST<SXCM<TS>>".Equals(typeName)) { return(new LISTImpl <SXCM <TS>, SetComponent <TS> >(typeof(TSImpl))); } else { if ("LIST<ANY>".Equals(typeName)) { return(new LISTImpl <ANY <object>, object>(typeof(ANYImpl <object>))); } else { if ("LIST<INT>".Equals(typeName)) { return(new LISTImpl <INT, Int32?>(typeof(INTImpl))); } else { if ("LIST<PQ>".Equals(typeName)) { return(new LISTImpl <PQ, PhysicalQuantity>(typeof(PQImpl))); } else { if ("LIST<ST>".Equals(typeName)) { return(new LISTImpl <ST, string>(typeof(STImpl))); } else { if ("LIST<SXCMTSCDAR1>".Equals(typeName)) { return(new LISTImpl <SXCMTSCDAR1, MbDate>(typeof(SXCMTSCDAR1Impl))); } else { throw new MarshallingException("Cannot create a data type construct for data type " + dataType); } } } } } } } } } } } } } } } }