Package evolaris.platform.smssvc.web.form

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


   *      org.apache.struts.action.ActionForm,
   *      javax.servlet.http.HttpServletRequest,
   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward enter(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    BreakInteractionEnterOrEditForm breakInteractionEnterOrEditForm = (BreakInteractionEnterOrEditForm)form;
    breakInteractionEnterOrEditForm.setSortLabel(sortLabelProposalFromSession(req));
    breakInteractionEnterOrEditForm.setTypeOfBreak(0);
    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) {

    BreakInteractionEnterOrEditForm breakInteractionEnterOrEditForm = (BreakInteractionEnterOrEditForm)form;

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

    BreakCommandEntry commandEntry = new BreakCommandEntry();
    Group group = groupFromSession(req);
    checkAccessRights(req, group);
    commandEntry.setGroup(group);
    commandEntry.setResultString(breakInteractionEnterOrEditForm.getResultString().length() == 0 ? null : breakInteractionEnterOrEditForm.getResultString())// empty input => null
    commandEntry.setSortLabel(breakInteractionEnterOrEditForm.getSortLabel());
    commandEntry.setTypeOfBreak(breakInteractionEnterOrEditForm.getTypeOfBreak());
    LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": Created break entry with result value: `" + breakInteractionEnterOrEditForm.getResultString() + "`");
    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) {

    BreakInteractionEnterOrEditForm breakInteractionEnterOrEditForm = (BreakInteractionEnterOrEditForm)form;

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

    breakInteractionEnterOrEditForm.setCommandEntryId(commandEntry.getId());
    breakInteractionEnterOrEditForm.setResultString(commandEntry.getResultString()==null?"":commandEntry.getResultString());
    breakInteractionEnterOrEditForm.setSortLabel(commandEntry.getSortLabel());
    breakInteractionEnterOrEditForm.setTypeOfBreak(commandEntry.getTypeOfBreak());

    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)  {

    BreakInteractionEnterOrEditForm breakInteractionEnterOrEditForm = (BreakInteractionEnterOrEditForm)form;

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


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

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

    breakCommandEntry.setSortLabel(breakInteractionEnterOrEditForm.getSortLabel());
    breakCommandEntry.setResultString(breakInteractionEnterOrEditForm.getResultString().length() == 0?null:breakInteractionEnterOrEditForm.getResultString());
    breakCommandEntry.setTypeOfBreak(breakInteractionEnterOrEditForm.getTypeOfBreak());
    LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": Break  entry #" + commandEntryId + " has been modified to result value: " + breakCommandEntry.getResultString());
    setCommandEntryInRequest(req, breakCommandEntry);
    return mapping.findForward("modified");
  }
View Full Code Here

TOP

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

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.