Package org.uned.agonzalo16.bitacora.domain

Examples of org.uned.agonzalo16.bitacora.domain.Message


    return "redirect:/article/" + article.getId();
  }

  @RequestMapping(method = RequestMethod.GET, value = "/openComments/{id}")
  public String openComments(@PathVariable("id") Long id) {
    Article article = articleDao.get(id);
    article.setOpenComments(true);
    articleDao.merge(article);
    return "redirect:/contributor/article/beginUpdate/" + id;
  }
View Full Code Here


    return "redirect:/contributor/article/beginUpdate/" + id;
  }

  @RequestMapping(method = RequestMethod.GET, value = "/closeComments/{id}")
  public String closeComments(@PathVariable("id") Long id) {
    Article article = articleDao.get(id);
    article.setOpenComments(false);
    articleDao.merge(article);
    return "redirect:/contributor/article/beginUpdate/" + id;
  }
View Full Code Here

    if (result.hasErrors()) {
      return "contributor/article/create";
    }

    Article article = articleDao.get(form.getArticleId());

    Comment comment = new Comment();
    comment.setContent(form.getContent());
    comment.setCreationDate(new Date());
    comment.setArticle(article);
View Full Code Here

  @Test
  public void testFidByBlog() {
    Blog blog1 = createBlog();
    Blog blog2 = createBlog();
    for (int i = 0; i < 10; i++) {
      Article article = new Article();
      article.setTitle("title " + i);
      article.setCreationDate(new Date());
      article.setText("text " + i);
      article.setOpenComments(true);
      article.setBlog(blog1);
      article.setUser(createUser());

      articleDao.merge(article);
    }

    for (int i = 10; i < 30; i++) {
      Article article = new Article();
      article.setTitle("title " + i);
      article.setCreationDate(new Date());
      article.setText("text " + i);
      article.setOpenComments(true);
      article.setBlog(blog2);
      article.setUser(createUser());

      articleDao.merge(article);
    }

    List<Article> blog1Articles = articleDao.findByBlog(blog1);
View Full Code Here

  @Test
  public void testDeleteBlogWithArticles() {
    Blog blog1 = createBlog();
    Blog blog2 = createBlog();
    for (int i = 0; i < 10; i++) {
      Article article = new Article();
      article.setTitle("title " + i);
      article.setCreationDate(new Date());
      article.setText("text " + i);
      article.setOpenComments(true);
      article.setBlog(blog1);

      articleDao.merge(article);
    }

    for (int i = 10; i < 30; i++) {
      Article article = new Article();
      article.setTitle("title " + i);
      article.setCreationDate(new Date());
      article.setText("text " + i);
      article.setOpenComments(true);
      article.setBlog(blog2);

      articleDao.merge(article);
    }

    assertEquals("30 articles", articleDao.findAll().size(), 30);
View Full Code Here

  public void testFidByUser() {
    Blog blog = createBlog();
    User user1 = createUser();
    User user2 = createUser();
    for (int i = 0; i < 10; i++) {
      Article article = new Article();
      article.setTitle("title " + i);
      article.setCreationDate(new Date());
      article.setText("text " + i);
      article.setOpenComments(true);
      article.setBlog(blog);
      article.setUser(user1);

      articleDao.merge(article);
    }

    for (int i = 10; i < 30; i++) {
      Article article = new Article();
      article.setTitle("title " + i);
      article.setCreationDate(new Date());
      article.setText("text " + i);
      article.setOpenComments(true);
      article.setBlog(blog);
      article.setUser(user2);

      articleDao.merge(article);
    }

    List<Article> user1Articles = articleDao.findByUser(user1);
View Full Code Here

    ofy().save().entity(article).now();
    return article;
  }

  public void delete(Long id) {
    Article article = get(id);
    List<Key<Comment>> comments = ofy().load().type(Comment.class).ancestor(article).keys().list();
    ofy().delete().type(Article.class).id(id).now();
    ofy().delete().keys(comments).now();
  }
View Full Code Here

    if (result.hasErrors()) {
      return "blog/create";
    }

    Blog blog = new Blog();
    blog.setCreationDate(new Date());
    blog.setDescription(form.getDescription());
    blog.setName(form.getName());

    blogDao.merge(blog);
    searchService.addBlog(blog);

    return "redirect:/admin/blog/list";
View Full Code Here

    if (result.hasErrors()) {
      return "blog/update";
    }

    Blog blog = blogDao.get(form.getId());
    blog.setDescription(form.getDescription());
    blog.setName(form.getName());

    blogDao.merge(blog);
    searchService.addBlog(blog);

    return "redirect:/admin/blog/list";
View Full Code Here

  @Autowired
  private AuthenticationProvider authenticationProvider;

  @RequestMapping(method = RequestMethod.GET, value = "/{id}")
  public String show(@PathVariable("id") Long id, @RequestParam(value = "day", required = false) String day, Model model) {
    Blog blog = blogDao.get(id);
    model.addAttribute("blog", blog);

    List<Article> articles = articleDao.findByBlog(blog);

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

TOP

Related Classes of org.uned.agonzalo16.bitacora.domain.Message

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.