Package evolaris.platform.smssvc.web.form

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


  /* (non-Javadoc)
   * @see evolaris.platform.smssvc.web.action.InteractionEnterOrEditBaseAction#enter(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
   */
  @Override
  protected ActionForward enter(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    SimpleInteractionEnterOrEditForm simpleInteractionForm = (SimpleInteractionEnterOrEditForm)form;
    simpleInteractionForm.setSortLabel(sortLabelProposalFromSession(req));
    simpleInteractionForm.setCommandTypeSelection(1);
    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)  {
   
    SimpleInteractionEnterOrEditForm simpleInteractionForm = (SimpleInteractionEnterOrEditForm)form;
   
    MessageResources resources = getResources(req);
    if (simpleInteractionForm.getSortLabel() == null ||  simpleInteractionForm.getSortLabel().equals("")){
      throw new InputException(resources.getMessage(locale, "smssvc.labelMustBeProvided"));
    }

    SimpleCommandEntry commandEntry = new SimpleCommandEntry();
    Group group = groupFromSession(req);
    checkAccessRights(req, group);
    commandEntry.setGroup(group);
    commandEntry.setSimpleCommandEntryType(simpleInteractionForm.getCommandTypeSelection());
    commandEntry.setSortLabel(simpleInteractionForm.getSortLabel());
    LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": Created simple command entry of type: " + simpleInteractionForm.getCommandTypeSelection());
    setCommandEntryInRequest(req, commandEntry);
    return mapping.findForward("created");
  }
View Full Code Here

  /* (non-Javadoc)
   * @see evolaris.platform.smssvc.web.action.InteractionEnterOrEditBaseAction#edit(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
   */
  @Override
  protected ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    SimpleInteractionEnterOrEditForm simpleInteractionForm = (SimpleInteractionEnterOrEditForm)form;
   
    SimpleCommandEntry commandEntry = (SimpleCommandEntry)commandEntryFromRequest(req);
    if(commandEntry == null){
      MessageResources resources = getResources(req);
      throw new InputException(resources.getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"));
    }
    checkAccessRights(req, commandEntry.getGroup());
   
    simpleInteractionForm.setCommandEntryId(commandEntry.getId());
    simpleInteractionForm.setCommandTypeSelection(commandEntry.getSimpleCommandEntryType());
    simpleInteractionForm.setSortLabel(commandEntry.getSortLabel());
   
    req.getSession().setAttribute("enterOrEdit", "edit");
    req.getSession().setAttribute("formActionPath", req.getParameter("formActionPath"));
    return mapping.findForward("edit");
  }
View Full Code Here

   *      org.apache.struts.action.ActionForm,
   *      javax.servlet.http.HttpServletRequest,
   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward modify(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp)  {
    SimpleInteractionEnterOrEditForm simpleInteractionForm = (SimpleInteractionEnterOrEditForm)form;
   
    MessageResources resources = getResources(req);
    if (simpleInteractionForm.getSortLabel() == null ||  simpleInteractionForm.getSortLabel().equals("")){
      throw new InputException(resources.getMessage(locale, "smssvc.labelMustBeProvided"));
    }
   
    long commandEntryId = simpleInteractionForm.getCommandEntryId();
    CommandEntryManager commandEntryManager = new CommandEntryManager(locale,session);
    CommandEntry commandEntry = commandEntryManager.getCommandEntry(commandEntryId);
    if (commandEntry == null || !(commandEntry instanceof SimpleCommandEntry)){
      throw new InputException(getResources(req).getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"))// may have been deleted
    }
   
    SimpleCommandEntry simpleCommandEntry = (SimpleCommandEntry)commandEntry;
    checkAccessRights(req, simpleCommandEntry.getGroup());
    commandEntryManager.evict(simpleCommandEntry)// do not modify in this session yet (might be erroneous)

    simpleCommandEntry.setSimpleCommandEntryType(simpleInteractionForm.getCommandTypeSelection());
    simpleCommandEntry.setSortLabel(simpleInteractionForm.getSortLabel());
    LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": simple command entry with id: " + commandEntryId + " has been modified");
    setCommandEntryInRequest(req, simpleCommandEntry);
    return mapping.findForward("modified");
  }
View Full Code Here

TOP

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

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.