/// <summary> Generates source code for all data types, segments, groups, and messages.</summary>
 /// <param name="baseDirectory">the directory where source should be written
 /// </param>
 public static void makeAll(System.String baseDirectory, System.String version)
 {
     try
     {
         DataTypeGenerator.makeAll(baseDirectory, version);
         SegmentGenerator.makeAll(baseDirectory, version);
         MessageGenerator.makeAll(baseDirectory, version);
         BaseDataTypeGenerator.BuildBaseDataTypes(baseDirectory, version);
     }
     catch (System.Exception e)
     {
         SupportClass.WriteStackTrace(e, Console.Error);
     }
 }
Пример #2
0
        /// <summary> Queries the normative database for a list of segments comprising
        /// the message structure.  The returned list may also contain strings
        /// that denote repetition and optionality.  Choice indicators (i.e. begin choice,
        /// next choice, end choice) for alternative segments are ignored, so that the class
        /// structure allows all choices.  The matter of enforcing that only a single choice is
        /// populated can't be handled by the class structure, and should be handled elsewhere.
        /// </summary>
        private static SegmentDef[] getSegments(String message, String version)
        {
            /*String sql = "select HL7Segments.seg_code, repetitional, optional, description " +
             * "from (HL7MsgStructIDSegments inner join HL7Segments on HL7MsgStructIDSegments.seg_code = HL7Segments.seg_code " +
             * "and HL7MsgStructIDSegments.version_id = HL7Segments.version_id) " +
             * "where HL7Segments.version_id = 6 and message_structure = '" + message + "' order by seq_no";*/
            String sql = getSegmentListQuery(message, version);

            //System.out.println(sql.toString());
            SegmentDef[]    segments = new SegmentDef[200];          //presumably there won't be more than 200
            OleDbConnection conn     = NormativeDatabase.Instance.Connection;
            OleDbCommand    stmt     = SupportClass.TransactionManager.manager.CreateStatement(conn);
            OleDbCommand    temp_OleDbCommand;

            temp_OleDbCommand             = stmt;
            temp_OleDbCommand.CommandText = sql;
            OleDbDataReader rs = temp_OleDbCommand.ExecuteReader();
            int             c  = -1;

            while (rs.Read())
            {
                String name      = SegmentGenerator.altSegName(Convert.ToString(rs[1 - 1]));
                bool   repeating = rs.GetBoolean(2 - 1);
                bool   optional  = rs.GetBoolean(3 - 1);
                String desc      = Convert.ToString(rs[4 - 1]);
                String groupName = Convert.ToString(rs[6 - 1]);

                //ignore the "choice" directives ... the message class structure has to include all choices ...
                //  if this is enforced (i.e. exception thrown if >1 choice populated) this will have to be done separately.
                if (!(name.Equals("<") || name.Equals("|") || name.Equals(">")))
                {
                    c++;
                    segments[c] = new SegmentDef(name, groupName, !optional, repeating, desc);
                }
            }
            rs.Close();
            SegmentDef[] ret = new SegmentDef[c + 1];
            Array.Copy(segments, 0, ret, 0, c + 1);
            return(ret);
        }