/** * <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); }
/** * <br> * [機 能] 指定された会社情報をDBから読み込み、パラメータに設定する <br> * [解 説] <br> * [備 考] * * @param con コネクション * @param paramMdl Adr020ParamModel * @throws SQLException SQL実行時例外 */ protected void _setAddressData(Connection con, Adr020ParamModel paramMdl) throws SQLException { AdrAddressDao addressDao = new AdrAddressDao(con); // アドレス帳状報の設定 int adrSid = paramMdl.getAdr010EditAdrSid(); AdrAddressModel addressMdl = addressDao.select(adrSid); if (addressMdl == null) { return; } paramMdl.setAdr020unameSei(addressMdl.getAdrSei()); paramMdl.setAdr020unameMei(addressMdl.getAdrMei()); paramMdl.setAdr020unameSeiKn(addressMdl.getAdrSeiKn()); paramMdl.setAdr020unameMeiKn(addressMdl.getAdrMeiKn()); paramMdl.setAdr020selectCompany(String.valueOf(addressMdl.getAcoSid())); paramMdl.setAdr020selectCompanyBase(String.valueOf(addressMdl.getAbaSid())); paramMdl.setAdr020syozoku(addressMdl.getAdrSyozoku()); paramMdl.setAdr020position(addressMdl.getApsSid()); paramMdl.setAdr020mail1(addressMdl.getAdrMail1()); paramMdl.setAdr020mail1Comment(addressMdl.getAdrMailCmt1()); paramMdl.setAdr020mail2(addressMdl.getAdrMail2()); paramMdl.setAdr020mail2Comment(addressMdl.getAdrMailCmt2()); paramMdl.setAdr020mail3(addressMdl.getAdrMail3()); paramMdl.setAdr020mail3Comment(addressMdl.getAdrMailCmt3()); paramMdl.setAdr020postno1(addressMdl.getAdrPostno1()); paramMdl.setAdr020postno2(addressMdl.getAdrPostno2()); paramMdl.setAdr020tdfk(addressMdl.getTdfSid()); paramMdl.setAdr020address1(addressMdl.getAdrAddr1()); paramMdl.setAdr020address2(addressMdl.getAdrAddr2()); paramMdl.setAdr020tel1(addressMdl.getAdrTel1()); paramMdl.setAdr020tel1Nai(addressMdl.getAdrTelNai1()); paramMdl.setAdr020tel1Comment(addressMdl.getAdrTelCmt1()); paramMdl.setAdr020tel2(addressMdl.getAdrTel2()); paramMdl.setAdr020tel2Nai(addressMdl.getAdrTelNai2()); paramMdl.setAdr020tel2Comment(addressMdl.getAdrTelCmt2()); paramMdl.setAdr020tel3(addressMdl.getAdrTel3()); paramMdl.setAdr020tel3Nai(addressMdl.getAdrTelNai3()); paramMdl.setAdr020tel3Comment(addressMdl.getAdrTelCmt3()); paramMdl.setAdr020fax1(addressMdl.getAdrFax1()); paramMdl.setAdr020fax1Comment(addressMdl.getAdrFaxCmt1()); paramMdl.setAdr020fax2(addressMdl.getAdrFax2()); paramMdl.setAdr020fax2Comment(addressMdl.getAdrFaxCmt2()); paramMdl.setAdr020fax3(addressMdl.getAdrFax3()); paramMdl.setAdr020fax3Comment(addressMdl.getAdrFaxCmt3()); paramMdl.setAdr020biko(addressMdl.getAdrBiko()); paramMdl.setAdr020permitView(addressMdl.getAdrPermitView()); paramMdl.setAdr020permitEdit(addressMdl.getAdrPermitEdit()); // 担当者の設定 AdrPersonchargeDao tantoDao = new AdrPersonchargeDao(con); List<AdrPersonchargeModel> tantoDataList = tantoDao.getTantoListForAddress(adrSid); List<String> tantoList = new ArrayList<String>(); for (AdrPersonchargeModel tantoData : tantoDataList) { tantoList.add(String.valueOf(tantoData.getUsrSid())); } paramMdl.setAdr020tantoList(tantoList.toArray(new String[tantoList.size()])); // ラベル情報の設定 AdrBelongLabelDao belongLabelDao = new AdrBelongLabelDao(con); paramMdl.setAdr020label(belongLabelDao.getLabelSidList(adrSid)); // 閲覧権限グループの設定 AdrPermitViewDao permitViewDao = new AdrPermitViewDao(con); int permitView = paramMdl.getAdr020permitView(); if (permitView == GSConst.ADR_VIEWPERMIT_GROUP || permitView == GSConst.ADR_VIEWPERMIT_USER) { List<AdrPermitViewModel> permitDataList = permitViewDao.getPermitListForAddress(adrSid); List<String> permitList = new ArrayList<String>(); for (AdrPermitViewModel permitData : permitDataList) { if (permitView == GSConst.ADR_VIEWPERMIT_GROUP) { permitList.add(String.valueOf(permitData.getGrpSid())); } else if (permitView == GSConst.ADR_VIEWPERMIT_USER) { permitList.add(String.valueOf(permitData.getUsrSid())); } } String[] permitArray = permitList.toArray(new String[permitList.size()]); if (permitView == GSConst.ADR_VIEWPERMIT_GROUP) { paramMdl.setAdr020permitViewGroup(permitArray); } else if (permitView == GSConst.ADR_VIEWPERMIT_USER) { paramMdl.setAdr020permitViewUser(permitArray); } } // 編集権限グループの設定 AdrPermitEditDao permitEditDao = new AdrPermitEditDao(con); int permitEdit = paramMdl.getAdr020permitEdit(); if (permitEdit == GSConstAddress.EDITPERMIT_GROUP || permitEdit == GSConstAddress.EDITPERMIT_USER) { List<AdrPermitEditModel> permitDataList = permitEditDao.getPermitListForAddress(adrSid); List<String> permitList = new ArrayList<String>(); for (AdrPermitEditModel permitData : permitDataList) { if (permitEdit == GSConstAddress.EDITPERMIT_GROUP) { permitList.add(String.valueOf(permitData.getGrpSid())); } else if (permitEdit == GSConstAddress.EDITPERMIT_USER) { permitList.add(String.valueOf(permitData.getUsrSid())); } } String[] permitArray = permitList.toArray(new String[permitList.size()]); if (permitEdit == GSConstAddress.EDITPERMIT_GROUP) { paramMdl.setAdr020permitEditGroup(permitArray); } else if (permitEdit == GSConstAddress.EDITPERMIT_USER) { paramMdl.setAdr020permitEditUser(permitArray); } } }