コード例 #1
0
 /// <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);
     }
     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(System.String message, System.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";*/
            System.String sql = getSegmentListQuery(message, version);
            //System.out.println(sql.toString());
            SegmentDef[] segments = new SegmentDef[200];             //presumably there won't be more than 200
            //UPGRADE_NOTE: There are other database providers or managers under System.Data namespace which can be used optionally to better fit the application requirements. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1208'"
            using (System.Data.OleDb.OleDbConnection conn = NormativeDatabase.Instance.Connection)
            {
                //UPGRADE_TODO: Method 'java.sql.Connection.createStatement' was converted to 'SupportClass.TransactionManager.manager.CreateStatement' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javasqlConnectioncreateStatement'"
                System.Data.OleDb.OleDbCommand stmt = SupportClass.TransactionManager.manager.CreateStatement(conn);
                //UPGRADE_TODO: Interface 'java.sql.ResultSet' was converted to 'System.Data.OleDb.OleDbDataReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javasqlResultSet'"
                System.Data.OleDb.OleDbCommand temp_OleDbCommand;
                temp_OleDbCommand             = stmt;
                temp_OleDbCommand.CommandText = sql;
                System.Data.OleDb.OleDbDataReader rs = temp_OleDbCommand.ExecuteReader();
                int c = -1;
                while (rs.Read())
                {
                    System.String name      = SegmentGenerator.altSegName(System.Convert.ToString(rs[1 - 1]));
                    bool          repeating = rs.GetBoolean(2 - 1);
                    bool          optional  = rs.GetBoolean(3 - 1);
                    System.String desc      = System.Convert.ToString(rs[4 - 1]);
                    System.String groupName = System.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);
            }
        }