コード例 #1
0
 /**
  * Delete an element Only id can be used to find which element must be deleted.
  *
  * @param user Element which will be deleted.
  * @throws DaoException If an HibernateException occurs.
  * @see org.obeonetwork.sample.demo.weblogng.users.IUserDao.deleteUser
  */
 public void deleteUser(User user) throws DaoException {
   LOG.debug("Delete the entity User with id =" + user.getId());
   try {
     getHibernateTemplate().delete(user);
     getHibernateTemplate().flush();
   } catch (HibernateException e) {
     throw new DaoException(e);
   }
 }
コード例 #2
0
  /**
   * Process the specified HTTP request for <strong>validate</strong> event.
   *
   * @param mapping The ActionMapping used to select this instance
   * @param form The optional ActionForm bean for this request (if any)
   * @param request The HTTP request we are processing
   * @param response The HTTP response we are creating
   * @exception Exception if an input/output error or servlet exception occurs
   */
  public ActionForward validate(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    LOG.debug("Starting validate");
    String returnCode = PAGE_SELF;
    CreateAccountForm createAccountForm = (CreateAccountForm) form;

    // Start of user code method validate
    User user = new User();
    user.setLogin(createAccountForm.getLogin());
    user.setPassword(createAccountForm.getPassword());
    user.setFirstName(createAccountForm.getFirstName());
    user.setLastName(createAccountForm.getLastName());
    user.setEmail(createAccountForm.getEmail());
    userService.createUser(user);
    returnCode = PAGE_LOGIN;
    // End of user code

    LOG.debug("End validate");
    return mapping.findForward(returnCode);
  }