public static boolean lookupApplicationBean(ApplicationBean applicationBean) {

      boolean good = true;

      try {
         ResultSet rset = null;
         PreparedStatement stmt = null;
         
         // lookup the first part of the application infomation
         String statementName = "lookupApplicationInfo";
         SQLConnManager connMgr = new SQLConnManager(statementName, new ErrorBean());
                  
         try {
            // Get database connection
            if ((connMgr.getConn()) == null) {
               good = false;
            }
            else {
               // Load up the correct SQL statement
               stmt = connMgr.loadPreparedStatement(statementName);
               stmt.setInt(1, ApplicationBean.APPLICATION_ID);
               rset = stmt.executeQuery();
               if (rset.next()) {
                  applicationBean.setPasscode(rset.getString(1));
                  applicationBean.setCurrentOperatorNumberId(rset.getInt(2));
                  applicationBean.setPlayDirectionAudio(rset.getInt(3) == 1);
                  applicationBean.setModifiedGrammar(rset.getInt(4));
               }
            }
         }
         catch (Exception e) {
            good = false;            
            UtilBundle.log.logMessage(e, statementName, LogUtil.SEVERE);
         }
         // Free resources allocated.
         connMgr.shutDown(true);

         BeanCollection phoneNumberBeanList = new BeanCollection();
         if(lookupPhoneNumbersByOwner(ApplicationBean.APPLICATION_TYPE_ID, phoneNumberBeanList)) {
            for(int i = 0; i < phoneNumberBeanList.size(); i++) {
               PhoneNumberBean phoneNumberBean = (PhoneNumberBean)phoneNumberBeanList.getItem(i);
               if(phoneNumberBean.getPhoneTypeId() == PhoneNumberBean.PHONETYPEID_APPLICATION) {
                  applicationBean.setApplicationNumber(phoneNumberBean.getNumber());
                  break;
               }
            }
         }
         // Create one if it is not already there...
         if((applicationBean.getApplicationNumber() == null) ||
            (applicationBean.getApplicationNumber().length() == 0)) {

            PhoneNumberBean phoneNumberBean = new PhoneNumberBean();
            phoneNumberBean.setOwnerTypeId(ApplicationBean.APPLICATION_TYPE_ID);
            phoneNumberBean.setPhoneTypeId(PhoneNumberBean.PHONETYPEID_APPLICATION);
            phoneNumberBean.setNumber("");

            insertPhoneNumber(phoneNumberBean);
         }
      }
      catch (Exception e) {
         good=false;
         e.printStackTrace(System.err);
      }
      return good;
   }