public static void createDocumentTypes(Properties ctx,int AD_Client_ID,SvrProcess sp,String trxName){
  s_log.info("AD_Client_ID=" + AD_Client_ID);
  String sql="SELECT rl.Value, rl.Name " + "FROM AD_Ref_List rl " + "WHERE rl.AD_Reference_ID=183"+ " AND rl.IsActive='Y' AND NOT EXISTS "+ " (SELECT * FROM C_DocType dt WHERE dt.AD_Client_ID=? AND rl.Value=dt.DocBaseType)";
  PreparedStatement pstmt=null;
  try {
    pstmt=DB.prepareStatement(sql,trxName);
    pstmt.setInt(1,AD_Client_ID);
    ResultSet rs=pstmt.executeQuery();
    while (rs.next()) {
      String name=rs.getString(2);
      String value=rs.getString(1);
      s_log.config(name + "=" + value);
      MDocType dt=new MDocType(ctx,value,name,trxName);
      if (dt.save()) {
        if (sp != null)         sp.addLog(0,null,null,name);
 else         s_log.fine(name);
      }
 else {
        if (sp != null)         sp.addLog(0,null,null,"Not created: " + name);
 else         s_log.warning("Not created: " + name);
      }
    }
    rs.close();
    pstmt.close();
    pstmt=null;
  }
 catch (  Exception e) {
    s_log.log(Level.SEVERE,sql,e);
  }
  try {
    if (pstmt != null)     pstmt.close();
    pstmt=null;
  }
 catch (  Exception e) {
    pstmt=null;
  }
}

public static void createDocumentTypes ( Properties ctx , int AD_Client_ID , SvrProcess sp , String trxName ) { s_log . info ( "AD_Client_ID=" + AD_Client_ID ) ; String sql = "SELECT rl.Value, rl.Name " + "FROM AD_Ref_List rl " + "WHERE rl.AD_Reference_ID=183" + " AND rl.IsActive='Y' AND NOT EXISTS " + " (SELECT * FROM C_DocType dt WHERE dt.AD_Client_ID=? AND rl.Value=dt.DocBaseType)" ; PreparedStatement pstmt = null ; try { pstmt = DB . prepareStatement ( sql , trxName ) ; pstmt . setInt ( 1 , AD_Client_ID ) ; ResultSet rs = pstmt . executeQuery ( ) ; while ( rs . next ( ) ) { String name = rs . getString ( 2 ) ; String value = rs . getString ( 1 ) ; s_log . config ( name + "=" + value ) ; MDocType dt = new MDocType ( ctx , value , name , trxName ) ; if ( dt . save ( ) ) { if ( sp != null ) sp . addLog ( 0 , null , null , name ) ; else s_log . fine ( name ) ; } else { if ( sp != null ) sp . addLog ( 0 , null , null , "Not created: " + name ) ; else s_log . warning ( "Not created: " + name ) ; } } rs . close ( ) ; pstmt . close ( ) ; pstmt = null ; } catch ( Exception e ) { s_log . log ( Level . SEVERE , sql , e ) ; } try { if ( pstmt != null ) pstmt . close ( ) ; pstmt = null ; } catch ( Exception e ) { pstmt = null ; } }
create missing document types
