Exemplo n.º 1
0
  /**
   * <br>
   * [機 能] アドレス帳の削除を行う <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param con コネクション
   * @param paramMdl Adr020ParamModel
   * @param sessionUserSid セッションユーザSID
   * @throws Exception 実行例外
   */
  public void deleteAddress(Connection con, Adr020ParamModel paramMdl, int sessionUserSid)
      throws Exception {
    int adrSid = paramMdl.getAdr010EditAdrSid();

    // アドレス帳情報の削除
    AdrAddressDao addressDao = new AdrAddressDao(con);
    addressDao.delete(adrSid);

    // 担当者情報を削除する
    AdrPersonchargeDao adrPersonDao = new AdrPersonchargeDao(con);
    adrPersonDao.deleteToAddress(adrSid);

    // ラベル付与情報を削除する
    AdrBelongLabelDao belongLabelDao = new AdrBelongLabelDao(con);
    belongLabelDao.deleteToAddress(adrSid);

    // バイナリー情報を論理削除する
    AddressDao adrDao = new AddressDao(con);
    adrDao.deleteBinData(adrSid);

    // コンタクト履歴添付情報を削除する
    adrDao.deleteContactBinToAddress(adrSid);

    // コンタクト履歴情報を削除する
    AdrContactDao contactDao = new AdrContactDao(con);
    contactDao.deleteToAddress(adrSid);
  }
Exemplo n.º 2
0
  /**
   * <br>
   * [機 能] 初期表示情報を設定する <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param paramMdl Adr020ParamModel
   * @param con コネクション
   * @param userMdl セッションユーザ情報
   * @throws Exception 実行例外
   */
  public void setInitData(Adr020ParamModel paramMdl, Connection con, BaseUserModel userMdl)
      throws Exception {

    AddressBiz addressBiz = new AddressBiz(reqMdl_);
    UserBiz userBiz = new UserBiz();

    GsMessage gsMsg = new GsMessage(reqMdl_);

    // 役職コンボを設定
    paramMdl.setPositionCmbList(getAddressPositionLabelList(con));

    // グループコンボを設定
    paramMdl.setGroupCmbList(addressBiz.getGroupLabelList(con));

    // ユーザコンボを設定
    if (paramMdl.getAdr010cmdMode() == Adr010Const.CMDMODE_CONTACT) {
      paramMdl.setUserCmbList(
          userBiz.getNormalUserLabelList(
              con, Integer.parseInt(paramMdl.getAdr010tantoGroupContact()), null, true, gsMsg));
    } else {
      paramMdl.setUserCmbList(
          userBiz.getNormalUserLabelList(
              con, Integer.parseInt(paramMdl.getAdr010tantoGroup()), null, true, gsMsg));
    }

    // 都道府県コンボを設定
    CommonBiz cmnBiz = new CommonBiz();
    paramMdl.setTdfkCmbList(cmnBiz.getTdfkLabelList(con, gsMsg));

    // 管理者設定ボタン表示フラグを設定
    boolean adminUser = cmnBiz.isPluginAdmin(con, userMdl, GSConstAddress.PLUGIN_ID_ADDRESS);

    AdrAconfDao aconfDao = new AdrAconfDao(con);
    AdrAconfModel aconfMdl = aconfDao.selectAconf();
    // 会社追加ボタン表示フラグを設定
    if (adminUser || (aconfMdl == null || aconfMdl.getAacAcoEdit() == 0)) {
      paramMdl.setAdr020addCompanyBtnFlg(1);
    }
    // ラベル追加ボタン表示フラグを設定
    if (adminUser || (aconfMdl == null || aconfMdl.getAacAlbEdit() == 0)) {
      paramMdl.setAdr020addLabelBtnFlg(1);
    }

    // 閲覧・編集権限の初期値を設定(初期表示時)
    if (paramMdl.getAdr020init() == 0) {
      if (aconfMdl != null) {
        // 管理者が設定
        if (aconfMdl.getAacVrmEdit() == GSConstAddress.MEM_DSP_ADM) {
          paramMdl.setAdr020permitView(aconfMdl.getAacPvwKbn());
          paramMdl.setAdr020permitEdit(aconfMdl.getAacPetKbn());
        } else {
          // 個人が設定
          AdrUconfDao uconfDao = new AdrUconfDao(con);
          AdrUconfModel uconfMdl = uconfDao.select(userMdl.getUsrsid());
          if (uconfMdl != null) {
            paramMdl.setAdr020permitView(uconfMdl.getAucPermitView());
            paramMdl.setAdr020permitEdit(uconfMdl.getAucPermitEdit());
          } else {
            paramMdl.setAdr020permitView(aconfMdl.getAacPvwKbn());
            paramMdl.setAdr020permitEdit(aconfMdl.getAacPetKbn());
          }
        }
      } else {
        paramMdl.setAdr020permitView(GSConst.ADR_VIEWPERMIT_OWN);
        paramMdl.setAdr020permitEdit(GSConstAddress.EDITPERMIT_OWN);
      }
    }

    // 初期表示
    if (paramMdl.getAdr020init() == 0) {

      // モード = 新規登録 の場合、担当者にセッションユーザを設定する
      if (paramMdl.getAdr020ProcMode() == GSConstAddress.PROCMODE_ADD) {
        paramMdl.setAdr020tantoList(new String[] {String.valueOf(userMdl.getUsrsid())});
      }

      // モード = 変更 の場合、DBからアドレス帳情報を読み込む
      if (paramMdl.getAdr020ProcMode() == GSConstAddress.PROCMODE_EDIT) {
        _setAddressData(con, paramMdl);
      }

      // WEBメールからの呼び出しの場合、氏名とメールアドレスを追加する
      if (paramMdl.getAdr020webmail() == 1) {
        long mailNum = paramMdl.getAdr020webmailId();
        WmlDao wmlDao = new WmlDao(con);
        WmlMailDataModel mailData = wmlDao.getMailData(mailNum, reqMdl_.getDomain());
        String webmailAddress = NullDefault.getString(mailData.getFromAddress(), "");

        if (webmailAddress.indexOf("<") > 0) {
          String userName = webmailAddress.substring(0, webmailAddress.indexOf("<")).trim();
          webmailAddress = webmailAddress.substring(webmailAddress.indexOf("<") + 1).trim();
          if (userName.startsWith("\"")) {
            userName = userName.substring(1);
          }
          if (userName.endsWith("\"")) {
            userName = userName.substring(0, userName.length() - 1);
          }
          userName = userName.replaceFirst(" ", " ");
          int userIdx = userName.indexOf(" ");
          if (userIdx > 0) {
            paramMdl.setAdr020unameSei(userName.substring(0, userIdx).trim());
            paramMdl.setAdr020unameMei(userName.substring(userIdx).trim());
          } else {
            paramMdl.setAdr020unameSei(userName);
          }

          if (webmailAddress.indexOf(">") > 0) {
            webmailAddress = webmailAddress.substring(0, webmailAddress.indexOf(">"));
          }
        }
        paramMdl.setAdr020mail1(webmailAddress);
      }

      paramMdl.setAdr020init(1);
    }
    // モード = 新規 かつ 複写ボタンをクリック時、DBからアドレス帳情報を読み込む
    if (paramMdl.getAdr020ProcMode() == GSConstAddress.PROCMODE_ADD
        && paramMdl.getAdrCopyFlg() == 1) {
      _setAddressData(con, paramMdl);
      paramMdl.setAdrCopyFlg(0);
    }

    // 会社名を設定
    _setCompanyData(con, paramMdl);

    // 役職を追加した場合の役職の設定
    if (paramMdl.getAdrPosition() > 0) {
      paramMdl.setAdr020position(paramMdl.getAdrPosition());
      paramMdl.setAdrPosition(0);
    }

    // ユーザ一覧を取得する
    CmnCmbsortConfDao sortDao = new CmnCmbsortConfDao(con);
    CmnCmbsortConfModel sortMdl = sortDao.getCmbSortData();
    AddressDao addressDao = new AddressDao(con);
    List<LabelValueBean> allUserCombo = addressDao.getAllUserList(sortMdl);

    // 担当者コンボの設定を行う
    if (paramMdl.getAdr020tantoGroup() == -2
        || paramMdl.getAdr020permitViewUserGroup() == -2
        || paramMdl.getAdr020permitEditUserGroup() == -2) {

      CmnBelongmDao belongmDao = new CmnBelongmDao(con);

      int userSid = userMdl.getUsrsid();
      int defGrpSid = belongmDao.selectUserBelongGroupDef(userSid);

      paramMdl.setAdr020tantoGroup(defGrpSid);
      paramMdl.setAdr020permitViewUserGroup(defGrpSid);
      paramMdl.setAdr020permitEditUserGroup(defGrpSid);
    }

    List<List<LabelValueBean>> tantoComboList =
        addressBiz.getUserCombo(
            con, allUserCombo, paramMdl.getAdr020tantoGroup(), paramMdl.getAdr020tantoList());
    paramMdl.setSelectTantoCombo(tantoComboList.get(0));
    paramMdl.setNoSelectTantoCombo(tantoComboList.get(1));
    ArrayList<String> selSidList = new ArrayList<String>();
    for (LabelValueBean bean : tantoComboList.get(0)) {
      selSidList.add(bean.getValue());
    }
    paramMdl.setAdr020tantoList(selSidList.toArray(new String[0]));

    // グループ一覧を取得
    ArrayList<LabelValueBean> allGroupCombo = new ArrayList<LabelValueBean>();
    GroupBiz groupBiz = new GroupBiz();
    ArrayList<GroupModel> gpList = groupBiz.getGroupList(con);

    for (GroupModel gpMdl : gpList) {
      allGroupCombo.add(
          new LabelValueBean(gpMdl.getGroupName(), String.valueOf(gpMdl.getGroupSid())));
    }
    // 閲覧グループコンボを設定する
    List<List<LabelValueBean>> viewPermitGroupComboList =
        addressBiz.getGroupCombo(con, allGroupCombo, paramMdl.getAdr020permitViewGroup());
    paramMdl.setSelectPermitViewGroup(viewPermitGroupComboList.get(0));
    paramMdl.setNoSelectPermitViewGroup(viewPermitGroupComboList.get(1));
    selSidList = new ArrayList<String>();
    for (LabelValueBean bean : viewPermitGroupComboList.get(0)) {
      selSidList.add(bean.getValue());
    }
    paramMdl.setAdr020permitViewGroup(selSidList.toArray(new String[0]));
    // 編集グループコンボを設定する
    List<List<LabelValueBean>> editPermitGroupComboList =
        addressBiz.getGroupCombo(con, allGroupCombo, paramMdl.getAdr020permitEditGroup());
    paramMdl.setSelectPermitEditGroup(editPermitGroupComboList.get(0));
    paramMdl.setNoSelectPermitEditGroup(editPermitGroupComboList.get(1));
    selSidList = new ArrayList<String>();
    for (LabelValueBean bean : editPermitGroupComboList.get(0)) {
      selSidList.add(bean.getValue());
    }
    paramMdl.setAdr020permitEditGroup(selSidList.toArray(new String[0]));

    // 閲覧ユーザコンボを設定する
    List<List<LabelValueBean>> viewPermitUserComboList =
        addressBiz.getUserCombo(
            con,
            allUserCombo,
            paramMdl.getAdr020permitViewUserGroup(),
            paramMdl.getAdr020permitViewUser());
    paramMdl.setSelectPermitViewUser(viewPermitUserComboList.get(0));
    paramMdl.setNoSelectPermitViewUser(viewPermitUserComboList.get(1));
    selSidList = new ArrayList<String>();
    for (LabelValueBean bean : viewPermitUserComboList.get(0)) {
      selSidList.add(bean.getValue());
    }
    paramMdl.setAdr020permitViewUser(selSidList.toArray(new String[0]));

    // 編集ユーザコンボを設定する
    List<List<LabelValueBean>> editPermitUserComboList =
        addressBiz.getUserCombo(
            con,
            allUserCombo,
            paramMdl.getAdr020permitEditUserGroup(),
            paramMdl.getAdr020permitEditUser());
    paramMdl.setSelectPermitEditUser(editPermitUserComboList.get(0));
    paramMdl.setNoSelectPermitEditUser(editPermitUserComboList.get(1));
    selSidList = new ArrayList<String>();
    for (LabelValueBean bean : editPermitUserComboList.get(0)) {
      selSidList.add(bean.getValue());
    }
    paramMdl.setAdr020permitEditUser(selSidList.toArray(new String[0]));

    // ラベル情報一覧を設定
    this._setLabelList(con, paramMdl);
  }