Пример #1
0
  /**
   * <br>
   * [機 能] 権限チェック <br>
   * [解 説] <br>
   * [備 考]
   *
   * @param map ActionMapping
   * @param req HttpServletRequest
   * @param con DB Connection
   * @return ActionForward
   * @throws Exception 実行時例外
   */
  public ActionForward checkPow(ActionMapping map, HttpServletRequest req, Connection con)
      throws Exception {

    // ユーザ情報を取得
    HttpSession session = req.getSession(false);
    BaseUserModel usModel = (BaseUserModel) session.getAttribute(GSConst.SESSION_KEY);

    // GS管理者権限を取得
    CommonBiz cmnBiz = new CommonBiz();
    boolean gsAdmFlg = cmnBiz.isPluginAdmin(con, usModel, GSConstAddress.PLUGIN_ID_ADDRESS);

    // 業種編集権限を取得
    con.setAutoCommit(true);
    AdrAconfDao dao = new AdrAconfDao(con);
    AdrAconfModel model = dao.selectAconf();
    con.setAutoCommit(false);

    if (!gsAdmFlg && (model != null && model.getAacAtiEdit() == GSConstAddress.POW_LIMIT)) {
      return map.findForward("gf_power");
    }

    return null;
  }
Пример #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);
  }
Пример #3
0
  @Override
  public Document createXml(
      ActionForm aForm,
      HttpServletRequest req,
      HttpServletResponse res,
      Connection con,
      BaseUserModel umodel)
      throws Exception {
    log__.debug("createXml start");
    // 施設予約プラグインアクセス権限確認
    if (!canAccsessSelectPlugin(GSConst.PLUGIN_ID_RESERVE)) {
      addErrors(req, addCantAccsessPluginError(req, null, GSConst.PLUGIN_ID_RESERVE));
      return null;
    }
    RequestModel reqMdl = getRequestModel(req);
    int sessionUsrSid = umodel.getUsrsid(); // セッションユーザSID

    CommonBiz cmnBiz = new CommonBiz();

    // 施設予約の管理者
    boolean rsvAdmin = cmnBiz.isPluginAdmin(con, umodel, GSConstSchedule.PLUGIN_ID_RESERVE);

    RsvCommonBiz rsvCmnBiz = new RsvCommonBiz();
    RsvUserModel rsvUserConf = rsvCmnBiz.getRevUserModel(sessionUsrSid, con);

    int dfReservGpSid = GSConstReserve.COMBO_DEFAULT_VALUE;
    if (rsvUserConf != null) {
      dfReservGpSid = rsvUserConf.getRsgSid();
    }

    List<RsvSisGrpModel> list = __getReserveGroupList(con, sessionUsrSid, rsvAdmin, reqMdl);
    Map<Integer, RsvSisKbnModel> kbnMap = __getReserveKbnMap(con);

    // ルートエレメントResultSet
    Element resultSet = new Element("ResultSet");
    Document doc = new Document(resultSet);

    if (list != null) {
      int index = 0;
      for (RsvSisGrpModel model : list) {
        Element result = new Element("Result");
        resultSet.addContent(result);

        // Rsgsid グループSID
        result.addContent(_createElement("RsgSid", model.getRsgSid()));

        // GrpName グループ名
        result.addContent(_createElement("RsgName", model.getRsgName()));

        // グループID
        result.addContent(_createElement("RsgId", NullDefault.getString(model.getRsgId(), "")));
        // 施設区分SID
        result.addContent(_createElement("RskSid", String.valueOf(model.getRskSid())));
        // 施設区分名
        if (kbnMap.containsKey(model.getRskSid())) {
          RsvSisKbnModel kbn = kbnMap.get(model.getRskSid());
          result.addContent(_createElement("RskName", kbn.getRskName()));
        } else {
          result.addContent(_createElement("RskName", ""));
        }
        if (dfReservGpSid == Integer.valueOf(model.getRsgSid())) {
          resultSet.setAttribute("DefaultIndex", String.valueOf(index));
        }
        index++;
      }
      resultSet.setAttribute("Count", String.valueOf(list.size()));
    }
    log__.debug("createXml end");

    return doc;
  }