private System.String versionString; // The HAPI version
		
		/// <summary>This constructor will create a new ConformanceSegmentBuilder</summary>
		/// <param name="packageName">the name of the package
		/// </param>
		/// <param name="versionString">the version of HL7 which these classes are conforming to
		/// </param>
		/// <param name="depManager">the instance of DeploymentManager
		/// </param>
		public ConformanceSegmentBuilder(System.String packageName, System.String versionString, DeploymentManager depManager):base()
		{
			this.packageName = packageName;
			this.versionString = versionString;
			this.docBuilder = DocumentationBuilder.getDocumentationBuilder();
			this.depManager = depManager;
		}
        private System.String versionString;       // The HAPI version

        /// <summary>This constructor will create a new ConformanceSegmentBuilder</summary>
        /// <param name="packageName">the name of the package
        /// </param>
        /// <param name="versionString">the version of HL7 which these classes are conforming to
        /// </param>
        /// <param name="depManager">the instance of DeploymentManager
        /// </param>
        public ConformanceSegmentBuilder(System.String packageName, System.String versionString, DeploymentManager depManager) : base()
        {
            this.packageName   = packageName;
            this.versionString = versionString;
            this.docBuilder    = DocumentationBuilder.getDocumentationBuilder();
            this.depManager    = depManager;
        }
Example #3
0
 /// <summary>this method generates conformance</summary>
 /// <param name="dm">the DeploymentManager
 /// </param>
 /// <param name="cp">the CommandParser which parses the command line argument of ConfGen
 /// </param>
 public virtual void  generateConf(DeploymentManager dm, CommandParser cp)
 {
     try
     {
         System.IO.FileInfo     f          = new System.IO.FileInfo(cp.Source);
         System.IO.StreamReader in_Renamed = new System.IO.StreamReader(new System.IO.StreamReader(f.FullName, System.Text.Encoding.Default).BaseStream, new System.IO.StreamReader(f.FullName, System.Text.Encoding.Default).CurrentEncoding);
         char[] cbuf = new char[(int)SupportClass.FileLength(f)];
         in_Renamed.Read(cbuf, 0, (int)SupportClass.FileLength(f));
         dm.generate(System.Convert.ToString(cbuf));
     }
     catch (System.IO.FileNotFoundException e)
     {
         System.Console.Out.WriteLine("Filenotfoundexception: " + e.ToString());
     }
     catch (System.IO.IOException e)
     {
         System.Console.Out.WriteLine("IOexception:\n" + e.ToString() + "\n");
     }
     catch (ConformanceError e)
     {
         System.Console.Out.WriteLine("ConformanceError:\n" + e.ToString() + "\n");
     }
     catch (ConformanceException e)
     {
         System.Console.Out.WriteLine("ConformanceException:\n" + e.ToString() + "\n");
     }
 }
 /// <summary>This constructor will create a new ConformanceComponentBuilder</summary>
 /// <param name="packageName">the name of the package
 /// </param>
 /// <param name="versionString">the version of HL7 which these classes are conforming to
 /// </param>
 /// <param name="depManager">the instance of DeploymentManager
 /// </param>
 public ConformanceComponentBuilder(System.String packageName, DeploymentManager depManager, System.String versionString)
 {
     this.packageName   = packageName;
     this.docBuilder    = DocumentationBuilder.getDocumentationBuilder();
     this.depManager    = depManager;
     this.versionString = versionString;
 }
		private System.String version; // The HAPI version
		
		/// <summary>This constructor will create a new ConformanceSegmentBuilder</summary>
		/// <param name="packageName">the name of the package
		/// </param>
		/// <param name="versionString">the version of HL7 which these classes are conforming to
		/// </param>
		/// <param name="depManager">the instance of DeploymentManager
		/// </param>
		public ConformanceSegGroupBuilder(System.String packageName, System.String version, DeploymentManager depManager, System.String structID):base()
		{
			this.packageName = packageName;
			this.version = version;
			this.docBuilder = DocumentationBuilder.getDocumentationBuilder();
			this.depManager = depManager;
			this.structID = structID;
		}
Example #6
0
        private System.String version;           // The HAPI version

        /// <summary>This constructor will create a new ConformanceSegmentBuilder</summary>
        /// <param name="packageName">the name of the package
        /// </param>
        /// <param name="versionString">the version of HL7 which these classes are conforming to
        /// </param>
        /// <param name="depManager">the instance of DeploymentManager
        /// </param>
        public ConformanceSegGroupBuilder(System.String packageName, System.String version, DeploymentManager depManager, System.String structID) : base()
        {
            this.packageName = packageName;
            this.version     = version;
            this.docBuilder  = DocumentationBuilder.getDocumentationBuilder();
            this.depManager  = depManager;
            this.structID    = structID;
        }
Example #7
0
        public static void  Main(System.String[] args)
        {
            ConfGen       gc = new ConfGen();
            CommandParser cp = new CommandParser();

            cp.parse(args);

            if (cp.HelpFlag)
            {
                System.Console.Out.WriteLine("Usage: ConfGen [-vht] SOURCE DESTINATION PACKAGENAME");
                return;
            }

            if (cp.ErrFlag)
            {
                System.Console.Out.WriteLine("ConfGen: command line parse error");
                System.Console.Out.WriteLine("ConfGen: " + cp.Error);
                return;
            }

            DeploymentManager dm = new DeploymentManager(cp.Dest, cp.Package);

            if (cp.TestFlag)
            {
                System.Console.Out.WriteLine("ConfGen: system test enabled");
                gc.test();
                return;
            }
            if (cp.VerbFlag)
            {
                System.Console.Out.WriteLine("ConfGen: verbose display enabled");
                dm.Verbose = true;
            }

            System.Console.Out.WriteLine("Generating Source...");
            gc.generateConf(dm, cp);
            System.Console.Out.WriteLine("Done.");
        }
Example #8
0
		public static void  Main(System.String[] args)
		{
			ConfGen gc = new ConfGen();
			CommandParser cp = new CommandParser();
			
			cp.parse(args);
			
			if (cp.HelpFlag)
			{
				System.Console.Out.WriteLine("Usage: ConfGen [-vht] SOURCE DESTINATION PACKAGENAME");
				return ;
			}
			
			if (cp.ErrFlag)
			{
				System.Console.Out.WriteLine("ConfGen: command line parse error");
				System.Console.Out.WriteLine("ConfGen: " + cp.Error);
				return ;
			}
			
			DeploymentManager dm = new DeploymentManager(cp.Dest, cp.Package);
			if (cp.TestFlag)
			{
				System.Console.Out.WriteLine("ConfGen: system test enabled");
				gc.test();
				return ;
			}
			if (cp.VerbFlag)
			{
				System.Console.Out.WriteLine("ConfGen: verbose display enabled");
				dm.Verbose = true;
			}
			
			System.Console.Out.WriteLine("Generating Source...");
			gc.generateConf(dm, cp);
			System.Console.Out.WriteLine("Done.");
		}
Example #9
0
		/// <summary>this method generates conformance</summary>
		/// <param name="dm">the DeploymentManager
		/// </param>
		/// <param name="cp">the CommandParser which parses the command line argument of ConfGen 
		/// </param>
		public virtual void  generateConf(DeploymentManager dm, CommandParser cp)
		{
			try
			{
				System.IO.FileInfo f = new System.IO.FileInfo(cp.Source);
				System.IO.StreamReader in_Renamed = new System.IO.StreamReader(new System.IO.StreamReader(f.FullName, System.Text.Encoding.Default).BaseStream, new System.IO.StreamReader(f.FullName, System.Text.Encoding.Default).CurrentEncoding);
				char[] cbuf = new char[(int) SupportClass.FileLength(f)];
				in_Renamed.Read(cbuf, 0, (int) SupportClass.FileLength(f));
				dm.generate(System.Convert.ToString(cbuf));
			}
			catch (System.IO.FileNotFoundException e)
			{
				System.Console.Out.WriteLine("Filenotfoundexception: " + e.ToString());
			}
			catch (System.IO.IOException e)
			{
				System.Console.Out.WriteLine("IOexception:\n" + e.ToString() + "\n");
			}
			catch (ConformanceError e)
			{
				System.Console.Out.WriteLine("ConformanceError:\n" + e.ToString() + "\n");
			}
			catch (ConformanceException e)
			{
				System.Console.Out.WriteLine("ConformanceException:\n" + e.ToString() + "\n");
			}
		}
		private System.String packageName; // Represents the Package that this Segment will go in
		
		/// <summary>This constructor will create a new ConformancePrimitiveBuilder</summary>
		public ConformancePrimitiveBuilder(System.String packageName, DeploymentManager depManager):base()
		{
			this.packageName = packageName;
			this.docBuilder = DocumentationBuilder.getDocumentationBuilder();
			this.depManager = depManager;
		}
Example #11
0
        private System.String packageName;         // Represents the Package that this Segment will go in

        /// <summary>This constructor will create a new ConformancePrimitiveBuilder</summary>
        public ConformancePrimitiveBuilder(System.String packageName, DeploymentManager depManager) : base()
        {
            this.packageName = packageName;
            this.docBuilder  = DocumentationBuilder.getDocumentationBuilder();
            this.depManager  = depManager;
        }
		/// <summary>This method builds a Conformance Message Class</summary>
		/// <param name="runtimeProfile">the profile which to genrate Conformance Classes for
		/// </param>
		/// <param name="depManager">the DeploymentManager
		/// </param>
		public virtual void  buildClass(RuntimeProfile runtimeProfile, DeploymentManager depManager)
		{
			this.depManager = depManager;
			this.runtimeProfile = runtimeProfile;
			this.msg = runtimeProfile.Message;
			this.confMsg = new GeneratedConformanceMessage();
			
			ProfileName profileName = new ProfileName(msg.MsgStructID, ProfileName.PS_MSG);
			
            String version = Regex.Replace(runtimeProfile.getHL7Version(), "\\.", "");

			System.String underlyingDataType = "Genetibase.NuGenHL7.model." + version + ".message." + msg.MsgStructID;
			
			ConformanceSegmentBuilder confSegBuilder = new ConformanceSegmentBuilder(packageName, version, depManager);
			ConformanceSegGroupBuilder confSegGroupBuilder = new ConformanceSegGroupBuilder(packageName, version, depManager, msg.MsgStructID);
			DocumentationBuilder docBuilder = DocumentationBuilder.getDocumentationBuilder();
			
			// Add class package and imports
			confMsg.ClassPackage = packageName;
			confMsg.addClassImport("Genetibase.NuGenHL7.conf.classes.abs.*");
			confMsg.addClassImport("Genetibase.NuGenHL7.conf.classes.exceptions.*");
			
			// Set class properties
			confMsg.Name = profileName.ClassName;
			confMsg.Properties = "extends AbstractConformanceContainer";
			
			// Decorate the class with comments
			docBuilder.decorateConformanceMessage(confMsg, runtimeProfile);
			docBuilder.decorateConstructor(confMsg.Constructor, msg.MsgType);
			
			// add hapi message
			confMsg.addHAPIMessage(underlyingDataType);
			
			for (int i = 1; i <= msg.Children; i++)
			{
				//don't build not supported, backward, or unknown types
				System.String usage = msg.getChild(i).Usage;
				if (usage.Equals("X") || usage.Equals("B") || usage.Equals("U"))
					continue;
				
				if (msg.getChild(i) is Seg)
				{
					ProfileName childProfileName = profileName.newInstance(msg.getChild(i).Name, ProfileName.PS_SEG);
					
					// Add the member variable vector to hold them
					confMsg.addMemberVariable("private FiniteList " + childProfileName.MemberName + ";");
					confMsg.Constructor.addToBody(childProfileName.MemberName + " = new FiniteList( " + childProfileName.ClassName + ".class, hapiMessage );");
					
					UnderlyingAccessor childAccessor = new UnderlyingAccessor(underlyingDataType, childProfileName.AccessorName);
					GeneratedRepGetter repGetter = new GeneratedRepGetter(childProfileName, childAccessor.AcceptsRep);
					
					docBuilder.decorateRepGetter(repGetter, (Seg) msg.getChild(i), childProfileName.AccessorName);
					
					confMsg.addMethod(repGetter);
					if (depManager.Verbose)
						System.Console.Out.WriteLine("Generating Segment: " + packageName + "." + confMsg.Name);
					
					confSegBuilder.buildClass((Seg) msg.getChild(i), underlyingDataType, childProfileName.clearNameMap());
				}
				else if (msg.getChild(i) is SegGroup)
				{
					ProfileName childProfileName = profileName.newInstance(msg.getChild(i).Name, ProfileName.PS_SEGG);
					
					// Add the member variable vector to hold them
					confMsg.addMemberVariable("private FiniteList " + childProfileName.MemberName + ";");
					confMsg.Constructor.addToBody(childProfileName.MemberName + " = new FiniteList( " + childProfileName.ClassName + ".class, hapiMessage );");
					
					System.String underlyingAccessorName = "get" + msg.MsgStructID + "_" + ConformanceSegGroupBuilder.generateSegGroupName((SegGroup) msg.getChild(i));
					UnderlyingAccessor childAccessor = new UnderlyingAccessor(underlyingDataType, underlyingAccessorName);
					GeneratedRepGetter repGetter = new GeneratedRepGetter(childProfileName, childAccessor.AcceptsRep);
					
					docBuilder.decorateRepGetter(repGetter, (SegGroup) msg.getChild(i), childProfileName.OriginalName);
					confMsg.addMethod(repGetter);
					if (depManager.Verbose)
						System.Console.Out.WriteLine("Generating SegGroup: " + packageName + "." + confMsg.Name);
					
					confSegGroupBuilder.buildClass((SegGroup) msg.getChild(i), underlyingDataType, childProfileName.clearNameMap());
				}
			}
			
			depManager.generateFile(confMsg, packageName, profileName.ClassName);
		}
        /// <summary>This method builds a Conformance Message Class</summary>
        /// <param name="runtimeProfile">the profile which to genrate Conformance Classes for
        /// </param>
        /// <param name="depManager">the DeploymentManager
        /// </param>
        public virtual void  buildClass(RuntimeProfile runtimeProfile, DeploymentManager depManager)
        {
            this.depManager     = depManager;
            this.runtimeProfile = runtimeProfile;
            this.msg            = runtimeProfile.Message;
            this.confMsg        = new GeneratedConformanceMessage();

            ProfileName profileName = new ProfileName(msg.MsgStructID, ProfileName.PS_MSG);

            String version = Regex.Replace(runtimeProfile.getHL7Version(), "\\.", "");

            System.String underlyingDataType = "Genetibase.NuGenHL7.model." + version + ".message." + msg.MsgStructID;

            ConformanceSegmentBuilder  confSegBuilder      = new ConformanceSegmentBuilder(packageName, version, depManager);
            ConformanceSegGroupBuilder confSegGroupBuilder = new ConformanceSegGroupBuilder(packageName, version, depManager, msg.MsgStructID);
            DocumentationBuilder       docBuilder          = DocumentationBuilder.getDocumentationBuilder();

            // Add class package and imports
            confMsg.ClassPackage = packageName;
            confMsg.addClassImport("Genetibase.NuGenHL7.conf.classes.abs.*");
            confMsg.addClassImport("Genetibase.NuGenHL7.conf.classes.exceptions.*");

            // Set class properties
            confMsg.Name       = profileName.ClassName;
            confMsg.Properties = "extends AbstractConformanceContainer";

            // Decorate the class with comments
            docBuilder.decorateConformanceMessage(confMsg, runtimeProfile);
            docBuilder.decorateConstructor(confMsg.Constructor, msg.MsgType);

            // add hapi message
            confMsg.addHAPIMessage(underlyingDataType);

            for (int i = 1; i <= msg.Children; i++)
            {
                //don't build not supported, backward, or unknown types
                System.String usage = msg.getChild(i).Usage;
                if (usage.Equals("X") || usage.Equals("B") || usage.Equals("U"))
                {
                    continue;
                }

                if (msg.getChild(i) is Seg)
                {
                    ProfileName childProfileName = profileName.newInstance(msg.getChild(i).Name, ProfileName.PS_SEG);

                    // Add the member variable vector to hold them
                    confMsg.addMemberVariable("private FiniteList " + childProfileName.MemberName + ";");
                    confMsg.Constructor.addToBody(childProfileName.MemberName + " = new FiniteList( " + childProfileName.ClassName + ".class, hapiMessage );");

                    UnderlyingAccessor childAccessor = new UnderlyingAccessor(underlyingDataType, childProfileName.AccessorName);
                    GeneratedRepGetter repGetter     = new GeneratedRepGetter(childProfileName, childAccessor.AcceptsRep);

                    docBuilder.decorateRepGetter(repGetter, (Seg)msg.getChild(i), childProfileName.AccessorName);

                    confMsg.addMethod(repGetter);
                    if (depManager.Verbose)
                    {
                        System.Console.Out.WriteLine("Generating Segment: " + packageName + "." + confMsg.Name);
                    }

                    confSegBuilder.buildClass((Seg)msg.getChild(i), underlyingDataType, childProfileName.clearNameMap());
                }
                else if (msg.getChild(i) is SegGroup)
                {
                    ProfileName childProfileName = profileName.newInstance(msg.getChild(i).Name, ProfileName.PS_SEGG);

                    // Add the member variable vector to hold them
                    confMsg.addMemberVariable("private FiniteList " + childProfileName.MemberName + ";");
                    confMsg.Constructor.addToBody(childProfileName.MemberName + " = new FiniteList( " + childProfileName.ClassName + ".class, hapiMessage );");

                    System.String      underlyingAccessorName = "get" + msg.MsgStructID + "_" + ConformanceSegGroupBuilder.generateSegGroupName((SegGroup)msg.getChild(i));
                    UnderlyingAccessor childAccessor          = new UnderlyingAccessor(underlyingDataType, underlyingAccessorName);
                    GeneratedRepGetter repGetter = new GeneratedRepGetter(childProfileName, childAccessor.AcceptsRep);

                    docBuilder.decorateRepGetter(repGetter, (SegGroup)msg.getChild(i), childProfileName.OriginalName);
                    confMsg.addMethod(repGetter);
                    if (depManager.Verbose)
                    {
                        System.Console.Out.WriteLine("Generating SegGroup: " + packageName + "." + confMsg.Name);
                    }

                    confSegGroupBuilder.buildClass((SegGroup)msg.getChild(i), underlyingDataType, childProfileName.clearNameMap());
                }
            }

            depManager.generateFile(confMsg, packageName, profileName.ClassName);
        }