Package evolaris.platform.smssvc.web.form

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


   *      org.apache.struts.action.ActionForm,
   *      javax.servlet.http.HttpServletRequest,
   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward enter(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    BlogInteractionEnterOrEditForm f = (BlogInteractionEnterOrEditForm)form;
    f.setSortLabel(sortLabelProposalFromSession(req));
    Group group = groupFromSession(req);
    checkAccessRights(req, group);
    List<Blog> blogList = getBlogList(group);
    f.setTitle("${subject}");
    f.setContent("${attachment}<br />${content}");
    req.getSession().setAttribute("blogList", blogList);
    req.getSession().setAttribute("enterOrEdit", "enter");
    req.getSession().setAttribute("formActionPath", req.getParameter("formActionPath"));
    return mapping.findForward("enter");
  }
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) {
    BlogInteractionEnterOrEditForm f = (BlogInteractionEnterOrEditForm)form;
    MessageResources resources = getResources(req);
    if (f.getSortLabel() == null ||  f.getSortLabel().equals("")) {
      throw new InputException(resources.getMessage(locale, "smssvc.labelMustBeProvided"));
    }
   
    BlogCommandEntry commandEntry = new BlogCommandEntry();
    Group group = groupFromSession(req);
    checkAccessRights(req, group);
    commandEntry.setGroup(group);
    if (f.getBlogId() > 0) {
      BlogManager blogMgr = new BlogManager(locale, session);
      Blog blog = blogMgr.getBlog(f.getBlogId());
      if (blog == null) {
        throw new InputException(resources.getMessage(locale, "smssvc.selectedBlogNotFound"));
      }
      commandEntry.setBlog(blog);
    } else {
      commandEntry.setBlog(null);
    }
    commandEntry.setTitle(f.getTitle());
    commandEntry.setContent(f.getContent());
    commandEntry.setTags(f.getTags());
    commandEntry.setSortLabel(f.getSortLabel());
    commandEntry.setMaxImageWidth((f.getMaxImageWidth()==null || f.getMaxImageWidth().trim().length() == 0)?null:Integer.parseInt(f.getMaxImageWidth()));
   
    LOGGER.info("User " + UserManagerBase.toString(webUser) + ": Created new blog 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) {
    BlogInteractionEnterOrEditForm f = (BlogInteractionEnterOrEditForm)form;
   
    BlogCommandEntry commandEntry = (BlogCommandEntry)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.setBlogId(commandEntry.getBlog() == null ? 0 : commandEntry.getBlog().getId());
    f.setSortLabel(commandEntry.getSortLabel());
    f.setTags(commandEntry.getTags());
    f.setTitle(commandEntry.getTitle());
    f.setContent(commandEntry.getContent());
    f.setMaxImageWidth(commandEntry.getMaxImageWidth()==null?null:commandEntry.getMaxImageWidth().toString());
   
    List<Blog> blogList = getBlogList(commandEntry.getGroup());
    req.getSession().setAttribute("blogList", blogList);   
    req.getSession().setAttribute("enterOrEdit", "edit");
    req.getSession().setAttribute("formActionPath", req.getParameter("formActionPath"));
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)  {
    BlogInteractionEnterOrEditForm f = (BlogInteractionEnterOrEditForm)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 BlogCommandEntry)){
      throw new InputException(getResources(req).getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"))// may have been deleted
    }
   
    BlogCommandEntry blogCommandEntry = (BlogCommandEntry)commandEntry;
    checkAccessRights(req, blogCommandEntry.getGroup());
    commandEntryManager.evict(blogCommandEntry)// do not modify in this session yet (might be erroneous)

    blogCommandEntry.setSortLabel(f.getSortLabel());
    if (f.getBlogId() > 0) {
      BlogManager blogMgr = new BlogManager(locale, session);
      Blog blog = blogMgr.getBlog(f.getBlogId());
      if (blog == null) {
        throw new InputException(resources.getMessage(locale, "smssvc.selectedBlogNotFound"));
      }     
      blogCommandEntry.setBlog(blog);
    } else {
      blogCommandEntry.setBlog(null);
    }
    blogCommandEntry.setTags(f.getTags());
    blogCommandEntry.setTitle(f.getTitle());
    blogCommandEntry.setContent(f.getContent())
    blogCommandEntry.setMaxImageWidth(f.getMaxImageWidth()==null||f.getMaxImageWidth().length()==0?null:Integer.parseInt(f.getMaxImageWidth()));
    LOGGER.info("User " + UserManagerBase.toString(webUser) + ": blog interaction entry with id: " + commandEntryId + " has been modified");
    setCommandEntryInRequest(req, blogCommandEntry);
    return mapping.findForward("modified");
  }
View Full Code Here

TOP

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

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.