Пример #1
0
  /**
   * <br>
   * [機 能] ユーザコンボを設定する <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param con コネクション
   * @param paramMdl パラメータ情報
   * @param reqMdl リクエスト情報
   * @throws SQLException SQL実行時例外
   */
  protected void _setUserCombo(Connection con, Sml250ParamModel paramMdl, RequestModel reqMdl)
      throws SQLException {

    GsMessage gsMsg = new GsMessage(reqMdl);

    int grpSid = NullDefault.getInt(paramMdl.getSml250userKbnUserGroup(), -1);

    String[] selectUserSid = paramMdl.getSml250userKbnUser();
    if (selectUserSid == null) {
      selectUserSid = new String[0];
    }

    // デフォルトユーザを設定
    if (paramMdl.getSml250DefActUsrSid() > 0) {
      boolean defFlg = false;
      ArrayList<String> usrSidList = new ArrayList<String>();
      for (String usid : selectUserSid) {
        usrSidList.add(usid);
        if (usid.equals(String.valueOf(paramMdl.getSml250DefActUsrSid()))) {
          defFlg = true;
        }
      }
      if (!defFlg) {
        usrSidList.add(String.valueOf(paramMdl.getSml250DefActUsrSid()));
      }
      paramMdl.setSml250userKbnUser((String[]) usrSidList.toArray(new String[usrSidList.size()]));
      selectUserSid = (String[]) usrSidList.toArray(new String[usrSidList.size()]);
    }

    Arrays.sort(selectUserSid);
    //
    //        UserBiz userBiz = new UserBiz();
    //        ArrayList<BaseUserModel> ulist
    //                = userBiz.getBaseUserList(con, selectUserSid);
    //        LabelValueBean labelBean = null;
    //        List <LabelValueBean> selectUserList = new ArrayList<LabelValueBean>();
    //        for (BaseUserModel umodel : ulist) {
    //            labelBean = new LabelValueBean();
    //            labelBean.setLabel(umodel.getUsisei() + " " + umodel.getUsimei());
    //            labelBean.setValue(String.valueOf(umodel.getUsrsid()));
    //            selectUserList.add(labelBean);
    //        }
    paramMdl.setUserKbnUserSelectCombo(__getMemberList(selectUserSid, con));

    if (grpSid == Sml250Form.GRP_SID_GRPLIST) {
      // グループを全て取得
      GroupDao dao = new GroupDao(con);
      CmnCmbsortConfDao sortDao = new CmnCmbsortConfDao(con);
      CmnCmbsortConfModel sortMdl = sortDao.getCmbSortData();
      ArrayList<GroupModel> allGpList = dao.getGroupTree(sortMdl);
      // 除外するグループSID
      List<String> fullGrepList = new ArrayList<String>();
      if (selectUserSid != null) {
        fullGrepList = Arrays.asList(selectUserSid);
      }
      List<LabelValueBean> labelListAdd = new ArrayList<LabelValueBean>();
      for (GroupModel bean : allGpList) {
        if (!fullGrepList.contains(String.valueOf("G" + bean.getGroupSid()))) {
          labelListAdd.add(
              new LabelValueBean(bean.getGroupName(), String.valueOf("G" + bean.getGroupSid())));
        }
        paramMdl.setUserKbnUserNoSelectCombo(labelListAdd);
      }
    } else {
      if (grpSid >= 0) {

        ArrayList<String> usrSidList = new ArrayList<String>();
        for (String sid : selectUserSid) {
          if (GSValidateUtil.isNumber(sid)) {
            usrSidList.add(sid);
          }
        }

        UserBiz userBiz = new UserBiz();
        paramMdl.setUserKbnUserNoSelectCombo(
            userBiz.getNormalUserLabelList(
                con,
                grpSid,
                (String[]) usrSidList.toArray(new String[usrSidList.size()]),
                false,
                gsMsg));
      }
    }
  }
Пример #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);
  }