Package evolaris.framework.sys.business.exception

Examples of evolaris.framework.sys.business.exception.InputException


  public ActionForward addArticle(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    BlogArticleForm f = (BlogArticleForm)form;
    BlogManager blogMgr = new BlogManager(locale, session);
    Blog blog = blogMgr.getBlog(f.getBlogId());
    if (blog == null) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.BlogNotFound", f.getBlogId(), ""));
    }
    Set<Long> permissions = getPermissions(blog, webUser);
    if (!permissions.contains(PermissionManager.WRITE_PERMISSION)) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
    }
    Article article = new Article();
    article.setTitle(f.getTitle());
    article.setContent(f.getContent());
    article.setAuthor(webUser);
View Full Code Here


 


  public ActionForward editArticle(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    if (webUser == null){
      throw new InputException(getResources(req).getMessage(locale, "blog.AnonymousEditingNotAllowed"));
    }
    BlogArticleForm f = (BlogArticleForm)form;
    BlogManager blogMgr = new BlogManager(locale, session);
    String idParam = req.getParameter("id");
   
    Article article = blogMgr.getArticle(Long.parseLong(idParam));
    if (article == null) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.ArticleNotFound", idParam));
    }
    Blog blog = blogMgr.getBlog(article.getBlog().getId())// fetch blog, so we have it after session is closed
    Set<Long> permissions = getPermissions(blog, webUser);
    if (!((article.getAuthor() != null && webUser.getId() == article.getAuthor().getId() && permissions.contains(PermissionManager.WRITE_PERMISSION))
        || permissions.contains(PermissionManager.EDIT_OTHERS_PERMISSION))) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
    }
    req.getSession().setAttribute("blog", blog);
    req.getSession().setAttribute("blogCode", blog.getCode())// for fckeditor ...
    req.getSession().setAttribute("labels", blog.getLabels().toArray());   
    f.setArticleId(article.getId());
View Full Code Here

    return mapping.findForward("edit");
  }

  public ActionForward modifyArticle(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    if (webUser == null){
      throw new InputException(getResources(req).getMessage(locale, "blog.AnonymousEditingNotAllowed"));
    }
    BlogArticleForm f = (BlogArticleForm)form;
    BlogManager blogMgr = new BlogManager(locale, session);
    Article article = blogMgr.getArticle(f.getArticleId());
    if (article == null) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.ArticleNotFound", f.getArticleId(), ""));
    }
    Set<Long> permissions = getPermissions(article.getBlog(), webUser);
    if (!((article.getAuthor() != null && webUser.getId() == article.getAuthor().getId() && permissions.contains(PermissionManager.WRITE_PERMISSION))
        || permissions.contains(PermissionManager.EDIT_OTHERS_PERMISSION))) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
   
    article.setTitle(f.getTitle());
    article.setContent(f.getContent());
    article.setModifiedBy(webUser);
    article.setModifiedAt(new Date());
View Full Code Here

    return injectId(mapping.findForward("modified"), f.getArticleId());
  }
 
  public ActionForward deleteArticle(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    if (webUser == null){
      throw new InputException(getResources(req).getMessage(locale, "blog.AnonymousEditingNotAllowed"));
    }
    BlogArticleForm f = (BlogArticleForm)form;
    BlogManager blogMgr = new BlogManager(locale, session);
    Article article = blogMgr.getArticle(f.getArticleId());
    if (article == null) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.ArticleNotFound", f.getArticleId(), ""));
    }
    Set<Long> permissions = getPermissions(article.getBlog(), webUser);
    if (!((article.getAuthor() != null && webUser.getId() == article.getAuthor().getId() && permissions.contains(PermissionManager.WRITE_PERMISSION))
        || permissions.contains(PermissionManager.EDIT_OTHERS_PERMISSION))) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
   
    blogMgr.deleteArticle(article);
    LOGGER.info("User "+UserManagerBase.toString(webUser)+" deleted article #"+article.getId()+" ("+article.getTitle()+", "+article.getContent()+") of blog #"+article.getBlog().getId()+" ("+article.getBlog().getName()+")");
    return injectId(mapping.findForward("deleted"), f.getBlogId());
  }
View Full Code Here

    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);
View Full Code Here

    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());
View Full Code Here

    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)
View Full Code Here

   */
  @Override
  public ActionForward execute(Exception exception, ExceptionConfig arg1, ActionMapping mapping, ActionForm arg3, HttpServletRequest req, HttpServletResponse arg5) throws ServletException {
    String userName = req.getUserPrincipal() == null ? "`ANONYMOUS USER`" : req.getUserPrincipal().getName().toLowerCase();   
    correctStrutsLocale(req);
    InputException e = (InputException) exception;
    e.generalLog(userName);
    req.setAttribute("userMessage",e.getUserMessage() == null ? "" : e.getUserMessage());
    return mapping.findForward("inputErrorPage");
  }
View Full Code Here

   
    UpcallInteractionEnterOrEditForm upcallForm = (UpcallInteractionEnterOrEditForm)form;
   
    MessageResources resources = getResources(req);
    if (upcallForm.getSortLabel() == null ||  upcallForm.getSortLabel().equals("")){
      throw new InputException(resources.getMessage(locale, "smssvc.labelMustBeProvided"));
    }
   
    if (upcallForm.getJndiName() == null || upcallForm.getJndiName().equals("")) {
      throw new InputException(resources.getMessage(locale, "smssvc.NameMustBeProvided"));
    }
   
    Group group = groupFromSession(req);
    checkAccessRights(req, group);
    UpcallCommandEntry upcallCommandEntry = new UpcallCommandEntry();
View Full Code Here

  protected ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
   
    UpcallCommandEntry commandEntry = (UpcallCommandEntry)commandEntryFromRequest(req);
    if(commandEntry == null){
      MessageResources resources = getResources(req);
      throw new InputException(resources.getMessage(locale, "smssvc.editedInteractionDoesNotExistAnymore"));
    }
    checkAccessRights(req, commandEntry.getGroup());
   
    UpcallInteractionEnterOrEditForm upcallForm = (UpcallInteractionEnterOrEditForm)form;
    upcallForm.setCommandEntryId(commandEntry.getId());
View Full Code Here

TOP

Related Classes of evolaris.framework.sys.business.exception.InputException

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.