Esempio n. 1
0
  /**
   * <br>
   * [機 能] 送信先一覧を取得する <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param address 送信先メールアドレス(宛先 or CC or BCC)
   * @param domainMap ドメインとドメイン種別のMapping
   * @return 送信先一覧
   */
  private List<Wml012AddressModel> __createAddressList(
      String address, Map<String, String> domainMap) {
    List<Wml012AddressModel> addressList = new ArrayList<Wml012AddressModel>();
    if (StringUtil.isNullZeroString(address)) {
      return addressList;
    }
    InternetAddress[] sendAddressList = null;
    try {
      sendAddressList = WmlBiz.parseAddress(address);
    } catch (AddressException ae) {
    }
    if (sendAddressList == null) {
      return addressList;
    }
    for (InternetAddress iAdress : sendAddressList) {
      Wml012AddressModel addressData = new Wml012AddressModel();
      String sendAddress = WmlBiz.convertIAdress2String(iAdress);

      int atIndex = sendAddress.lastIndexOf("@");
      if (atIndex <= 0) {
        addressData.setAddress(sendAddress);
      } else {
        addressData.setUser(sendAddress.substring(0, atIndex));
        String domain = sendAddress.substring(atIndex + 1, sendAddress.length()).trim();

        if (domain.endsWith(">")) {
          domain = domain.substring(0, domain.length() - 1);
          addressData.setDomainEnd(">");
        }
        addressData.setDomain(domain);

        String type = domainMap.get(domain);
        if (type != null) {
          addressData.setDomainType(type);
        } else {
          domainType__++;
          if (domainType__ > Wml012AddressModel.MAX_DOMAINTYPE) {
            domainType__ = Wml012AddressModel.MIN_DOMAINTYPE;
          }
          addressData.setDomainType(Integer.toString(domainType__));
          domainMap.put(domain, addressData.getDomainType());
        }
      }
      addressList.add(addressData);
    }

    return addressList;
  }
Esempio n. 2
0
  /**
   * <br>
   * [機 能] 送信メール情報を取得する <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param con コネクション
   * @param reqMdl リクエスト情報
   * @param tempRootDir テンポラリルートディレクトリ
   * @return パラメータ情報
   * @throws SQLException SQL実行時例外
   * @throws IOToolsException 送信メール情報の読み込みに失敗
   */
  public Wml012ParamModel getInitData(Connection con, RequestModel reqMdl, String tempRootDir)
      throws SQLException, IOToolsException {
    File sendMailDataPath = __getSaveFilePath(reqMdl, tempRootDir);
    Wml012ParamModel paramMdl = null;
    if (sendMailDataPath.exists()) {
      ObjectFile objFile = new ObjectFile(sendMailDataPath.getParent(), sendMailDataPath.getName());

      paramMdl = (Wml012ParamModel) objFile.load();
      Map<String, String> domainMap = new HashMap<String, String>();
      domainType__ = 0;
      paramMdl.setWml012ToList(__createAddressList(paramMdl.getWml010sendAddressTo(), domainMap));
      paramMdl.setWml012CcList(__createAddressList(paramMdl.getWml010sendAddressCc(), domainMap));
      paramMdl.setWml012BccList(__createAddressList(paramMdl.getWml010sendAddressBcc(), domainMap));

      paramMdl.setWml012ViewBody(paramMdl.getWml010svSendContent());
      if (paramMdl.getWml010sendMailHtml() != Wml010Const.SEND_HTMLMAIL_HTML) {
        paramMdl.setWml012ViewBody(
            StringUtilHtml.transToHTmlForTextArea(paramMdl.getWml012ViewBody()));
      }

      GsMessage gsMsg = new GsMessage(reqMdl);
      String sendPlanDate = null;

      int sendAccountSid = paramMdl.getWml010sendAccount();
      if (paramMdl.getSendMailPlanType() == Wml010Form.SENDMAILPLAN_TYPE_LATER) {
        sendPlanDate =
            gsMsg.getMessage(
                "cmn.view.date",
                new String[] {
                  paramMdl.getWml010sendMailPlanDateYear(),
                  paramMdl.getWml010sendMailPlanDateMonth(),
                  paramMdl.getWml010sendMailPlanDateDay(),
                  paramMdl.getWml010sendMailPlanDateHour(),
                  paramMdl.getWml010sendMailPlanDateMinute()
                });
      } else {
        int timeSendMinute = 0;

        boolean timsentImm = paramMdl.getWml010sendMailPlanImm() == Wml010Const.SENDPLAN_IMM;
        WmlAdmConfDao admConfDao = new WmlAdmConfDao(con);
        WmlAdmConfModel wmlAdmConf = admConfDao.selectAdmData();

        if (wmlAdmConf.getWadPermitKbn() == GSConstWebmail.PERMIT_ADMIN) {
          // 管理者設定 時間差送信 = 有効 に設定されている
          // かつ、画面上で"即時送信"が選択されていない場合
          if (wmlAdmConf.getWadTimesent() == GSConstWebmail.WAC_TIMESENT_LATER
              || (wmlAdmConf.getWadTimesent() == GSConstWebmail.WAC_TIMESENT_INPUT
                  && !timsentImm)) {
            timeSendMinute = 5;
          }
        } else {
          WmlAccountDao wacDao = new WmlAccountDao(con);
          WmlAccountModel wacMdl = wacDao.select(sendAccountSid);
          if (wacMdl.getWacTimesent() == GSConstWebmail.WAC_TIMESENT_INPUT) {
            if (!timsentImm) {
              timeSendMinute = 5;
            }
          } else {
            WmlBiz wmlBiz = new WmlBiz();
            timeSendMinute = wmlBiz.getTimeSentMinute(con, sendAccountSid);
          }
        }

        if (timeSendMinute > 0) {
          sendPlanDate =
              gsMsg.getMessage("wml.242", new String[] {Integer.toString(timeSendMinute)});
        } else {
          sendPlanDate = gsMsg.getMessage("wml.wml012.01");
        }
      }
      paramMdl.setWml012SendPlanDate(sendPlanDate);

      paramMdl.setWml012TempfileList(__getSendMailFileData(tempRootDir, reqMdl));

      // [宛先、添付ファイルの確認]を設定
      setAccountSendConf(con, paramMdl, sendAccountSid);
    }

    return paramMdl;
  }