コード例 #1
0
 public ACSplashable createSplash(ACAffairInfo newAffair) throws Exception {
   if (splash == null) {
     splash = new ACSplash();
     splash.setIconPathes(getSplashFilePathes());
     splash.refreshSize(getSplashWindowSize());
   }
   if (!splash.isVisible()) {
     splash.showModaless(newAffair.getTitle());
   }
   return splash;
 }
コード例 #2
0
  /**
   * SELECT 文を発行する。
   *
   * @param table テーブル名
   * @param procedure 発行するプロシージャ名
   * @param whereCondition WHERE句マップ
   * @param splash スプラッシュ
   * @return 実行結果
   * @throws Exception 実行時例外
   */
  public int executeQuery(String table, String procedure, Map whereCondition, ACSplashable splash)
      throws Exception {
    if (!isConnected()) {
      if (connect() != STATUS_CODE_OK) {
        return -1;
      }
    }

    if (beginTransaction() != STATUS_CODE_OK) {
      return -2;
    }

    // カーソルを設定
    HashMap map = execute(COMMAND_DBSELECT, table, procedure, whereCondition);

    int count = 1;
    IkenshoFirebirdDBManager dbm = null;
    try {
      dbm = new IkenshoFirebirdDBManager();
      dbm.beginTransaction();
      // 移行領域をいったんすべて初期化
      clearAccessSpace(dbm);

      // 2006/02/11[Tozo Tanaka] : add begin
      // TODO canChange?
      boolean encode = false;
      String osName = System.getProperty("os.name");
      // Mac以外であれば文字コード変換を行う。
      if ((osName != null) && (osName.indexOf("Mac") < 0)) {
        encode = true;
      }
      // 2006/02/11[Tozo Tanaka] : add end

      String ip = getLocalIP();
      // 1行ずつ取得
      while (true) {
        map = execute(COMMAND_DBFETCH, table, procedure, whereCondition);
        if ((map == null) || (map.size() <= 0)) {
          break;
        }
        Object patientName = map.get("tbl_ptinf.NAME");

        StringBuffer sb = new StringBuffer();
        sb.append("INSERT INTO");
        sb.append(" RECEIPT_ACCESS_SPACE");
        sb.append(" (");
        sb.append(" LOCAL_IP");
        sb.append(",SERIAL_ID");
        sb.append(",PTID");
        sb.append(",NAME");
        sb.append(",KANANAME");
        sb.append(",SEX");
        sb.append(",BIRTHDAY");
        sb.append(",HOME_POST");
        sb.append(",HOME_ADRS");
        sb.append(",HOME_BANTI");
        sb.append(",HOME_TEL1");
        sb.append(",LAST_TIME");
        sb.append(" )");
        sb.append(" VALUES");
        sb.append(" (");
        sb.append("'" + ip + "'");
        sb.append(",");
        sb.append(count++);
        sb.append(",");
        sb.append(IkenshoConstants.FORMAT_PASSIVE_STRING.format(map.get("tbl_ptinf.PTID")));
        sb.append(",");

        // 2006/02/11[Tozo Tanaka] : replace begin
        // TODO canChange?
        // sb.append(IkenshoConstants.FORMAT_PASSIVE_STRING.format(patientName));
        // sb.append(",");
        // sb.append(IkenshoConstants.FORMAT_PASSIVE_STRING.format(map
        // .get("tbl_ptinf.KANANAME")));
        // sb.append(",");
        // sb.append(IkenshoConstants.FORMAT_PASSIVE_STRING.format(map
        // .get("tbl_ptinf.SEX")));
        // sb.append(",");
        // sb.append(IkenshoConstants.FORMAT_PASSIVE_STRING.format(map
        // .get("tbl_ptinf.BIRTHDAY")));
        // sb.append(",");
        // sb.append(IkenshoConstants.FORMAT_PASSIVE_STRING.format(map
        // .get("tbl_ptinf.HOME_POST")));
        // sb.append(",");
        // sb.append(IkenshoConstants.FORMAT_PASSIVE_STRING.format(map
        // .get("tbl_ptinf.HOME_ADRS")));
        // sb.append(",");
        // sb.append(IkenshoConstants.FORMAT_PASSIVE_STRING.format(map
        // .get("tbl_ptinf.HOME_BANTI")));
        sb.append(
            IkenshoConstants.FORMAT_PASSIVE_STRING.format(
                getORCADecodeString(patientName, encode)));
        sb.append(",");
        sb.append(
            IkenshoConstants.FORMAT_PASSIVE_STRING.format(
                getORCADecodeString(map.get("tbl_ptinf.KANANAME"), encode)));
        sb.append(",");
        sb.append(IkenshoConstants.FORMAT_PASSIVE_STRING.format(map.get("tbl_ptinf.SEX")));
        sb.append(",");
        sb.append(IkenshoConstants.FORMAT_PASSIVE_STRING.format(map.get("tbl_ptinf.BIRTHDAY")));
        sb.append(",");
        sb.append(IkenshoConstants.FORMAT_PASSIVE_STRING.format(map.get("tbl_ptinf.HOME_POST")));
        sb.append(",");
        sb.append(
            IkenshoConstants.FORMAT_PASSIVE_STRING.format(
                getORCADecodeString(map.get("tbl_ptinf.HOME_ADRS"), encode)));
        sb.append(",");
        sb.append(
            IkenshoConstants.FORMAT_PASSIVE_STRING.format(
                getORCADecodeString(map.get("tbl_ptinf.HOME_BANTI"), encode)));
        // 2006/02/11[Tozo Tanaka] : replace end

        sb.append(",");
        sb.append(IkenshoConstants.FORMAT_PASSIVE_STRING.format(map.get("tbl_ptinf.HOME_TEL1")));
        sb.append(",CURRENT_TIMESTAMP");
        sb.append(")");

        dbm.executeUpdate(sb.toString());

        if (splash instanceof ACSplash) {
          // 状況表示
          String message = (count - 1) + " 件目";
          if (patientName != null) {
            message += " / " + patientName;
          }
          ((ACSplash) splash).setMessage(message);

          if (splash instanceof ACStopButtonSplash) {
            if (((ACStopButtonSplash) splash).isStopRequested()) {
              // 停止要求を監視する
              break;
            }
          }
        }
      }

      dbm.commitTransaction();
    } catch (Exception ex) {
      if (dbm != null) {
        dbm.rollbackTransaction();
      }
      throw ex;
    }

    if (commitTransaction() != STATUS_CODE_OK) {
      return -3;
    }

    return count - 1;
  }