Package evolaris.platform.smssvc.web.form

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


   *      org.apache.struts.action.ActionForm,
   *      javax.servlet.http.HttpServletRequest,
   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward enter(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    HttpInteractionEnterOrEditForm f = (HttpInteractionEnterOrEditForm)form;
    f.setSortLabel(sortLabelProposalFromSession(req));
    Group group = groupFromSession(req);
    checkAccessRights(req, group);
    req.getSession().setAttribute("enterOrEdit", "enter");
    req.getSession().setAttribute("formActionPath", req.getParameter("formActionPath"));
    req.getSession().setAttribute("templates",getSortedCommandEntries(req));
View Full Code Here


   *      org.apache.struts.action.ActionForm,
   *      javax.servlet.http.HttpServletRequest,
   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward create(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    HttpInteractionEnterOrEditForm f = (HttpInteractionEnterOrEditForm)form;
    MessageResources resources = getResources(req);
    if (f.getSortLabel() == null ||  f.getSortLabel().equals("")) {
      throw new InputException(resources.getMessage(locale, "smssvc.labelMustBeProvided"));
    }
   
    HttpCommandEntry commandEntry = new HttpCommandEntry();
    Group group = groupFromSession(req);
    checkAccessRights(req, group);
    commandEntry.setGroup(group);
    commandEntry.setSortLabel(f.getSortLabel());
    commandEntry.setUrl(f.getUrl());
    commandEntry.setNofEvaluatedResponseLetters(Integer.parseInt(f.getNofEvaluatedResponseLetters()));
    LOGGER.info("User " + UserManagerBase.toString(webUser) + ": Created new http interaction");
    setCommandEntryInRequest(req, commandEntry);
    return mapping.findForward("created");
  }
View Full Code Here

    setCommandEntryInRequest(req, commandEntry);
    return mapping.findForward("created");
  }

  public ActionForward edit(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp) {
    HttpInteractionEnterOrEditForm f = (HttpInteractionEnterOrEditForm)form;
   
    HttpCommandEntry commandEntry = (HttpCommandEntry)commandEntryFromRequest(req);
    if(commandEntry == null){
      throw new InputException(getResources(req).getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"));
    }
    checkAccessRights(req, commandEntry.getGroup());
   
    f.setCommandEntryId(commandEntry.getId());
    f.setSortLabel(commandEntry.getSortLabel());
    f.setUrl(commandEntry.getUrl());
    f.setNofEvaluatedResponseLetters(commandEntry.getNofEvaluatedResponseLetters() + "");
    req.getSession().setAttribute("enterOrEdit", "edit");
    req.getSession().setAttribute("groupId", commandEntry.getGroup().getId()); // the groupId is used by the method getSortedCommandEntries
    req.getSession().setAttribute("formActionPath", req.getParameter("formActionPath"));
    TreeSet<CommandEntry> sortedCommandEntries = getSortedCommandEntries(req);
    req.getSession().setAttribute("templates",sortedCommandEntries);
   
    Long selectedTemplateId = f.getTemplateId();
    f.setTemplateId(-1L)// none selected
    if (selectedTemplateId != null && selectedTemplateId != -1){
      // only use the selected template if it is assigned to the selected group
      for (CommandEntry entry : sortedCommandEntries) {
        if (entry.getId() == selectedTemplateId) {
          applyTemplate((HttpCommandEntry)entry, f);
View Full Code Here

   *      org.apache.struts.action.ActionForm,
   *      javax.servlet.http.HttpServletRequest,
   *      javax.servlet.http.HttpServletResponse)
   */
  protected ActionForward defaultMethod(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    HttpInteractionEnterOrEditForm httpForm = (HttpInteractionEnterOrEditForm)form;
   
    if(httpForm.getCommandEntryId() == 0){ // 0 means that the command entry doesn't exist in the database
      Long selectedTemplateId = httpForm.getTemplateId();
      httpForm.setTemplateId(-1L)// none selected
      if (selectedTemplateId != null && selectedTemplateId != -1){
        // only use the selected template if it is assigned to the selected group
        TreeSet<CommandEntry> sortedCommandEntries = getSortedCommandEntries(req);
        for (CommandEntry entry : sortedCommandEntries) {
          if (entry.getId() == selectedTemplateId) {
            applyTemplate((HttpCommandEntry)entry, httpForm);
            break;
          }
        }
      }
      return enter(mapping, form, req, resp);
     
    } else {
      req.setAttribute("commandEntryId",httpForm.getCommandEntryId());
      return mapping.findForward("updated");
    }
  }
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)  {
    HttpInteractionEnterOrEditForm f = (HttpInteractionEnterOrEditForm)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 HttpCommandEntry)){
      throw new InputException(getResources(req).getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"))// may have been deleted
    }
   
    HttpCommandEntry httpCommandEntry = (HttpCommandEntry)commandEntry;
    checkAccessRights(req, httpCommandEntry.getGroup());
    commandEntryManager.evict(httpCommandEntry)// do not modify in this session yet (might be erroneous)

    httpCommandEntry.setSortLabel(f.getSortLabel());
    httpCommandEntry.setUrl(f.getUrl());
    httpCommandEntry.setNofEvaluatedResponseLetters(Integer.parseInt(f.getNofEvaluatedResponseLetters()))
    LOGGER.info("User " + UserManagerBase.toString(webUser) + ": http interaction entry with id: " + commandEntryId + " has been modified");
    setCommandEntryInRequest(req, httpCommandEntry);
    return mapping.findForward("modified");
  }
View Full Code Here

TOP

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

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.