/** * <br> * [機 能] 表示するグループ一覧を設定する。 <br> * [解 説] <br> * [備 考] * * @param paramMdl BmkPtl020ParamModel * @param con コネクション * @throws SQLException SQL実行例外 */ private void __setGroupList(BmkPtl020ParamModel paramMdl, Connection con) throws SQLException { PtlPortalPositionParamDao paramDao = new PtlPortalPositionParamDao(con); int ptlSid = paramMdl.getPtlPortalSid(); GroupBiz grpBiz = new GroupBiz(); // 全グループのリスト ArrayList<GroupModel> tree = grpBiz.getGroupCombList(con); if (tree == null) { tree = new ArrayList<GroupModel>(); } // すでに設定されているグループのリスト List<PtlPortalPositionParamModel> list = paramDao.getParamList(ptlSid, BMK_PORTLET_PARAM1); if (list == null) { list = new ArrayList<PtlPortalPositionParamModel>(); } // グループSIDのリストを作成 List<Integer> grepSidList = new ArrayList<Integer>(); for (PtlPortalPositionParamModel model : list) { int sid = NullDefault.getInt(model.getPpmParamValue(), 0); grepSidList.add(sid); } ArrayList<GroupModel> dspList = new ArrayList<GroupModel>(); for (GroupModel grepModel : tree) { if (!grepSidList.contains(grepModel.getGroupSid())) { dspList.add(grepModel); } } paramMdl.setTree(dspList); }
/** * <br> * [機 能] 閲覧メンバー一覧を取得する <br> * [解 説] <br> * [備 考] * * @param left 取得するユーザSID・グループSID * @param con コネクション * @return グループ一覧 * @throws SQLException SQL実行時例外 */ private ArrayList<LabelValueBean> __getForumLabel(String[] left, Connection con) throws SQLException { ArrayList<LabelValueBean> ret = new ArrayList<LabelValueBean>(); // ArrayList<Integer> grpSids = new ArrayList<Integer>(); ArrayList<String> usrSids = new ArrayList<String>(); // ユーザSIDとグループSIDを分離 if (left != null) { for (int i = 0; i < left.length; i++) { String str = NullDefault.getString(left[i], "-1"); log__.debug("str==>" + str); log__.debug("G.index==>" + str.indexOf("G")); if (str.contains(new String("G").subSequence(0, 1))) { // グループ grpSids.add(new Integer(str.substring(1, str.length()))); } else { // ユーザ usrSids.add(str); } } } LabelValueBean lavelBean = null; if (grpSids.size() > 0) { // グループ情報取得 UsidSelectGrpNameDao gdao = new UsidSelectGrpNameDao(con); ArrayList<GroupModel> glist = gdao.selectGroupNmListOrderbyClass(grpSids); for (GroupModel gmodel : glist) { lavelBean = new LabelValueBean(); lavelBean.setLabel(gmodel.getGroupName()); lavelBean.setValue("G" + String.valueOf(gmodel.getGroupSid())); ret.add(lavelBean); } } // ユーザ情報取得 UserBiz userBiz = new UserBiz(); ArrayList<BaseUserModel> ulist = userBiz.getBaseUserList(con, (String[]) usrSids.toArray(new String[usrSids.size()])); for (BaseUserModel umodel : ulist) { lavelBean = new LabelValueBean(); lavelBean.setLabel(umodel.getUsisei() + " " + umodel.getUsimei()); lavelBean.setValue(String.valueOf(umodel.getUsrsid())); ret.add(lavelBean); } return ret; }
/** * <br> * [機 能] 表示グループ用のグループリストを取得する(全て) <br> * [解 説] <br> * [備 考] * * @param con コネクション * @param reqMdl リクエスト情報 * @return ArrayList * @throws SQLException SQL実行時例外 */ private ArrayList<LabelValueBean> __getGroupLabelList(Connection con, RequestModel reqMdl) throws SQLException { ArrayList<LabelValueBean> labelList = new ArrayList<LabelValueBean>(); GsMessage gsMsg = new GsMessage(reqMdl); LabelValueBean labelBean = new LabelValueBean(); labelBean.setLabel(gsMsg.getMessage("cmn.grouplist")); labelBean.setValue(String.valueOf(Sml250Form.GRP_SID_GRPLIST)); labelList.add(labelBean); // グループリスト取得 GroupBiz gBiz = new GroupBiz(); ArrayList<GroupModel> gpList = gBiz.getGroupCombList(con); GroupModel gpMdl = null; for (int i = 0; i < gpList.size(); i++) { gpMdl = gpList.get(i); labelList.add(new LabelValueBean(gpMdl.getGroupName(), String.valueOf(gpMdl.getGroupSid()))); } log__.debug("labelList.size()=>" + labelList.size()); return labelList; }
/** * <br> * [機 能] レスポンスXML情報を作成する。 <br> * [解 説] <br> * [備 考] * * @param form フォーム * @param req リクエスト * @param res レスポンス * @param con DBコネクション * @param umodel ユーザ情報 * @return ActionForward フォワード * @throws Exception 実行例外 */ public Document createXml( ActionForm form, HttpServletRequest req, HttpServletResponse res, Connection con, BaseUserModel umodel) throws Exception { log__.debug("createXml start"); GroupBiz grpBiz = new GroupBiz(); ArrayList<GroupModel> grpList = null; try { // グループ一覧を取得する。 grpList = grpBiz.getGroupList(con); } catch (SQLException e) { log__.error("グループ一覧の取得に失敗", e); } // ルートエレメントResultSet Element resultSet = new Element("ResultSet"); Document doc = new Document(resultSet); // XMLデータ作成 for (GroupModel grpMdl : grpList) { Element result = new Element("Result"); resultSet.addContent(result); // Grpsid グループSID result.addContent(_createElement("Grpsid", grpMdl.getGroupSid())); // GrpId グループID result.addContent(_createElement("Grpid", grpMdl.getGroupId())); // GrpName グループ名 result.addContent(_createElement("Grpname", grpMdl.getGroupName())); // ClassLevel 階層レベル result.addContent(_createElement("ClassLevel", grpMdl.getClassLevel())); // Grpkbn 所属グループ区分 result.addContent(_createElement("Grpkbn", grpMdl.getGrpKbn())); } log__.debug("createXml end"); return doc; }
/** * <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)); } } }
/** * <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); }