コード例 #1
0
 private HashMap<String, HashMap<String, Object>> updateProc(
     HashMap<String, Object> params, HttpServletRequest request, Session session, Login login)
     throws Exception {
   @SuppressWarnings("unused")
   String screen = request.getParameter("screen");
   Map<String, Object> updateInput = preProc(params);
   UserTable upd = null;
   try {
     upd = BeanUtil.copyMapToNewBean(updateInput, UserTable.class);
   } catch (Exception e) {
     ServiceUtil.mapToNewBeanExceptionAnalyze(e);
   }
   UserTable dbUserTable = em.find(UserTable.class, upd.getId());
   if (dbUserTable == null) {
     throw new SystemException("id:" + upd.getId().toString() + " が見つかりません");
   }
   if (!(upd.getTableName().equals(dbUserTable.getTableName())
           && upd.getKey1().equals(dbUserTable.getKey1())
           && upd.getKey2().equals(dbUserTable.getKey2()))
       && userTableCodeDupCheck(upd)) {
     return DBFluteUtil.setErrorMessage("このDataは既に使用されています。", params);
   }
   BeanUtil.copyBeanToBean(upd, dbUserTable, CopyOptionsUtil.excludeNull());
   em.merge(dbUserTable);
   Map<String, Object> map = null;
   map = entityToMap(upd);
   return DBFluteUtil.setFetchResult(map, params);
 }