Examples of BlogService


Examples of net.sourceforge.pebble.domain.BlogService

    assertTrue(blog.getResponseIndex().getApprovedResponses().contains(commentId));
  }

  public void testPublishBlogEntryNowAndCheckCommentsReindexed() throws Exception {
    blog.getPluginProperties().setProperty(IpAddressListener.WHITELIST_KEY, "127.0.0.1");
    BlogService service = new BlogService();
    BlogEntry blogEntry = new BlogEntry(blog);
    blogEntry.setDate(new Date(100000));
    blogEntry.setPublished(false);
    service.putBlogEntry(blogEntry);

    Comment comment = blogEntry.createComment("title", "body", "author", "email", "website", "avatar", "127.0.0.1");
    blogEntry.addComment(comment);
    service.putBlogEntry(blogEntry);

    String commentId = comment.getGuid();
    assertTrue(blog.getResponseIndex().getApprovedResponses().contains(commentId));

    // now execute the action
View Full Code Here

Examples of net.sourceforge.pebble.domain.BlogService

    assertFalse(blog.getResponseIndex().getApprovedResponses().contains(commentId));
    assertTrue(blog.getResponseIndex().getApprovedResponses().contains(blogEntry.getComments().get(0).getGuid()));
  }

  public void testUnpublishBlogEntry() throws Exception {
    BlogService service = new BlogService();
    BlogEntry blogEntry = new BlogEntry(blog);
    blogEntry.setPublished(true);
    service.putBlogEntry(blogEntry);

    // now execute the action
    request.setParameter("entry", blogEntry.getId());
    request.setParameter("submit", "Unpublish");
    View view = action.process(request, response);

    blogEntry = service.getBlogEntry(blog, blogEntry.getId());
    assertTrue(blogEntry.isUnpublished());
    assertTrue(view instanceof RedirectView);
  }
View Full Code Here

Examples of net.sourceforge.pebble.domain.BlogService

    String entry = request.getParameter("entry");
    String rememberMe = request.getParameter("rememberMe");
    String submitType = request.getParameter("submit");

    BlogService service = new BlogService();
    try {
      blogEntry = service.getBlogEntry(blog, entry);
    } catch (BlogServiceException e) {
      throw new ServletException(e);
    }
    if (blogEntry == null) {
      // just send back a 404 - this is probably somebody looking for a way
View Full Code Here

Examples of net.sourceforge.pebble.domain.BlogService

    Blog blog = (Blog)getModel().get(Constants.BLOG_KEY);
    String entryId = request.getParameter("entry");

    BlogEntry blogEntry = null;
    if (entryId != null) {
      BlogService service = new BlogService();
      try {
        blogEntry = service.getBlogEntry(blog, entryId);
      } catch (BlogServiceException e) {
        throw new ServletException(e);
      }
    }
View Full Code Here

Examples of net.sourceforge.pebble.domain.BlogService

        entry.addCategory(category);
      }
    }
    entry.setPublished("Publish".equals(status));

    BlogService service = new BlogService();
    service.putBlogEntry(entry);

    line = reader.readLine();
    while (!line.equals("--------")) {
      if (line.equals("COMMENT:")) {
        String commentAuthor = reader.readLine().substring("AUTHOR: ".length());
        String commentEmail = reader.readLine().substring("EMAIL: ".length());
        String commentIpAddress = reader.readLine().substring("IP: ".length());
        String commentUrl = reader.readLine().substring("URL: ".length());
        Date commentDate = sdf.parse(reader.readLine().substring("DATE: ".length()));

        StringBuffer commentBody = new StringBuffer();
        String commentBodyLine = reader.readLine();
        while (!commentBodyLine.equals("-----")) {
          commentBody.append(commentBodyLine);
          commentBodyLine = reader.readLine();
          if (!commentBodyLine.equals("-----")) {
            commentBody.append("<br />");
          }
        }

        Comment comment = entry.createComment(null, commentBody.toString(), commentAuthor, commentEmail, commentUrl, "", commentIpAddress, commentDate, State.APPROVED);
        entry.addComment(comment);
      } else if (line.equals("PING:")) {
        String pingTitle = reader.readLine().substring("TITLE: ".length());
        String pingUrl = reader.readLine().substring("URL: ".length());
        String pingIpAddress = reader.readLine().substring("IP: ".length());
        String pingBlogName = reader.readLine().substring("BLOG NAME: ".length());
        Date pingDate = sdf.parse(reader.readLine().substring("DATE: ".length()));

        StringBuffer pingBody = new StringBuffer();
        String pingBodyLing = reader.readLine();
        while (!pingBodyLing.equals("-----")) {
          pingBody.append(pingBodyLing);
          pingBodyLing = reader.readLine();
          if (!pingBodyLing.equals("-----")) {
            pingBody.append("<br />");
          }
        }

        TrackBack trackBack = entry.createTrackBack(pingTitle, pingBody.toString(), pingUrl, pingBlogName, pingIpAddress, pingDate, State.APPROVED);
        entry.addTrackBack(trackBack);
      }
      line = reader.readLine();
    }

    service.putBlogEntry(entry);

//    System.out.println("--------------------------------------------------");
    System.out.print(".");

    return entry;
View Full Code Here

Examples of net.sourceforge.pebble.domain.BlogService

    BlogEntry entry = new BlogEntry(blog);
    entry.setTitle(title);
    entry.setBody(body);
    entry.setDate(date);

    BlogService service = new BlogService();
    service.putBlogEntry(entry);
  }
View Full Code Here

Examples of net.sourceforge.pebble.domain.BlogService

            } else {
                result.sortByScoreDescending();
            }

            List<SearchHit> hits = result.getHits();
            BlogService service = new BlogService();

            for (SearchHit hit : hits) {
                BlogEntry entry = service.getBlogEntry(hit.getBlog(), hit.getId());
                adaptBlogEntry(entry);
                posts.add(adaptBlogEntry(entry));
            }
            posts.add( searchResultSummary(hits, sortBy, searchString, 0, 0) );
View Full Code Here

Examples of net.sourceforge.pebble.domain.BlogService

            Pageable pageable = new Pageable(hits);
            pageable.setPageSize(pageSize);
            pageable.setPage(offset);
            List<SearchHit> subList = pageable.getListForPage();

            BlogService service = new BlogService();

            for (SearchHit hit : subList ) {
                BlogEntry entry = service.getBlogEntry(hit.getBlog(), hit.getId());
                adaptBlogEntry(entry);
                posts.add(adaptBlogEntry(entry));
            }
            posts.add( searchResultSummary(subList, sortBy, searchString, pageSize, offset) );
View Full Code Here

Examples of net.sourceforge.pebble.domain.BlogService

        "********)");

    Blog blog = getBlogWithPostId(postid);
    postid = getPostId(postid);
    authenticate(blog, username, password);
    BlogService service = new BlogService();
    BlogEntry entry = null;
    try {
      entry = service.getBlogEntry(blog, postid);
    } catch (BlogServiceException e) {
      throw new XmlRpcException(0, "Blog entry with ID of " + postid + " could not be loaded");
    }

    if (entry != null) {
View Full Code Here

Examples of net.sourceforge.pebble.domain.BlogService

      }

      populateEntry(entry, struct, username);
      entry.setPublished(publish);

      BlogService service = new BlogService();
      service.putBlogEntry(entry);

      return formatPostId(blogid, entry.getId());
    } catch (BlogServiceException be) {
      throw new XmlRpcException(0, be.getMessage());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.