Package evolaris.framework.blog.datamodel

Examples of evolaris.framework.blog.datamodel.Blog


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


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

  private List<Blog> getBlogList(Group group) {
    BlogManager blogMgr = new BlogManager(locale, session);
    List<Blog> blogs = blogMgr.getBlogs(group);
    for (Iterator<Blog> it = blogs.iterator(); it.hasNext(); ) {
      Blog b = it.next();
      if (b.getCode().startsWith("personalblog_")) {
        it.remove();
      }
    }
    Collections.sort(blogs, new Comparator<Blog>() {
      public int compare(Blog o1, Blog o2) {
View Full Code Here

    Comment comment = blogMgr.getComment(Long.parseLong(idParam));
    if (comment == null) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.CommentNotFound", idParam));
    }
   
    Blog blog = blogMgr.getBlog(comment.getArticle().getBlog().getId());
    Set<Long> permissions = getPermissions(blog, webUser);
    if (!permissions.contains(PermissionManager.READ_PERMISSION)) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
    }
   
View Full Code Here

    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());
    Set<Long> permissions = getPermissions(blog, webUser);
    if (!permissions.contains(PermissionManager.READ_PERMISSION)) {
      throw new InputException(getLocalizedMessage("BloggingWeb", "blog.insufficientRights"));
    }
    req.setAttribute("blog", blog);
    req.getSession().setAttribute("blogCode", blog.getCode())// for fckeditor ...
    DisplayableArticle da = new DisplayableArticle(article, true);
    if (da.getTitle() == null || da.getTitle().trim().length()==0) {
      da.setTitle(getLocalizedMessage("BloggingWeb", "blog.noTitle"));
    }
    req.setAttribute("article", da);
    // anonymous users must not edit existing entries,
    // users with WRITE permission may edit their own articles only,
    // users with EDIT_OTHERS permission may also edit articles of others   
    req.setAttribute("mayEditArticle", webUser != null && ((article.getAuthor() != null && webUser.getId() == article.getAuthor().getId() && permissions.contains(PermissionManager.WRITE_PERMISSION)) ||  permissions.contains(PermissionManager.EDIT_OTHERS_PERMISSION)));
    req.setAttribute("mayAddComment", permissions.contains(PermissionManager.ADD_COMMENT_PERMISSION));
    if (article.getAuthor() != null) {
      session.load(User.class, article.getAuthor().getId());
    }
    List<DisplayableComment> comments = new ArrayList<DisplayableComment>();
    for (Comment c : article.getComments()) {
      if(viewReleasedCommentsOnly && c.getReviewStatus() != 1){
       
      } else {
        DisplayableComment dc = new DisplayableComment(c);
        comments.add(dc);
      }
    }
    da.setCommentCount(comments.size());
    req.setAttribute("commentList", comments);
    req.setAttribute("dateArchiveList", blogMgr.getArchives(blog));
    req.setAttribute("labelCloud", blogMgr.getLabelCloud(blog, webUser, null, 20));
    req.setAttribute("previousarticle", blogMgr.getPreviousArticle(article));   
    req.setAttribute("nextarticle", blogMgr.getNextArticle(article));
   
    try {
      req.setAttribute("articleRssUrl", getBaseUrl(req)+"/viewBlog.do?method=rss&id="+blog.getId());
      req.setAttribute("commentRssUrl", getBaseUrl(req)+"/viewBlog.do?method=commentrss&id="+blog.getId());
    } catch (Exception e) {
      LOGGER.error("Failure creating rssUrls: "+e.getMessage(), e);
    }
    return mapping.findForward("view");
  }
View Full Code Here

    // blogs

    BlogManager blogManager = new BlogManager(locale, session);
    long[] sourceBlogIds = f.getSourceBlogIds();
    if (sourceBlogIds != null) {  // at least one mapping
      Blog personalBlog = new Blog();
      personalBlog.setId(-99);
      personalBlog.setName(this.getResources(req).getMessage("smssvc.personalBlog"));
      long[] selectedBlogIds = f.getSelectedBlogIds();
      for (int i = 0; i < sourceBlogIds.length; i++){
        long sourceBlogId = sourceBlogIds[i];
        Blog sourceBlog = sourceBlogId == -99 ? personalBlog : blogManager.getBlog(sourceBlogId);
        if (sourceBlog == null){
          throw new InputException(getResources(req).getMessage(locale, "smssvc.SourceBlogNotAvailableAnymore"),"blog #" + sourceBlogId + " not found",null,null);
        }
        if (sourceBlog.getId() != -99) {
          checkAccessRights(req, sourceBlog.getGroup());
        }
        long selectedBlogId = selectedBlogIds[i];
        if (selectedBlogId != -99 && selectedBlogId <= 0) {
          throw new InputException(getResources(req).getMessage(locale, "smssvc.BlogMappingSelectionMissing"),"sourceBlogId = " + sourceBlogId,null,null);
        }
        Blog selectedBlog = selectedBlogId == -99 ? personalBlog : blogManager.getBlog(selectedBlogId);
        if (selectedBlog == null) {
          throw new InputException(getResources(req).getMessage(locale, "smssvc.SelectedBlogNotAvaliableAnymore"),"blog #" + selectedBlogId + " not found",null,null);
        }
        if (selectedBlogId != -1) {
          checkAccessRights(req,selectedBlog.getGroup());
        }
        mappingSet.add(new Entry(sourceBlog), new Entry(selectedBlog));
      }
    }       
   
View Full Code Here

    HibernateSessions.finishTransaction(session,this.getClass());   
  }
 
  public void _testArchives() {
    GroupManager grp = new GroupManager(Locale.getDefault(), session);
    Blog b = mgr.getBlog("tstblg1", grp.getGroup("administrator"));
    List<Date> a = mgr.getArchives(b);
    System.out.println(a.size());
  }
View Full Code Here

    System.out.println(a.size());
  }
 
  public void _testAddLabel() {
    GroupManager grp = new GroupManager(Locale.getDefault(), session);
    Blog b = mgr.getBlog("tstblg1", grp.getGroup("administrator"));
    Article a = b.getArticles().iterator().next();
    mgr.setLabels(a, "test");
    for (Label l : a.getLabels()) {
      System.out.println(l.getLabel());
      for (Article aa : l.getArticles()) {
        System.out.println("--"+aa.getTitle());
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  public void _testgetByLabel() {
    GroupManager grp = new GroupManager(Locale.getDefault(), session);
    Blog b = mgr.getBlog("tstblg1", grp.getGroup("administrator"));
    Label lab = mgr.getLabel(b, "demo");
    Collection l = mgr.getArchivedArticles(b, lab);
    assertNotNull(l);
  }
View Full Code Here

  }
 
  @SuppressWarnings("unchecked")
  public void _testgetUnlabelled() {
    GroupManager grp = new GroupManager(Locale.getDefault(), session);
    Blog b = mgr.getBlog("tstblg1", grp.getGroup("administrator"));
    Collection l = mgr.getUnlabelledArticles(b);
    assertNotNull(l);
  }
View Full Code Here

TOP

Related Classes of evolaris.framework.blog.datamodel.Blog

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.