Example #1
0
  /**
   * <br>
   * [機 能] 添付ファイルダウンロードの処理 <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param map アクションマッピング
   * @param form アクションフォーム
   * @param req リクエスト
   * @param res レスポンス
   * @param con コネクション
   * @throws SQLException SQL実行例外
   * @throws Exception 実行時例外
   * @return ActionForward
   */
  private ActionForward __doGetImageFile(
      ActionMapping map,
      Rsv010Form form,
      HttpServletRequest req,
      HttpServletResponse res,
      Connection con)
      throws SQLException, Exception {

    // 施設SID
    int rsdSid = form.getRsvSelectedSisetuSid();
    // バイナリSID
    Long binSid = form.getRsv010BinSid();

    Rsv010Biz biz = new Rsv010Biz(getRequestModel(req), con);
    RsvCommonBiz rsvBiz = new RsvCommonBiz();

    // 閲覧権限ある且つ施設SIDとバイナリSIDの組み合わせが一致している
    if (biz.isReadSisetsu(rsdSid) && rsvBiz.isCheckRsvImage(rsdSid, binSid, con)) {

      CommonBiz cmnBiz = new CommonBiz();
      CmnBinfModel cbMdl = null;

      cbMdl = cmnBiz.getBinInfo(con, binSid, GroupSession.getResourceManager().getDomain(req));

      if (cbMdl != null) {
        JDBCUtil.closeConnectionAndNull(con);

        // ファイルをダウンロードする
        TempFileUtil.downloadInline(req, res, cbMdl, getAppRootPath(), Encoding.UTF_8);
      }
    }

    return null;
  }
Example #2
0
  /**
   * <br>
   * [機 能] PDFファイルダウンロード処理 <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param map アクションマッピング
   * @param form アクションフォーム
   * @param req リクエスト
   * @param res レスポンス
   * @param con コネクション
   * @return ActionForward
   * @throws SQLException SQL実行時例外
   * @throws IOException ファイルの書き出しに失敗
   * @throws IOToolsException テンポラリディレクトリの削除に失敗
   * @throws TempFileException 添付ファイル情報の取得に失敗
   * @throws Exception 実行例外
   */
  private ActionForward __doDownLoadPdf(
      ActionMapping map,
      Rsv010Form form,
      HttpServletRequest req,
      HttpServletResponse res,
      Connection con)
      throws SQLException, IOException, IOToolsException, TempFileException, Exception {

    log__.debug("ファイルダウンロード処理(PDF)");
    // データ取得
    __doInit(map, form, req, res, con);

    RequestModel reqMdl = getRequestModel(req);

    // アプリケーションルートパス取得
    String appRootPath = getAppRootPath();
    // プラグイン固有のテンポラリパス取得
    CommonBiz cmnBiz = new CommonBiz();
    String outTempDir =
        IOTools.replaceFileSep(
            cmnBiz.getTempDir(getTempPath(req), GSConstReserve.PLUGIN_ID_RESERVE, reqMdl)
                + "expsyupdf/");

    Rsv010Biz biz = new Rsv010Biz(reqMdl, con);
    // PDF生成
    Rsv010ParamModel paramMdl = new Rsv010ParamModel();
    paramMdl.setParam(form);
    RsvSyuPdfModel pdfMdl = biz.createRsvSyuPdf(paramMdl, con, appRootPath, outTempDir);
    paramMdl.setFormData(form);

    String outBookName = pdfMdl.getFileName();
    String saveFileName = pdfMdl.getSaveFileName();

    String outFilePath = IOTools.setEndPathChar(outTempDir) + saveFileName;

    // ログ出力処理
    AbstractReserveBiz rsvBiz = new AbstractReserveBiz(con);
    GsMessage gsMsg = new GsMessage(req);
    String logCode = "週間 施設グループ PDF出力 " + form.getRsvSelectedGrpSid();
    rsvBiz.outPutLog(
        map, req, res, gsMsg.getMessage("cmn.pdf"), GSConstLog.LEVEL_TRACE, outBookName, logCode);

    TempFileUtil.downloadAtachment(req, res, outFilePath, outBookName, Encoding.UTF_8);
    // TEMPディレクトリ削除
    IOTools.deleteDir(IOTools.setEndPathChar(outTempDir));

    return null;
  }
Example #3
0
  /**
   * <br>
   * [機 能] 添付ファイルダウンロードの処理 <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param map アクションマッピング
   * @param form アクションフォーム
   * @param req リクエスト
   * @param res レスポンス
   * @param con コネクション
   * @throws SQLException SQL実行例外
   * @throws Exception 実行時例外
   * @return ActionForward
   */
  private ActionForward __doDownLoad(
      ActionMapping map,
      Rng020Form form,
      HttpServletRequest req,
      HttpServletResponse res,
      Connection con)
      throws SQLException, Exception {

    RequestModel reqMdl = getRequestModel(req);
    CommonBiz cmnBiz = new CommonBiz();
    String tempDir = cmnBiz.getTempDir(getTempPath(req), RngConst.PLUGIN_ID_RINGI, reqMdl);
    Rng020Biz biz = new Rng020Biz(reqMdl);
    tempDir = biz.getTemplateFileDir(tempDir);
    String fileId = form.getRng020TemplateFileId();

    // オブジェクトファイルを取得
    ObjectFile objFile = new ObjectFile(tempDir, fileId.concat(GSConstCommon.ENDSTR_OBJFILE));
    Object fObj = objFile.load();
    Cmn110FileModel fMdl = (Cmn110FileModel) fObj;
    // 添付ファイル保存用のパスを取得する(フルパス)
    String filePath = tempDir + fileId.concat(GSConstCommon.ENDSTR_SAVEFILE);
    filePath = IOTools.replaceFileSep(filePath);

    GsMessage gsMsg = new GsMessage(reqMdl);
    String msg = gsMsg.getMessage("cmn.download");

    // ログ出力処理
    RngBiz rngBiz = new RngBiz(con);
    rngBiz.outPutLog(map, msg, GSConstLog.LEVEL_INFO, fMdl.getFileName(), reqMdl);

    // 時間のかかる処理の前にコネクションを破棄
    JDBCUtil.closeConnectionAndNull(con);
    // ファイルをダウンロードする
    TempFileUtil.downloadAtachment(req, res, filePath, fMdl.getFileName(), Encoding.UTF_8);

    return null;
  }