Package evolaris.platform.smssvc.web.form

Examples of evolaris.platform.smssvc.web.form.CommentInteractionEnterOrEditForm


   *      org.apache.struts.action.ActionForm,
   *      javax.servlet.http.HttpServletRequest,
   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward enter(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    CommentInteractionEnterOrEditForm f = (CommentInteractionEnterOrEditForm)form;
    f.setSortLabel(sortLabelProposalFromSession(req));
    req.getSession().setAttribute("enterOrEdit", "enter");
    req.getSession().setAttribute("formActionPath", req.getParameter("formActionPath"));
    return mapping.findForward("enter");
  }
View Full Code Here


   *      javax.servlet.http.HttpServletRequest,
   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward create(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {

    CommentInteractionEnterOrEditForm f = (CommentInteractionEnterOrEditForm)form;

    MessageResources resources = getResources(req);
    if (f.getSortLabel() == null ||  f.getSortLabel().equals("")){
      throw new InputException(resources.getMessage(locale, "smssvc.labelMustBeProvided"));
    }

    CommentCommandEntry commandEntry = new CommentCommandEntry();
    Group group = groupFromSession(req);
    checkAccessRights(req, group);
    commandEntry.setGroup(group);
    commandEntry.setDescription(f.getComment().length() == 0 ? null : f.getComment())// empty input => null
    commandEntry.setSortLabel(f.getSortLabel());
    LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": Created comment entry with comment value: `" + f.getComment() + "`");
    setCommandEntryInRequest(req, commandEntry);
    return mapping.findForward("created");
  }
View Full Code Here

    return mapping.findForward("created");
  }

  public ActionForward edit(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp) {

    CommentInteractionEnterOrEditForm f = (CommentInteractionEnterOrEditForm)form;

    CommentCommandEntry commandEntry = (CommentCommandEntry)commandEntryFromRequest(req);
    if(commandEntry == null){
      MessageResources resources = getResources(req);
      throw new InputException(resources.getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"));
    }
    checkAccessRights(req, commandEntry.getGroup());

    f.setCommandEntryId(commandEntry.getId());
    f.setComment(commandEntry.getDescription()==null?"":commandEntry.getDescription());
    f.setSortLabel(commandEntry.getSortLabel());

    req.getSession().setAttribute("enterOrEdit", "edit");
    req.getSession().setAttribute("formActionPath", req.getParameter("formActionPath"));
    return mapping.findForward("edit");
  }
View Full Code Here

   *      javax.servlet.http.HttpServletRequest,
   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward modify(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp)  {

    CommentInteractionEnterOrEditForm f = (CommentInteractionEnterOrEditForm)form;

    MessageResources resources = getResources(req);
    if (f.getSortLabel() == null ||  f.getSortLabel().equals("")){
      throw new InputException(resources.getMessage(locale, "smssvc.labelMustBeProvided"));
    }


    long commandEntryId = f.getCommandEntryId();
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    CommandEntry commandEntry = commandEntryManager.getCommandEntry(commandEntryId);
    if (commandEntry == null || !(commandEntry instanceof CommentCommandEntry)){
      throw new InputException(getResources(req).getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"))// may have been deleted
    }

    CommentCommandEntry commentCommandEntry = (CommentCommandEntry)commandEntry;
    checkAccessRights(req, commentCommandEntry.getGroup());
    commandEntryManager.evict(commentCommandEntry)// do not modify in this session yet (might be erroneous)

    commentCommandEntry.setSortLabel(f.getSortLabel());
    commentCommandEntry.setDescription(f.getComment().length() == 0?null:f.getComment());
    LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": comment entry #" + commandEntryId + " has been modified to comment value: " + commentCommandEntry.getDescription());
    setCommandEntryInRequest(req, commentCommandEntry);
    return mapping.findForward("modified");
  }
View Full Code Here

TOP

Related Classes of evolaris.platform.smssvc.web.form.CommentInteractionEnterOrEditForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.