/** * <br> * [機 能] 初期表示情報を画面にセットする <br> * [解 説] <br> * [備 考] * * @param reqMdl リクエスト情報 * @param paramMdl パラメータ情報 * @param con コネクション * @throws SQLException SQL実行例外 */ public void setInitData(RequestModel reqMdl, Sml120ParamModel paramMdl, Connection con) throws SQLException { // セッション情報を取得 BaseUserModel usModel = reqMdl.getSmodel(); int sessionUsrSid = usModel.getUsrsid(); SmlCommonBiz cmnBiz = new SmlCommonBiz(reqMdl); SmlAdminModel admConf = cmnBiz.getSmailAdminConf(sessionUsrSid, con); // 転送管理者設定 paramMdl.setSml120MailFwAdminConf(admConf.getSmaMailfw()); // 管理者設定の表示設定 int dspStype = GSConstSmail.DISP_CONF_USER; if (admConf.getSmaMaxDspStype() == GSConstSmail.DISP_CONF_ADMIN && admConf.getSmaReloadDspStype() == GSConstSmail.DISP_CONF_ADMIN && admConf.getSmaPhotoDspStype() == GSConstSmail.DISP_CONF_ADMIN && admConf.getSmaAttachDspStype() == GSConstSmail.DISP_CONF_ADMIN) { // 「管理者が設定する」のみの場合 dspStype = GSConstSmail.DISP_CONF_ADMIN; } paramMdl.setSml120DispAdminConf(dspStype); // 自動削除設定 paramMdl.setSml120MailDelAdminConf(admConf.getSmaAutoDelKbn()); }
/** * <br> * [機 能] 使用者設定フラグを取得する <br> * [解 説] <br> * [備 考] * * @param con コネクション * @param paramMdl パラメータ情報 * @param sacSid アカウントSID * @param admMdl ショートメール管理者設定 * @return 使用者設定フラグ * @throws SQLException SQL実行時例外 */ public boolean getAcntUserFlg( Connection con, Sml250ParamModel paramMdl, int sacSid, SmlAdminModel admMdl) throws SQLException { boolean acntUserFlg = false; if (paramMdl.getSmlCmdMode() == GSConstSmail.CMDMODE_ADD) { sacSid = 0; } if (admMdl == null) { SmlCommonBiz smlBiz = new SmlCommonBiz(); admMdl = new SmlAdminModel(); admMdl = smlBiz.getSmailAdminConf(0, con); } boolean admUserFlg = admMdl.getSmaAcntUser() == GSConstSmail.KANRI_ACCOUNT_USER_NO; if (paramMdl.getSmlAccountMode() == GSConstSmail.ACCOUNTMODE_COMMON) { int sacType = GSConstSmail.SAC_TYPE_NORMAL; if (sacSid > 0) { SmlAccountDao accountDao = new SmlAccountDao(con); sacType = accountDao.getSacType(sacSid); acntUserFlg = admUserFlg || sacType != GSConstSmail.SAC_TYPE_NORMAL; } else { acntUserFlg = true; } } else { acntUserFlg = admUserFlg; } return acntUserFlg; }
/** * <br> * [機 能] アクションを実行する <br> * [解 説] <br> * [備 考] * * @param map ActionMapping * @param form ActionForm * @param req HttpServletRequest * @param res HttpServletResponse * @param con DB Connection * @return ActionForward * @throws Exception 実行時例外 * @see jp.groupsession.v2.sml.AbstractSmlAction * @see #executeAction(org.apache.struts.action.ActionMapping, * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, * javax.servlet.http.HttpServletResponse, java.sql.Connection) */ public ActionForward executeSmail( ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse res, Connection con) throws Exception { ActionForward forward = null; Sml140knForm thisform = (Sml140knForm) form; // 編集可能かを判定 SmlCommonBiz cmnBiz = new SmlCommonBiz(getRequestModel(req)); if ((!_checkAuth(map, req, con)) && thisform.getSml140AccountSid() > 0) { if (!cmnBiz.canEditAccount( con, thisform.getSml140AccountSid(), getSessionUserModel(req).getUsrsid())) { return map.findForward("gf_msg"); } } // コマンドパラメータ取得 String cmd = NullDefault.getString(req.getParameter("CMD"), ""); cmd = cmd.trim(); // 確定ボタン押下 if (cmd.equals("delete")) { log__.debug("確定ボタン押下"); forward = __doDelete(map, thisform, req, res, con); // 戻るボタン押下 } else if (cmd.equals("back_syudo_input")) { log__.debug("戻るボタン押下"); forward = map.findForward("back_syudo_input"); // 初期表示処理 } else { log__.debug("初期表示処理"); forward = __doInit(map, thisform, req, res, con); } return forward; }
/** * <br> * [機 能] 初期表示設定を行う <br> * [解 説] <br> * [備 考] * * @param con コネクション * @param paramMdl パラメータ情報 * @param reqMdl リクエスト情報 * @throws Exception 実行時例外 */ public void setInitData(Connection con, Sml250ParamModel paramMdl, RequestModel reqMdl) throws Exception { // 自動削除区分を設定 SmlCommonBiz smlBiz = new SmlCommonBiz(con, reqMdl); SmlAdminModel admMdl = new SmlAdminModel(); admMdl = smlBiz.getSmailAdminConf(reqMdl.getSmodel().getUsrsid(), con); paramMdl.setSml250autoDelKbn(admMdl.getSmaAutoDelKbn()); ArrayList<LabelValueBean> yearLabel = new ArrayList<LabelValueBean>(); ArrayList<LabelValueBean> monthLabel = new ArrayList<LabelValueBean>(); GsMessage gsMsg = new GsMessage(reqMdl); // 年リスト for (int i = 0; i <= 5; i++) { yearLabel.add( new LabelValueBean( gsMsg.getMessage("cmn.year", new String[] {String.valueOf(i)}), Integer.toString(i))); } yearLabel.add( new LabelValueBean(gsMsg.getMessage("cmn.year", new String[] {String.valueOf(10)}), "10")); paramMdl.setSml250YearLabelList(yearLabel); // 月リスト for (int i = 0; i < 12; i++) { monthLabel.add( new LabelValueBean( gsMsg.getMessage("cmn.months", new String[] {String.valueOf(i)}), Integer.toString(i))); } paramMdl.setSml250MonthLabelList(monthLabel); int sacSid = paramMdl.getSmlAccountSid(); boolean acntUserFlg = getAcntUserFlg(con, paramMdl, sacSid, admMdl); paramMdl.setSml250acntUserFlg(acntUserFlg); // 新規登録 初期表示 if (paramMdl.getSml250initFlg() == GSConstSmail.DSP_FIRST && paramMdl.getSmlCmdMode() == GSConstSmail.CMDMODE_ADD) { paramMdl.setSml250initFlg(GSConstSmail.DSP_ALREADY); if (admMdl.getSmaAutoDelKbn() == GSConstSmail.AUTO_DEL_ACCOUNT) { paramMdl.setSml250JdelKbn(String.valueOf(GSConstSmail.SML_AUTO_DEL_NO)); paramMdl.setSml250SdelKbn(String.valueOf(GSConstSmail.SML_AUTO_DEL_NO)); paramMdl.setSml250WdelKbn(String.valueOf(GSConstSmail.SML_AUTO_DEL_NO)); paramMdl.setSml250DdelKbn(String.valueOf(GSConstSmail.SML_AUTO_DEL_NO)); } // 編集 初期表示 } else if (paramMdl.getSml250initFlg() == GSConstSmail.DSP_FIRST && paramMdl.getSmlCmdMode() == GSConstSmail.CMDMODE_EDIT) { // アカウント情報を設定する SmlAccountDao accountDao = new SmlAccountDao(con); SmlAccountModel accountMdl = accountDao.select(sacSid); if (accountMdl.getUsrSid() > 0) { paramMdl.setSml250AccountKbn(GSConstSmail.ACNT_DEF); paramMdl.setSml250DefActUsrSid(accountMdl.getUsrSid()); } paramMdl.setSml250name(accountMdl.getSacName()); paramMdl.setSml250biko(accountMdl.getSacBiko()); if (acntUserFlg) { // 使用者を設定 SmlAccountUserDao accountUserDao = new SmlAccountUserDao(con); List<SmlAccountUserModel> accountUserList = accountUserDao.select(sacSid); String[] id = new String[accountUserList.size()]; for (int index = 0; index < id.length; index++) { if (accountUserList.get(index).getUsrSid() > 0) { id[index] = String.valueOf(accountUserList.get(index).getUsrSid()); } else { id[index] = "G" + String.valueOf(accountUserList.get(index).getGrpSid()); } } paramMdl.setSml250userKbnUser(id); } // 送信形式 paramMdl.setSml250sendType(accountMdl.getSacSendMailtype()); // テーマ paramMdl.setSml250theme(accountMdl.getSacTheme()); // 引用符 paramMdl.setSml250quotes(accountMdl.getSacQuotes()); if (admMdl.getSmaAutoDelKbn() == GSConstSmail.AUTO_DEL_ACCOUNT) { SmlAdelDao delDao = new SmlAdelDao(con); SmlAdelModel delMdl = delDao.select(sacSid); if (delMdl == null) { delMdl = new SmlAdelModel(); delMdl.setSadJdelKbn(GSConstSmail.SML_AUTO_DEL_NO); delMdl.setSadJdelYear(0); delMdl.setSadJdelMonth(0); delMdl.setSadSdelKbn(GSConstSmail.SML_AUTO_DEL_NO); delMdl.setSadSdelYear(0); delMdl.setSadSdelMonth(0); delMdl.setSadWdelKbn(GSConstSmail.SML_AUTO_DEL_NO); delMdl.setSadWdelYear(0); delMdl.setSadWdelMonth(0); delMdl.setSadDdelKbn(GSConstSmail.SML_AUTO_DEL_NO); delMdl.setSadDdelYear(0); delMdl.setSadDdelMonth(0); } // 受信タブ処理 選択値 paramMdl.setSml250JdelKbn( NullDefault.getStringZeroLength( paramMdl.getSml250JdelKbn(), String.valueOf(delMdl.getSadJdelKbn()))); // 受信タブ 年 paramMdl.setSml250JYear( NullDefault.getStringZeroLength( StringUtilHtml.transToHTmlPlusAmparsant(paramMdl.getSml250JYear()), String.valueOf(delMdl.getSadJdelYear()))); // 受信タブ 月 paramMdl.setSml250JMonth( NullDefault.getStringZeroLength( StringUtilHtml.transToHTmlPlusAmparsant(paramMdl.getSml250JMonth()), String.valueOf(delMdl.getSadJdelMonth()))); // 送信タブ処理 選択値 paramMdl.setSml250SdelKbn( NullDefault.getStringZeroLength( paramMdl.getSml250SdelKbn(), String.valueOf(delMdl.getSadSdelKbn()))); // 送信タブ 年 paramMdl.setSml250SYear( NullDefault.getStringZeroLength( StringUtilHtml.transToHTmlPlusAmparsant(paramMdl.getSml250SYear()), String.valueOf(delMdl.getSadSdelYear()))); // 送信タブ 月 paramMdl.setSml250SMonth( NullDefault.getStringZeroLength( StringUtilHtml.transToHTmlPlusAmparsant(paramMdl.getSml250SMonth()), String.valueOf(delMdl.getSadSdelMonth()))); // 草稿タブ処理 選択値 paramMdl.setSml250WdelKbn( NullDefault.getStringZeroLength( paramMdl.getSml250WdelKbn(), String.valueOf(delMdl.getSadWdelKbn()))); // 草稿タブ 年 paramMdl.setSml250WYear( NullDefault.getStringZeroLength( StringUtilHtml.transToHTmlPlusAmparsant(paramMdl.getSml250WYear()), String.valueOf(delMdl.getSadWdelYear()))); // 草稿タブ 月 paramMdl.setSml250WMonth( NullDefault.getStringZeroLength( StringUtilHtml.transToHTmlPlusAmparsant(paramMdl.getSml250WMonth()), String.valueOf(delMdl.getSadWdelMonth()))); // ゴミ箱タブ処理 選択値 paramMdl.setSml250DdelKbn( NullDefault.getStringZeroLength( paramMdl.getSml250DdelKbn(), String.valueOf(delMdl.getSadDdelKbn()))); // ゴミ箱タブ 年 paramMdl.setSml250DYear( NullDefault.getStringZeroLength( StringUtilHtml.transToHTmlPlusAmparsant(paramMdl.getSml250DYear()), String.valueOf(delMdl.getSadDdelYear()))); // ゴミ箱タブ 月 paramMdl.setSml250DMonth( NullDefault.getStringZeroLength( StringUtilHtml.transToHTmlPlusAmparsant(paramMdl.getSml250DMonth()), String.valueOf(delMdl.getSadDdelMonth()))); } __loadAuteDest(paramMdl, con); paramMdl.setSml250initFlg(GSConstSmail.DSP_ALREADY); } // グループコンボを設定 // List<LabelValueBean> groupCombo = new ArrayList<LabelValueBean>(); // groupCombo.add(new LabelValueBean(gsMsg.getMessage("cmn.select.plz"), "-1")); // // ArrayList<GroupModel> grpList = grpBiz.getGroupCombList(con); // for (GroupModel grpMdl : grpList) { // LabelValueBean label = new LabelValueBean(grpMdl.getGroupName(), // String.valueOf(grpMdl.getGroupSid())); // groupCombo.add(label); // } // グループコンボを設定 paramMdl.setUserKbnGroupCombo(__getGroupLabelList(con, reqMdl)); // 使用者 グループコンボ、ユーザコンボを設定 // _setGroupCombo(con, paramMdl); _setUserCombo(con, paramMdl, reqMdl); // テーマコンボを設定 List<LabelValueBean> themeCombo = new ArrayList<LabelValueBean>(); themeCombo.add( new LabelValueBean( gsMsg.getMessage("cmn.notset"), String.valueOf(GSConstSmail.SAC_THEME_NOSET))); CmnThemeDao themeDao = new CmnThemeDao(con); List<CmnThemeModel> themeList = themeDao.select(); for (CmnThemeModel themeData : themeList) { themeCombo.add( new LabelValueBean(themeData.getCtmName(), String.valueOf(themeData.getCtmSid()))); } paramMdl.setSml250themeList(themeCombo); // 引用符コンボを設定 List<LabelValueBean> quotesCombo = new ArrayList<LabelValueBean>(); int[] quotesList = { GSConstSmail.SAC_QUOTES_DEF, GSConstSmail.SAC_QUOTES_NONE, GSConstSmail.SAC_QUOTES_2, GSConstSmail.SAC_QUOTES_3, GSConstSmail.SAC_QUOTES_4, GSConstSmail.SAC_QUOTES_5 }; for (int quotes : quotesList) { quotesCombo.add( new LabelValueBean( SmlCommonBiz.getViewMailQuotes(quotes, reqMdl), Integer.toString(quotes))); } paramMdl.setSml250quotesList(quotesCombo); /** ********************** 転送設定 ******************************** */ paramMdl.setSml250tensoKbn(admMdl.getSmaMailfw()); if (paramMdl.getSmlAccountMode() == GSConstSmail.ACCOUNTMODE_COMMON && paramMdl.getSml250tensoKbn() == GSConstSmail.MAIL_FORWARD_OK) { // /** グループコンボセット **************************************************/ // GroupBiz biz = new GroupBiz(); // paramMdl.setSml250GpLabelList(biz.getGroupTreeLabelList( // con, true, gsMsg, paramMdl.getSml250userKbnGroup())); /** 現在選択中のメンバーコンボセット ************************************* */ // UserBiz userBiz = new UserBiz(); paramMdl.setSml250MbLabelList((__getMemberList(paramMdl.getSml250userSid(), con))); /** 追加用メンバーコンボセット ******************************************* */ // デフォルトユーザ存在フラグ boolean defUsrFlg = false; Map<String, String> usrSidMap = new HashMap<String, String>(); // グループSID // int gpSid = NullDefault.getInt(paramMdl.getSml250groupSid(), -1); // 除外するユーザSID ArrayList<Integer> usrSids = new ArrayList<Integer>(); String[] userSids = paramMdl.getSml250userSid(); if (userSids != null) { for (int i = 0; i < userSids.length; i++) { usrSids.add(new Integer(NullDefault.getInt(userSids[i], -1))); usrSidMap.put(userSids[i], userSids[i]); if (new Integer(NullDefault.getInt(userSids[i], -1)) == paramMdl.getSml250DefActUsrSid()) { defUsrFlg = true; } } } // List<CmnUsrmInfModel> usList = null; List<LabelValueBean> labelListAdd = new ArrayList<LabelValueBean>(); // if (paramMdl.getSml250userKbn() != USERKBN_USER) { // usList = userBiz.getBelongUserList(con, gpSid, usrSids); // for (int i = 0; i < usList.size(); i++) { // CmnUsrmInfModel cuiMdl = usList.get(i); // labelListAdd.add(new LabelValueBean(cuiMdl.getUsiSei() + // cuiMdl.getUsiMei(), // String.valueOf(cuiMdl.getUsrSid()))); // } // } else { for (LabelValueBean lv : paramMdl.getUserKbnUserSelectCombo()) { if (!usrSidMap.containsKey(lv.getValue())) { labelListAdd.add(lv); } } // } // デフォルトユーザを追加 for (LabelValueBean lv : labelListAdd) { if (lv.getValue().equals(String.valueOf(paramMdl.getSml250DefActUsrSid()))) { defUsrFlg = true; } } if (!defUsrFlg && paramMdl.getSml250DefActUsrSid() > 0) { labelListAdd.add( new LabelValueBean( paramMdl.getSml250name(), String.valueOf(paramMdl.getSml250DefActUsrSid()))); } paramMdl.setSml250AdLabelList(labelListAdd); // メールアドレスコンボ設定 paramMdl.setSml250MailList(__getMailCombo(reqMdl)); } _setAutoDestDisp(paramMdl, con); }
/** * <br> * [機 能] 確定ボタンクリック時 <br> * [解 説] <br> * [備 考] * * @param map ActionMapping * @param form フォーム * @param req リクエスト * @param res レスポンス * @param con コネクション * @return forward アクションフォワード * @throws Exception 実行時例外 */ public ActionForward __doDelete( ActionMapping map, Sml140knForm form, HttpServletRequest req, HttpServletResponse res, Connection con) throws Exception { ActionForward forward = null; if (!isTokenValid(req, true)) { log__.info("2重投稿"); forward = getSubmitErrorPage(map, req); return forward; } con.setAutoCommit(false); boolean commit = false; RequestModel reqMdl = getRequestModel(req); try { Sml140knParamModel paramMdl = new Sml140knParamModel(); paramMdl.setParam(form); Sml140knBiz biz = new Sml140knBiz(con); biz.updateSyudoDelSetting(reqMdl, paramMdl); paramMdl.setFormData(form); GsMessage gsMsg = new GsMessage(reqMdl); String delete = gsMsg.getMessage("cmn.delete"); // ログ出力処理 SmlAccountModel sacMdl = new SmlAccountModel(); SmlAccountDao sacDao = new SmlAccountDao(con); sacMdl = sacDao.select(form.getSml140AccountSid()); String accountName = sacMdl.getSacName(); if (paramMdl.getSml140SelKbn() != GSConstSmail.ACCOUNT_SEL) { accountName = gsMsg.getMessage("wml.wml120.01"); } SmlCommonBiz smlBiz = new SmlCommonBiz(con, reqMdl); smlBiz.outPutLog( map, reqMdl, delete, GSConstLog.LEVEL_INFO, "アカウント:" + accountName + "\n[value]" + form.getSml140JdelKbn() + "-" + form.getSml140JYear() + "-" + form.getSml140JMonth() + ", " + form.getSml140SdelKbn() + "-" + form.getSml140SYear() + "-" + form.getSml140SMonth() + ", " + form.getSml140WdelKbn() + "-" + form.getSml140WYear() + "-" + form.getSml140WMonth() + ", " + form.getSml140DdelKbn() + "-" + form.getSml140DYear() + "-" + form.getSml140DMonth()); commit = true; forward = __doCompDsp(map, form, req, res); return forward; } catch (SQLException e) { log__.error("SQLException", e); throw e; } finally { if (commit) { con.commit(); } else { JDBCUtil.rollback(con); } } }