本文整理汇总了C#中Genetibase.NuGenHL7.model.Message类的典型用法代码示例。如果您正苦于以下问题:C# Genetibase.NuGenHL7.model.Message类的具体用法?C# Genetibase.NuGenHL7.model.Message怎么用?C# Genetibase.NuGenHL7.model.Message使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Genetibase.NuGenHL7.model.Message类属于命名空间,在下文中一共展示了Genetibase.NuGenHL7.model.Message类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NuGenMessagePointer
/// <summary> Creates new GroupPointer </summary>
public NuGenMessagePointer(NuGenPipeParser parser, Message message, NuGenEncodingCharacters encodingChars)
{
this.parser = parser;
this.message = message;
this.encodingChars = encodingChars;
makeChildren();
}
示例2: validate
/// <param name="message">a parsed message to validate (note that MSH-9-1 and MSH-9-2 must be valued)
/// </param>
/// <returns> true if the message is OK
/// </returns>
/// <throws> HL7Exception if there is at least one error and this validator is set to fail on errors </throws>
public virtual bool validate(Message message)
{
Terser t = new Terser(message);
NuGenMessageRule[] rules = myContext.getMessageRules(message.Version, t.get_Renamed("MSH-9-1"), t.get_Renamed("MSH-9-2"));
NuGenValidationException toThrow = null;
bool result = true;
for (int i = 0; i < rules.Length; i++)
{
NuGenValidationException[] ex = rules[i].test(message);
for (int j = 0; j < ex.Length; j++)
{
result = false;
if (failOnError && toThrow == null)
{
toThrow = ex[j];
}
}
}
if (toThrow != null)
{
throw new NuGenHL7Exception("Invalid message", toThrow);
}
return result;
}
示例3: fillDetails
/// <summary> Fills in the details of an Application Reject message, including response and
/// error codes, and a text error message. This is the method to override if you want
/// to respond differently.
/// </summary>
public virtual void fillDetails(Message ack)
{
try
{
//populate MSA and ERR with generic error ...
Segment msa = (Segment) ack.get_Renamed("MSA");
Terser.set_Renamed(msa, 1, 0, 1, 1, "AR");
Terser.set_Renamed(msa, 3, 0, 1, 1, "No appropriate destination could be found to which this message could be routed.");
//this is max length
//populate ERR segment if it exists (may not depending on version)
Structure s = ack.get_Renamed("ERR");
if (s != null)
{
Segment err = (Segment) s;
Terser.set_Renamed(err, 1, 0, 4, 1, "207");
Terser.set_Renamed(err, 1, 0, 4, 2, "Application Internal Error");
Terser.set_Renamed(err, 1, 0, 4, 3, "HL70357");
}
}
catch (System.Exception e)
{
throw new NuGenApplicationException("Error trying to create Application Reject message: " + e.Message);
}
}
示例4: getFields
/// <param name="theMessage">a message from which to extract fields
/// </param>
/// <param name="theTerserPaths">a list of paths to desired fields, in the
/// form required by <code>Terser</code>.
/// </param>
/// <returns> a Map from Terser paths to field values
/// </returns>
public static System.Collections.IDictionary getFields(Message theMessage, System.Collections.IList theTerserPaths)
{
System.Collections.IDictionary fields = new System.Collections.Hashtable();
Terser terser = new Terser(theMessage);
for (int i = 0; i < theTerserPaths.Count; i++)
{
System.String path = (System.String) theTerserPaths[i];
System.String fieldValue = terser.get_Renamed(path);
fields[path] = fieldValue;
}
return fields;
}
示例5: processMessage
/// <summary> Forwards the given message to any Applications that have been registered to
/// accept messages of that type and trigger event.
/// </summary>
/// <throws> ApplicationException if no such Applications are registered, or if </throws>
/// <summary> the underlying Application throws this exception during processing.
/// </summary>
public virtual Message processMessage(Message in_Renamed)
{
Message out_Renamed;
try
{
NuGenApplication matchingApp = this.getMatchingApplication(in_Renamed);
out_Renamed = matchingApp.processMessage(in_Renamed);
}
catch (NuGenHL7Exception e)
{
throw new NuGenApplicationException("Error internally routing message: " + e.ToString(), e);
}
return out_Renamed;
}
示例6: canProcess
/// <summary> Returns true if at least one application has been registered to accept this
/// type of message. Applications are registered using <code>registerApplication(...)</code>.
/// </summary>
public virtual bool canProcess(Message in_Renamed)
{
bool can = false;
try
{
NuGenApplication matches = this.getMatchingApplication(in_Renamed);
if (matches != null)
can = true;
}
catch (NuGenHL7Exception)
{
can = false;
}
return can;
}
示例7: processMessage
/// <seealso cref="Genetibase.NuGenHL7.protocol.ReceivingApplication.processMessage(Genetibase.NuGenHL7.model.Message, java.util.Map)">
/// </seealso>
public virtual Message processMessage(Message theMessage, System.Collections.IDictionary theMetadata)
{
Message result = null;
try
{
result = myApplication.processMessage(theMessage);
}
catch (ApplicationException e)
{
throw new NuGenReceivingApplicationException(e);
}
return result;
}
示例8: processMessage
/// <summary> Creates and returns an acknowledgement -- the details are determined by fillDetails().</summary>
public virtual Message processMessage(Message in_Renamed)
{
Message out_Renamed = null;
try
{
//get default ACK
out_Renamed = makeACK((Segment) in_Renamed.get_Renamed("MSH"));
fillDetails(out_Renamed);
}
catch (System.Exception e)
{
throw new NuGenApplicationException("Couldn't create response message: " + e.Message);
}
return out_Renamed;
}
示例9: checkParse
/// <summary> Encodes the given message and compares it to the given string. Any differences
/// are noted in the file [hapi.home]/parse_check.txt. Ignores extra field delimiters.
/// </summary>
public static void checkParse(System.String originalMessageText, Message parsedMessage, Parser parser)
{
System.String newMessageText = parser.encode(parsedMessage);
if (!originalMessageText.Equals(newMessageText))
{
//check each segment
SupportClass.Tokenizer tok = new SupportClass.Tokenizer(originalMessageText, "\r");
System.Collections.ArrayList one = new System.Collections.ArrayList();
while (tok.HasMoreTokens())
{
System.String seg = tok.NextToken();
if (seg.Length > 4)
one.Add(seg);
}
tok = new SupportClass.Tokenizer(newMessageText, "\r");
System.Collections.ArrayList two = new System.Collections.ArrayList();
while (tok.HasMoreTokens())
{
System.String seg = tok.NextToken();
if (seg.Length > 4)
two.Add(stripExtraDelimiters(seg, seg[3]));
}
if (one.Count != two.Count)
{
}
else
{
//check each segment
for (int i = 0; i < one.Count; i++)
{
System.String origSeg = (System.String) one[i];
System.String newSeg = (System.String) two[i];
if (!origSeg.Equals(newSeg))
{
}
}
}
}
else
{
}
}
示例10: encodeDocument
/// <summary> <p>Creates an XML Document that corresponds to the given Message object. </p>
/// <p>If you are implementing this method, you should create an XML Document, and insert XML Elements
/// into it that correspond to the groups and segments that belong to the message type that your subclass
/// of XMLParser supports. Then, for each segment in the message, call the method
/// <code>encode(Segment segmentObject, Element segmentElement)</code> using the Element for
/// that segment and the corresponding Segment object from the given Message.</p>
/// </summary>
public override System.Xml.XmlDocument encodeDocument(Message source)
{
System.String messageClassName = source.GetType().FullName;
System.String messageName = messageClassName.Substring(messageClassName.LastIndexOf('.') + 1);
System.Xml.XmlDocument doc = null;
try
{
doc = new System.Xml.XmlDocument();
System.Xml.XmlElement root = doc.CreateElement(messageName);
doc.AppendChild(root);
}
catch (System.Exception e)
{
throw new NuGenHL7Exception("Can't create XML document - " + e.GetType().FullName, NuGenHL7Exception.APPLICATION_INTERNAL_ERROR, e);
}
encode(source, (System.Xml.XmlElement) doc.DocumentElement);
return doc;
}
示例11: AD
/// <summary> Creates a AD.</summary>
/// <param name="message">the Message to which this Type belongs
/// </param>
public AD(Message message):base(message)
{
data = new Type[8];
data[0] = new ST(message);
data[1] = new ST(message);
data[2] = new ST(message);
data[3] = new ST(message);
data[4] = new ST(message);
data[5] = new ID(message, 399);
data[6] = new ID(message, 190);
data[7] = new ST(message);
}
示例12: DR
/// <summary> Creates a DR.</summary>
/// <param name="message">the Message to which this Type belongs
/// </param>
public DR(Message message):base(message)
{
data = new Type[2];
data[0] = new TS(message);
data[1] = new TS(message);
}
示例13: WVS
/// <summary> Creates a WVS.</summary>
/// <param name="message">the Message to which this Type belongs
/// </param>
public WVS(Message message):base(message)
{
data = new Type[2];
data[0] = new ST(message);
data[1] = new ST(message);
}
示例14: TM
/// <param name="theMessage">message to which this Type belongs
/// </param>
public TM(Message theMessage):base(theMessage)
{
}
示例15: TSComponentOne
/// <param name="theMessage">message to which this Type belongs
/// </param>
public TSComponentOne(Message theMessage):base(theMessage)
{
}