/** * 데이터 수정. * * @param userDB * @param title * @param desc * @param cronExp * @param listSchedule * @return * @throws Exception */ public static ScheduleMainDAO modifySchedule( final UserDBDAO userDB, ScheduleMainDAO scheduleDao, List<ScheduleDAO> listSchedule) throws Exception { SqlMapClient sqlClient = TadpoleSQLManager.getInstance(TadpoleSystemInitializer.getUserDB()); sqlClient.update("scheduleMainUpdate", scheduleDao); // 기존 데이터를 삭제합니다. sqlClient.update("deleteSchedule", scheduleDao.getSeq()); // save schedule for (ScheduleDAO scheduleDAO : listSchedule) { scheduleDAO.setSchedule_main_seq(scheduleDao.getSeq()); ScheduleDAO retScheduleDAO = (ScheduleDAO) sqlClient.insert("scheduleInsert", scheduleDAO); // sql String[] sqls = SQLUtil.makeResourceDataArays(scheduleDAO.getSql()); ScheduleDetailDAO detailDao = null; for (String sql : sqls) { detailDao = new ScheduleDetailDAO(); detailDao.setSchedule_seq(retScheduleDAO.getSeq()); detailDao.setDatas(sql); sqlClient.insert("scheduleDetailInsert", detailDao); } } return scheduleDao; }
public ArrayList<ArrayList> moveChanges() { ArrayList<ArrayList> res = new ArrayList<ArrayList>(0); try { for (int i = 0; i < idch.getChangesetID().size(); ++i) { Integer old_ch = (Integer) idch.getChangesetID().get(i).get(0); Integer new_ch = (Integer) idch.getChangesetID().get(i).get(1); List lst = client.queryForList("GetChanges", new ParamHelper(s_db, old_ch)); for (int j = 0; j < lst.size(); ++j) { Change c = (Change) lst.get(j); c.setT_db(t_db); c.setChangeset_id(new_ch); client.insert("insertChange", c); res.add(new ArrayList(0)); int newID = (Integer) client.queryForObject("LastInsertId", new ParamHelper(t_db, "changes")); res.get(res.size() - 1).add(c.getId()); res.get(res.size() - 1).add(newID); } } } catch (Exception e) { logger.error("in moveChanges", e); JOptionPane.showMessageDialog( null, e.getMessage() + e.getStackTrace(), "Беда!", JOptionPane.ERROR_MESSAGE); // e.printStackTrace(); } return res; }
public ArrayList<ArrayList> moveRepositories() { ArrayList<ArrayList> res = new ArrayList<ArrayList>(0); int old_prj = (Integer) idch.getProjectID().get(0).get(0); int new_prj = (Integer) idch.getProjectID().get(0).get(1); try { List lst = client.queryForList("GetRepositoriesForIssue", new ParamHelper(s_db, old_prj)); for (int i = 0; i < lst.size(); ++i) { Repository r = (Repository) lst.get(i); r.setProject_id(new_prj); r.setT_db(t_db); client.insert("insertRepository", r); res.add(new ArrayList(0)); int newID = (Integer) client.queryForObject("LastInsertId", new ParamHelper(t_db, "repositories")); res.get(res.size() - 1).add(r.getId()); res.get(res.size() - 1).add(newID); } } catch (Exception e) { logger.error("in moveRepositories", e); JOptionPane.showMessageDialog( null, e.getMessage() + e.getStackTrace(), "Беда!", JOptionPane.ERROR_MESSAGE); // e.printStackTrace(); } return res; }
@SuppressWarnings("unchecked") public static void main(String[] args) throws IOException { String config = "sqlMapConfig.xml"; Reader reader = Resources.getResourceAsReader(config); SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader); ClusterViewModel cViewModel = new ClusterViewModel(); cViewModel.setId(Rpid.generate()); try { sqlMap.insert("insertClusterViewModel", cViewModel); } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } List<ClusterViewModel> list; try { list = sqlMap.queryForList("checkFromCluster"); for (ClusterViewModel clusterViewModel : list) { System.out.println(clusterViewModel); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public User insertUser(User user) { try { sqlMapClient.insert("insertUser", user); return user; } catch (SQLException e) { e.printStackTrace(); return null; } }
/** * schedule result * * @param seq * @param isResult * @param msg */ public static void saveScheduleResult(int seq, boolean isResult, String msg) throws Exception { ScheduleResultDAO dao = new ScheduleResultDAO(); dao.setSchedule_main_seq(seq); dao.setResult( isResult ? PublicTadpoleDefine.YES_NO.YES.name() : PublicTadpoleDefine.YES_NO.NO.name()); dao.setDescription(msg); SqlMapClient sqlClient = TadpoleSQLManager.getInstance(TadpoleSystemInitializer.getUserDB()); sqlClient.insert("scheduleResultInsert", dao); }
@Override public void insertThing(String type) throws SQLException { if (type.equals("Banner")) { try { uploadFile(); } catch (IOException e) { e.printStackTrace(); } bb.setAdmin_num(Integer.parseInt(session.get("admin_num"))); bb.setBanner_image_url(uploadFileName); SqlMapClient ibatis = Mapper.getSqlMapper(); ibatis.insert("insertBanner", bb); } if (type.equals("BannerLog")) { SqlMapClient ibatis = Mapper.getSqlMapper(); ibatis.insert("insertBannerLog", blb); } }
public boolean addUserRelation(UserRelation userRelation) { try { client.insert("insertUserRelation", userRelation); return true; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return false; }
public int writeRecords(SqlMapClient map, List<RAWDataBean> data) throws UnClassifiedException { try { for (RAWDataBean entity : data) { map.insert("writeRecords", entity); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return 0; }
/** * resource data * * @param userDBResource * @param contents * @throws Exception */ private static void insertResourceData(ExecutedSqlResourceDAO userDBResource, String contents) throws Exception { SqlMapClient sqlClient = TadpoleSQLManager.getInstance(TadpoleSystemInitializer.getUserDB()); // content data를 저장합니다. ExecutedSqlResourceDataDAO dataDao = new ExecutedSqlResourceDataDAO(); dataDao.setExecuted_sql_resource_seq(userDBResource.getSeq()); String[] arrayContent = SQLUtil.makeResourceDataArays(contents); for (String content : arrayContent) { dataDao.setDatas(content); sqlClient.insert("userExecuteSQLResourceDataInsert", dataDao); // $NON-NLS-1$ } }
/** * @param userDB * @param title * @param desc * @param cronExp * @param listSchedule */ public static ScheduleMainDAO addSchedule( final UserDBDAO userDB, String title, String desc, String cronExp, List<ScheduleDAO> listSchedule) throws Exception { int userSeq = SessionManager.getUserSeq(); ScheduleMainDAO dao = new ScheduleMainDAO(); dao.setSeq(userSeq); dao.setUser_seq(SessionManager.getUserSeq()); dao.setDb_seq(userDB.getSeq()); dao.setTitle(title); dao.setDescription(desc); dao.setCron_exp(cronExp); SqlMapClient sqlClient = TadpoleSQLManager.getInstance(TadpoleSystemInitializer.getUserDB()); dao = (ScheduleMainDAO) sqlClient.insert("scheduleMainInsert", dao); // save schedule for (ScheduleDAO scheduleDAO : listSchedule) { scheduleDAO.setSchedule_main_seq(dao.getSeq()); ScheduleDAO retScheduleDAO = (ScheduleDAO) sqlClient.insert("scheduleInsert", scheduleDAO); // sql String[] sqls = SQLUtil.makeResourceDataArays(scheduleDAO.getSql()); ScheduleDetailDAO detailDao = null; for (String sql : sqls) { detailDao = new ScheduleDetailDAO(); detailDao.setSchedule_seq(retScheduleDAO.getSeq()); detailDao.setDatas(sql); sqlClient.insert("scheduleDetailInsert", detailDao); } } return dao; }
/** * @param data * @return */ public String insertCbData(WapCbDTO data) { String returnValue = null; if (data == null) // 잘못된값 검사 return null; try { returnValue = getNextCid(); logger.info("[WapCbManager]insertCbData:" + data.getCid()); data.setCid(returnValue); sqlClient.insert("NOTIFY.insertCbData", data); } catch (Exception ex) { returnValue = null; logger.error("[WapCbManager]Error at insertCbData(" + ex.toString() + ")"); } logger.info("[WapCbManager]" + data.getCid() + ", " + data.getParam()); return returnValue; }
// 게시판 WRITE 액션 public String execute() throws Exception { // 파라미터와 리절트 객체 생성. paramClass = new boardVO(); resultClass = new boardVO(); // 등록할 항목 설정. paramClass.setSubject(getSubject()); paramClass.setName(getName()); paramClass.setPassword(getPassword()); paramClass.setContent(getContent()); paramClass.setRegdate(today.getTime()); // 등록 쿼리 수행. sqlMapper.insert("insertBoard", paramClass); // 첨부파일을 선택했다면 파일을 업로드한다. if (getUpload() != null) { // 등록한 글 번호 가져오기. resultClass = (boardVO) sqlMapper.queryForObject("selectLastNo"); // 실제 서버에 저장될 파일 이름과 확장자 설정. String file_name = "file_" + resultClass.getNo(); String file_ext = getUploadFileName() .substring(getUploadFileName().lastIndexOf('.') + 1, getUploadFileName().length()); // 서버에 파일 저장. File destFile = new File(fileUploadPath + file_name + "." + file_ext); FileUtils.copyFile(getUpload(), destFile); // 파일 정보 파라미터 설정. paramClass.setNo(resultClass.getNo()); paramClass.setFile_orgname(getUploadFileName()); // 원래 파일 이름 paramClass.setFile_savname(file_name + "." + file_ext); // 서버에 저장한 파일 이름 // 파일 정보 업데이트. sqlMapper.update("updateFile", paramClass); } return SUCCESS; }
public void moveChangesetsIssues() { try { for (int i = 0; i < idch.getChangesetID().size(); ++i) { Integer old_ch = (Integer) idch.getChangesetID().get(i).get(0); Integer new_ch = (Integer) idch.getChangesetID().get(i).get(1); List lst = client.queryForList("GetChangesetsIssues", new ParamHelper(s_db, old_ch)); for (int j = 0; j < lst.size(); ++j) { ChangesetsIssue c = (ChangesetsIssue) lst.get(j); c.setT_db(t_db); c.setChangeset_id(new_ch); c.setIssue_id(idch.evaluateID(idch.getIssueID(), c.getIssue_id())); client.insert("insertChangesetsIssue", c); } } } catch (Exception e) { logger.error("in moveChangesetsIssues", e); JOptionPane.showMessageDialog( null, e.getMessage() + e.getStackTrace(), "Беда!", JOptionPane.ERROR_MESSAGE); // e.printStackTrace(); } }
public boolean insertRankingHistory(UserDTO dto) throws Exception { boolean result = false; try { sqlClient.startTransaction(); sqlClient.startBatch(); sqlClient.insert("UserInfo.insertRankingHistory", dto); sqlClient.executeBatch(); sqlClient.commitTransaction(); result = true; } catch (Exception e) { logger.error("sql Exception : " + e.getMessage()); throw new Exception("TwitterRankDAO.insertRankingHistory:" + e.getMessage()); } finally { sqlClient.endTransaction(); } return result; }
public boolean insertUserList(List<UserDTO> list) throws Exception { boolean result = false; try { // 트랜잭션 시작 sqlClient.startTransaction(); // 배치작업 준비 시작 sqlClient.startBatch(); for (UserDTO dto : list) { sqlClient.insert("UserInfo.insertUserList", dto); } // 배치작업 실행. sqlClient.executeBatch(); // 정상 완료 후 커밋 sqlClient.commitTransaction(); result = true; } catch (Exception e) { logger.error("sql Exception : " + e.getMessage()); throw new Exception("TwitterRankDAO.getUserList:" + e.getMessage()); } finally { // 문제 발생시 트랜잭션 종료(작업 적용안함) sqlClient.endTransaction(); } return result; }
@POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.TEXT_PLAIN) public String insertLedger(Ledger objLedger) { try { Reader reader = Resources.getResourceAsReader("./dao/SqlMapConfig.xml"); SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader); Ledger temp = (Ledger) sqlMap.queryForObject("Ledger.getDuplicateLedger", objLedger); if (temp != null) { return "Sorry, Ledger name already exists.! Kindly try some other name."; } sqlMap.startTransaction(); sqlMap.insert("Ledger.insertLedger", objLedger); sqlMap.commitTransaction(); sqlMap.endTransaction(); } catch (Exception e) { e.printStackTrace(); return "Some problem occured while creating New Ledger. Kindly try again!"; } return "New Ledger created successfully"; }
/** * save sqlhistory * * @param user_seq * @param userDB * @param sqlType * @param sqlHistoryDAO */ public static void saveExecuteSQUeryResource( int user_seq, UserDBDAO userDB, PublicTadpoleDefine.EXECUTE_SQL_TYPE sqlType, SQLHistoryDAO sqlHistoryDAO) throws Exception { if (PublicTadpoleDefine.YES_NO.YES.name().equals(userDB.getIs_profile())) { ExecutedSqlResourceDAO executeSQLResourceDao = new ExecutedSqlResourceDAO(); executeSQLResourceDao.setDb_seq(userDB.getSeq()); executeSQLResourceDao.setUser_seq(user_seq); executeSQLResourceDao.setTypes(sqlType.toString()); executeSQLResourceDao.setStartDateExecute(sqlHistoryDAO.getStartDateExecute()); executeSQLResourceDao.setEndDateExecute(sqlHistoryDAO.getEndDateExecute()); long duration = sqlHistoryDAO.getEndDateExecute().getTime() - sqlHistoryDAO.getStartDateExecute().getTime(); executeSQLResourceDao.setDuration(Integer.parseInt("" + duration)); executeSQLResourceDao.setRow(sqlHistoryDAO.getRows()); executeSQLResourceDao.setResult(sqlHistoryDAO.getResult()); executeSQLResourceDao.setMessage( sqlHistoryDAO .getMesssage()); // ""+(sqlHistoryDAO.getEndDateExecute().getTime() - // sqlHistoryDAO.getStartDateExecute().getTime())); executeSQLResourceDao.setIpAddress(sqlHistoryDAO.getIpAddress()); // 기존에 등록 되어 있는지 검사한다 SqlMapClient sqlClient = TadpoleSQLManager.getInstance(TadpoleSystemInitializer.getUserDB()); ExecutedSqlResourceDAO executeSQL = (ExecutedSqlResourceDAO) sqlClient.insert( "userExecuteSQLResourceInsert", executeSQLResourceDao); // $NON-NLS-1$ insertResourceData(executeSQL, sqlHistoryDAO.getStrSQLText()); } }
/** * This method was generated by MyBatis Generator. This method corresponds to the database table * SELL_MEDIA * * @mbggenerated Mon Oct 29 16:37:30 ART 2012 */ public Integer insertSellMediaSelective(SellMedia record) throws SQLException { Object newKey = sqlMapClient.insert("SELL_MEDIA.insertSelective", record); return (Integer) newKey; }
/** * user info data insert * * @param listUserData * @throws Exception */ public static void insertUserInfoData(UserInfoDataDAO listUserData) throws Exception { SqlMapClient sqlClient = TadpoleSQLManager.getInstance(TadpoleSystemInitializer.getUserDB()); sqlClient.insert("userInfoDataInsert", listUserData); // $NON-NLS-1$ }
/** 신규 사용자의 기본 유저 데이터 정보를 저장합니다. */ public static void insertUserInfoData(UserDAO userdb) throws Exception { SqlMapClient sqlClient = TadpoleSQLManager.getInstance(TadpoleSystemInitializer.getUserDB()); UserInfoDataDAO userInfoData = new UserInfoDataDAO(); userInfoData.setUser_seq(userdb.getSeq()); // export delimiter userInfoData.setName(PreferenceDefine.EXPORT_DILIMITER); userInfoData.setValue0("" + PreferenceDefine.EXPORT_DILIMITER_VALUE); sqlClient.insert("userInfoDataInsert", userInfoData); // $NON-NLS-1$ // SESSION TIME OUT userInfoData.setName(PreferenceDefine.SESSION_DFEAULT_PREFERENCE); userInfoData.setValue0("" + PreferenceDefine.SESSION_SERVER_DEFAULT_PREFERENCE_VALUE); sqlClient.insert("userInfoDataInsert", userInfoData); // $NON-NLS-1$ // DEFAULT_HOME PAGE userInfoData.setName(PreferenceDefine.DEFAULT_HOME_PAGE); userInfoData.setValue0("" + PreferenceDefine.DEFAULT_HOME_PAGE_VALUE); sqlClient.insert("userInfoDataInsert", userInfoData); // $NON-NLS-1$ // DEFAULT_HOME PAGE_USE userInfoData.setName(PreferenceDefine.DEFAULT_HOME_PAGE_USE); userInfoData.setValue0("" + PreferenceDefine.DEFAULT_HOME_PAGE_USE_VALUE); sqlClient.insert("userInfoDataInsert", userInfoData); // $NON-NLS-1$ // select 제한 갯수 userInfoData.setName(PreferenceDefine.SELECT_LIMIT_COUNT); userInfoData.setValue0("" + PreferenceDefine.SELECT_SELECT_LIMIT_COUNT_VALUE); sqlClient.insert("userInfoDataInsert", userInfoData); // $NON-NLS-1$ // 검색 결과 페이지 당 보여주는 갯수 userInfoData.setName(PreferenceDefine.SELECT_RESULT_PAGE_PREFERENCE); userInfoData.setValue0("" + PreferenceDefine.SELECT_RESULT_PAGE_PREFERENCE_VALUE); sqlClient.insert("userInfoDataInsert", userInfoData); // $NON-NLS-1$ // ORACLE PLAN TABLE userInfoData.setName(PreferenceDefine.ORACLE_PLAN_TABLE); userInfoData.setValue0(PreferenceDefine.ORACLE_PLAN_TABLE_VALUE); sqlClient.insert("userInfoDataInsert", userInfoData); // $NON-NLS-1$ // MONGO_DEFAULT_LIMIT userInfoData.setName(PreferenceDefine.MONGO_DEFAULT_LIMIT); userInfoData.setValue0(PreferenceDefine.MONGO_DEFAULT_LIMIT_VALUE); sqlClient.insert("userInfoDataInsert", userInfoData); // $NON-NLS-1$ // MONGO_DEFAULT_MAX_COUNT userInfoData.setName(PreferenceDefine.MONGO_DEFAULT_MAX_COUNT); userInfoData.setValue0(PreferenceDefine.MONGO_DEFAULT_MAX_COUNT_VALUE); sqlClient.insert("userInfoDataInsert", userInfoData); // $NON-NLS-1$ // MONGO_DEFAULT_FIND userInfoData.setName(PreferenceDefine.MONGO_DEFAULT_FIND); userInfoData.setValue0(PreferenceDefine.MONGO_DEFAULT_FIND_BASIC); sqlClient.insert("userInfoDataInsert", userInfoData); // $NON-NLS-1$ // MONGO_DEFAULT_RESULT userInfoData.setName(PreferenceDefine.MONGO_DEFAULT_RESULT); userInfoData.setValue0(PreferenceDefine.MONGO_DEFAULT_RESULT_TABLE); sqlClient.insert("userInfoDataInsert", userInfoData); // $NON-NLS-1$ // SQLFormatter userInfoData.setName(PreferenceDefine.DEFAULT_TAB_SIZE_PREFERENCE); userInfoData.setValue0(PreferenceDefine.DEFAULT_TAB_SIZE_PREFERENCE_VALUE); sqlClient.insert("userInfoDataInsert", userInfoData); // $NON-NLS-1$ userInfoData.setName(PreferenceDefine.SQL_FORMATTER_DECODE_PREFERENCE); userInfoData.setValue0(PreferenceDefine.SQL_FORMATTER_DECODE_PREFERENCE_VALUE); sqlClient.insert("userInfoDataInsert", userInfoData); // $NON-NLS-1$ userInfoData.setName(PreferenceDefine.SQL_FORMATTER_IN_PREFERENCE); userInfoData.setValue0(PreferenceDefine.SQL_FORMATTER_IN_PREFERENCE_VALUE); sqlClient.insert("userInfoDataInsert", userInfoData); // $NON-NLS-1$ }
public static void InsertHouse(HouseBean bean) throws Exception { sqlMapper.insert("howstay.adminHouse.InsertHouse", bean); }
public void addNewNotice(NoticeVO notice) throws SQLException { SqlMapClient sqlmap = IbatisUtil.getSqlmap(); sqlmap.insert("addNewNotice", notice); }
package spring.service.juror.impl;
@Override public void insertDBServer(Server server) throws Exception { sqlMapClient.insert("Server.insertDBServer", server); }
// 新建主档明细 public void createLog(Context context) { Map outputMap = new HashMap(); List errList = context.errList; // 查询出在数据字典中的案件狀況細項下的提案的主键 String prvLogSun1 = "已访厂"; String prvLogSun2 = "首次拜访"; int casesun = Integer.parseInt(context.contextMap.get("casesun").toString()); // 通过casesun(明细档Id),查询出name Map logName = null; try { context.contextMap.put("reportactlogid", context.contextMap.get("casesun")); logName = (Map) DataAccessor.query( "activitiesLog.getActlogNameByActlogId", context.contextMap, DataAccessor.RS_TYPE.MAP); } catch (Exception e) { e.printStackTrace(); LogPrint.getLogStackTrace(e, logger); // 添加详细错误信息 errList.add("活动日志管理--新建主档明细错误!请联系管理员"); } Object actLogName1 = logName.get("ACTLOG_NAME"); String actLogName = null; if (actLogName1 != null && !"".equals(actLogName1)) { actLogName = actLogName1.toString(); } int casesun1 = Integer.parseInt(context.request.getParameter("CASESUN1")); SqlMapClient sqlMapper = null; if (errList.isEmpty()) { try { sqlMapper = DataAccessor.getSession(); sqlMapper.startTransaction(); context.contextMap.put("logName", actLogName); sqlMapper.insert("activitiesLog.createLog", context.contextMap); // DataAccessor.execute("activitiesLog.createLog", context.contextMap, // DataAccessor.OPERATION_TYPE.INSERT); // System.out.println("actLogName11111111111="+actLogName); if (actLogName.equals(prvLogSun1)) { sqlMapper.update("activitiesLog.updateCaseStateByVisitFactoryDate", context.contextMap); } else if (actLogName.equals(prvLogSun2)) { sqlMapper.update("activitiesLog.updateCaseStateByVisitFirst", context.contextMap); } else { sqlMapper.update("activitiesLog.updateCaseState", context.contextMap); } sqlMapper.commitTransaction(); } catch (Exception e) { e.printStackTrace(); LogPrint.getLogStackTrace(e, logger); errList.add("活动日志管理--新建主档明细错误!请联系管理员"); } finally { try { sqlMapper.endTransaction(); } catch (SQLException e) { e.printStackTrace(); LogPrint.getLogStackTrace(e, logger); errList.add("活动日志管理--新建主档明细错误!请联系管理员"); } } } if (errList.isEmpty()) { Output.jspSendRedirect(context, "defaultDispatcher?__action=activitiesLog.query"); } else { outputMap.put("errList", errList); Output.jspOutput(outputMap, context, "/error.jsp"); } }
/** * This method was generated by Apache iBATIS ibator. This method corresponds to the database * table playlist_songs * * @ibatorgenerated Thu Oct 22 12:34:10 CDT 2009 */ public void insert(PlaylistSongs record) throws SQLException { sqlMapClient.insert("playlist_songs.ibatorgenerated_insert", record); }