diff --git a/Base/IO/HL7InputStreamMessageEnumerator.cs b/Base/IO/HL7InputStreamMessageEnumerator.cs index 51089f2..fa6a75e 100644 --- a/Base/IO/HL7InputStreamMessageEnumerator.cs +++ b/Base/IO/HL7InputStreamMessageEnumerator.cs @@ -47,7 +47,11 @@ public IMessage Current { get { - return parser.Parse(enumerator.Current); + string curr = enumerator.Current; + if (string.IsNullOrEmpty(curr)) + return null; + + return parser.Parse(curr); } } diff --git a/Base/NHapiTools.Base.csproj b/Base/NHapiTools.Base.csproj index 7d7d71a..605b45c 100644 --- a/Base/NHapiTools.Base.csproj +++ b/Base/NHapiTools.Base.csproj @@ -77,8 +77,6 @@ - - diff --git a/Base/Parser/EnhancedModelClassFactory.cs b/Base/Parser/EnhancedModelClassFactory.cs index 7aa48f3..c36e819 100644 --- a/Base/Parser/EnhancedModelClassFactory.cs +++ b/Base/Parser/EnhancedModelClassFactory.cs @@ -50,6 +50,14 @@ public override Type GetMessageClass(string theName, string theVersion, bool isE return typeof(NHapiTools.Base.Model.GenericMessageWrapper); } + + public override Type GetSegmentClass(string theName, string theVersion) + { + List l = DefaultModelClassFactory.PackageList("2.3"); + + Type t = base.GetSegmentClass(theName, theVersion); + return t; + } #endregion #region Public properties diff --git a/Base/Parser/HL7Package.cs b/Base/Parser/HL7Package.cs deleted file mode 100644 index b2c1ba7..0000000 --- a/Base/Parser/HL7Package.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; - -namespace NHapiTools.Base.Parser -{ - internal class Hl7Package - { - private string _version; - private string _packageName; - - public string Version - { - get - { - return this._version; - } - set - { - this._version = value; - } - } - - public string PackageName - { - get - { - return this._packageName; - } - } - - public string EventMappingResourceName - { - get - { - return this._packageName + ".EventMapping.EventMap.properties"; - } - } - - public Hl7Package(string packageName, string version) - { - this._version = version; - this._packageName = packageName; - } - } -} diff --git a/Base/Parser/PackageManager.cs b/Base/Parser/PackageManager.cs deleted file mode 100644 index 7a9fae1..0000000 --- a/Base/Parser/PackageManager.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Configuration; -using NHapi.Base; -using NHapi.Base.Model.Configuration; - -namespace NHapiTools.Base.Parser -{ - internal class PackageManager - { - private List _packages = new List(); - private static readonly PackageManager _instance = new PackageManager(); - - public static PackageManager Instance - { - get - { - return PackageManager._instance; - } - } - - static PackageManager() - { - } - - private PackageManager() - { - this.LoadBaseVersions(); - this.LoadAdditionalVersions(); - } - - public IList GetAllPackages() - { - return (IList) this._packages; - } - - private void LoadBaseVersions() - { - string[] strArray = new string[6] - { - "2.2", - "2.3", - "2.3.1", - "2.4", - "2.5", - "2.5.1" - }; - foreach (string str in strArray) - this._packages.Add(new Hl7Package(PackageManager.GetVersionPackageName(str), str)); - } - - private void LoadAdditionalVersions() - { - HL7PackageConfigurationSection configurationSection = ConfigurationManager.GetSection("Hl7PackageCollection") as HL7PackageConfigurationSection; - if (configurationSection == null) - return; - foreach (HL7PackageElement hl7PackageElement in (ConfigurationElementCollection) configurationSection.Packages) - this._packages.Insert(0, new Hl7Package(hl7PackageElement.Name, hl7PackageElement.Version)); - } - - public bool IsValidVersion(string version) - { - version = version.ToUpper().Trim(); - foreach (Hl7Package hl7Package in this._packages) - { - if (hl7Package.Version.ToUpper().Trim().Equals(version)) - return true; - } - return false; - } - - /// - /// Returns the path to the base package for model elements of the given version - /// - e.g. "NHapi.Model.VXXX". - /// This package should have the packages datatype, segment, group, and message - /// under it. The path ends in with a slash. - /// - /// - public static string GetVersionPackagePath(string ver) - { - StringBuilder stringBuilder = new StringBuilder("NHapi.Model.V"); - char[] destinationArray = new char[ver.Length]; - SupportClass.GetCharsFromString(ver, 0, ver.Length, destinationArray, 0); - for (int index = 0; index < destinationArray.Length; ++index) - { - if ((int) destinationArray[index] != 46) - stringBuilder.Append(destinationArray[index]); - } - stringBuilder.Append("/"); - return ((object) stringBuilder).ToString(); - } - - /// - /// Returns the package name for model elements of the given version - e.g. - /// "NHapi.Base.Model.v24.". This method - /// is identical to - /// - /// getVersionPackagePath(...) - /// - /// except that path - /// separators are replaced with dots. - /// - /// - public static string GetVersionPackageName(string ver) - { - return PackageManager.GetVersionPackagePath(ver).Replace('/', '.').Replace('\\', '.'); - } - } -} \ No newline at end of file diff --git a/Base/Properties/AssemblyInfo.cs b/Base/Properties/AssemblyInfo.cs index 25df105..3294962 100644 --- a/Base/Properties/AssemblyInfo.cs +++ b/Base/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NHapiTools.Base")] -[assembly: AssemblyCopyright("Copyright Division by Zero © 2013 - 2014 - 2014")] +[assembly: AssemblyCopyright("Copyright Division by Zero © 2013 - 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.0.0")] -[assembly: AssemblyFileVersion("1.5.0.0")] +[assembly: AssemblyVersion("1.6.0.0")] +[assembly: AssemblyFileVersion("1.6.0.0")] diff --git a/BuildResult/NHapiTools.Model.V21.dll b/BuildResult/NHapiTools.Model.V21.dll index 5b039e4..3cf0fcd 100644 Binary files a/BuildResult/NHapiTools.Model.V21.dll and b/BuildResult/NHapiTools.Model.V21.dll differ diff --git a/BuildResult/NHapiTools.Model.V22.dll b/BuildResult/NHapiTools.Model.V22.dll index 085bb9a..6e256c0 100644 Binary files a/BuildResult/NHapiTools.Model.V22.dll and b/BuildResult/NHapiTools.Model.V22.dll differ diff --git a/BuildResult/NHapiTools.Model.V251.dll b/BuildResult/NHapiTools.Model.V251.dll index 20e7e2c..23807a2 100644 Binary files a/BuildResult/NHapiTools.Model.V251.dll and b/BuildResult/NHapiTools.Model.V251.dll differ diff --git a/BuildResult/Release notes.txt b/BuildResult/Release notes.txt index 4074e60..68a155c 100644 --- a/BuildResult/Release notes.txt +++ b/BuildResult/Release notes.txt @@ -12,8 +12,11 @@ curve and not everything works as easy as it should. NHapiTools aims to improve - Two sets of context implementation to easily add all or configurable validation rules. 3. Changelog +- V1.6 Release (April 2015) + Updated to work with NuGet. Updated to the latest version of NHapi and fixed some bugs. + - V1.5 Release (April 2015) - Fixzed bug in ERR segment. Added custom ACK message classes for HL7 V2.2 and V2.1 since these seem to be missing from NHapi. + Fixed bug in ERR segment. Added custom ACK message classes for HL7 V2.2 and V2.1 since these seem to be missing from NHapi. - V1.4 Release (December 2014) Added more HL7 versions. Finished documentation. diff --git a/Model.V21/Properties/AssemblyInfo.cs b/Model.V21/Properties/AssemblyInfo.cs index 4f48c68..1f5822a 100644 --- a/Model.V21/Properties/AssemblyInfo.cs +++ b/Model.V21/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NHapiTools.Model.V23")] -[assembly: AssemblyCopyright("Copyright Division by Zero © 2013 - 2014")] +[assembly: AssemblyCopyright("Copyright Division by Zero © 2013 - 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.0.0")] -[assembly: AssemblyFileVersion("1.5.0.0")] +[assembly: AssemblyVersion("1.6.0.0")] +[assembly: AssemblyFileVersion("1.6.0.0")] diff --git a/Model.V22/Properties/AssemblyInfo.cs b/Model.V22/Properties/AssemblyInfo.cs index 4f48c68..1f5822a 100644 --- a/Model.V22/Properties/AssemblyInfo.cs +++ b/Model.V22/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NHapiTools.Model.V23")] -[assembly: AssemblyCopyright("Copyright Division by Zero © 2013 - 2014")] +[assembly: AssemblyCopyright("Copyright Division by Zero © 2013 - 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.0.0")] -[assembly: AssemblyFileVersion("1.5.0.0")] +[assembly: AssemblyVersion("1.6.0.0")] +[assembly: AssemblyFileVersion("1.6.0.0")] diff --git a/Model.V23/Properties/AssemblyInfo.cs b/Model.V23/Properties/AssemblyInfo.cs index 4f48c68..1f5822a 100644 --- a/Model.V23/Properties/AssemblyInfo.cs +++ b/Model.V23/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NHapiTools.Model.V23")] -[assembly: AssemblyCopyright("Copyright Division by Zero © 2013 - 2014")] +[assembly: AssemblyCopyright("Copyright Division by Zero © 2013 - 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.0.0")] -[assembly: AssemblyFileVersion("1.5.0.0")] +[assembly: AssemblyVersion("1.6.0.0")] +[assembly: AssemblyFileVersion("1.6.0.0")] diff --git a/Model.V231/Properties/AssemblyInfo.cs b/Model.V231/Properties/AssemblyInfo.cs index f52f3a9..7e17a8f 100644 --- a/Model.V231/Properties/AssemblyInfo.cs +++ b/Model.V231/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.0.0")] -[assembly: AssemblyFileVersion("1.5.0.0")] +[assembly: AssemblyVersion("1.6.0.0")] +[assembly: AssemblyFileVersion("1.6.0.0")] diff --git a/Model.V24/Properties/AssemblyInfo.cs b/Model.V24/Properties/AssemblyInfo.cs index 7329b09..51d3182 100644 --- a/Model.V24/Properties/AssemblyInfo.cs +++ b/Model.V24/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NHapiTools.Model.V24")] -[assembly: AssemblyCopyright("Copyright Division by Zero © 2013 - 2014")] +[assembly: AssemblyCopyright("Copyright Division by Zero © 2013 - 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.0.0")] -[assembly: AssemblyFileVersion("1.5.0.0")] +[assembly: AssemblyVersion("1.6.0.0")] +[assembly: AssemblyFileVersion("1.6.0.0")] diff --git a/Model.V25/Properties/AssemblyInfo.cs b/Model.V25/Properties/AssemblyInfo.cs index 5ceccc9..c2c2772 100644 --- a/Model.V25/Properties/AssemblyInfo.cs +++ b/Model.V25/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.0.0")] -[assembly: AssemblyFileVersion("1.5.0.0")] +[assembly: AssemblyVersion("1.6.0.0")] +[assembly: AssemblyFileVersion("1.6.0.0")] diff --git a/Model.V251/Properties/AssemblyInfo.cs b/Model.V251/Properties/AssemblyInfo.cs index f52f3a9..7e17a8f 100644 --- a/Model.V251/Properties/AssemblyInfo.cs +++ b/Model.V251/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.0.0")] -[assembly: AssemblyFileVersion("1.5.0.0")] +[assembly: AssemblyVersion("1.6.0.0")] +[assembly: AssemblyFileVersion("1.6.0.0")] diff --git a/NuGet/NHapiTools.nuspec b/NuGet/NHapiTools.nuspec index d238730..d548a57 100644 --- a/NuGet/NHapiTools.nuspec +++ b/NuGet/NHapiTools.nuspec @@ -2,7 +2,7 @@ NHapiTools - 1.5.0.0 + 1.6.0.0 Division by Zero Division by Zero https://github.com/dib0/NHapiTools/blob/master/LICENSE diff --git a/TestApp.CustomImplementation.V23/Properties/AssemblyInfo.cs b/TestApp.CustomImplementation.V23/Properties/AssemblyInfo.cs index 00589de..14c07b8 100644 --- a/TestApp.CustomImplementation.V23/Properties/AssemblyInfo.cs +++ b/TestApp.CustomImplementation.V23/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.0.0")] -[assembly: AssemblyFileVersion("1.5.0.0")] +[assembly: AssemblyVersion("1.6.0.0")] +[assembly: AssemblyFileVersion("1.6.0.0")] diff --git a/TestApp/App.config b/TestApp/App.config index 72f7a66..e28c10b 100644 --- a/TestApp/App.config +++ b/TestApp/App.config @@ -2,19 +2,21 @@ -
+
-
+
-
+
- - - + + + + + diff --git a/TestApp/Program.cs b/TestApp/Program.cs index 4010dde..a486e14 100644 --- a/TestApp/Program.cs +++ b/TestApp/Program.cs @@ -234,8 +234,8 @@ private static void TestGenericMessageWrapper() EnhancedModelClassFactory emch = new EnhancedModelClassFactory(); PipeParser parser = new PipeParser(emch); emch.ValidationContext = parser.ValidationContext; + IMessage im=parser.Parse(txtMessage); - IMessage im = parser.Parse(txtMessage); GenericMessageWrapper gcw = im as GenericMessageWrapper; if (gcw != null) { diff --git a/TestApp/Properties/AssemblyInfo.cs b/TestApp/Properties/AssemblyInfo.cs index 74e3de9..cf03bf3 100644 --- a/TestApp/Properties/AssemblyInfo.cs +++ b/TestApp/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TestApp")] -[assembly: AssemblyCopyright("Copyright Division by Zero © 2013 - 2014")] +[assembly: AssemblyCopyright("Copyright Division by Zero © 2013 - 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.5.0.0")] -[assembly: AssemblyFileVersion("1.5.0.0")] +[assembly: AssemblyVersion("1.6.0.0")] +[assembly: AssemblyFileVersion("1.6.0.0")] diff --git a/TestApp/TestApp.csproj b/TestApp/TestApp.csproj index be7068b..0905b66 100644 --- a/TestApp/TestApp.csproj +++ b/TestApp/TestApp.csproj @@ -66,6 +66,7 @@ True + diff --git a/TestApp/TestMessages/ADT_A08.txt b/TestApp/TestMessages/ADT_A08.txt index adb6959..7d65fea 100644 --- a/TestApp/TestMessages/ADT_A08.txt +++ b/TestApp/TestMessages/ADT_A08.txt @@ -1,9 +1,9 @@ -MSH|^~\&|AnotherSoftwareSystem|EmpireMedicalAssociates|pMDsoft|123456|20080717120312||ADT^A08|12320080717120312|P|2.3|||NE|NE +MSH|^~\&|AnotherSoftwareSystem|EmpireMedicalAssociates|pMDsoft|123456|20080717120312||ADT^A08^ADT_A08|12320080717120312|P|2.3|||NE|NE EVN|A08|20080717120312 PID|1|987654||A123456|Smith^John^Q||19600411000000|M|||123 Main St.^^New York^NY^11101~456 Main St.^^Dallas^TX^11102||(123)456-7890^^^^^123^4567890|(321)654-0987X3000^^^^^321^6540987^3000|||||888776666 PV1|1|R|^^^00123||||97^Jones^Mary^Q^MD|12^Baker^Joseph^Q^DO||||||||||||||||||||||||||||||||||||20080715|20080717 -MSH|^~\&|COL|ABC|FWS|ABC|201310250715||ADT^A08|000710428|P|2.3|||||NE||NE +MSH|^~\&|COL|ABC|FWS|ABC|201310250715||ADT^A08^ADT_A08|000710428|P|2.3|||||NE||NE EVN||201310250715||O|911123^TEST^T.E.S.T.|201306171001 PID||0110051528|1234567^^^^PI||&&test23^i^i^^^^D||19800314|F|||Teststreet 5^^A City^^1|| ROL|||PP^Doktor^HL11111|1111^Test,^^^^^^^aaaa|||||||Teststreet 5^^A City^^1|01234567890^WPN^PH