Package org.uned.agonzalo16.bitacora.domain

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


    }
    return checkUserDetails(username, password, true);
  }

  private void insertAdmin() {
    User user = new User();
    user.setActive(true);
    user.setCreationDate(new Date());
    user.setEmail("admin@test.com");
    user.setLocalization("Spain");
    user.setPassword("password");
    user.setType(UserType.ADMIN.getType());
    user.setUsername("admin");
    user.setWebSite("www.site.com");
    userDao.merge(user);
  }
View Full Code Here


    if (userDao.findAll().isEmpty()) {
      insertAdmin();
    }

    User user = userDao.findByUsername(username);
    if (user == null) {
      throw new BadCredentialsException("Invalid user: " + username);
    }

    if (!user.isActive()) {
      throw new BadCredentialsException("User desactivated: " + username);
    }

    if (authenticate) {
      String expectedPassword = user.getPassword();
      if (!StringUtils.hasText(expectedPassword)) {
        throw new BadCredentialsException("No password for " + username + " set in database, contact administrator");
      }

      String encryptedPassword = DigestUtils.md5DigestAsHex(password.getBytes());
View Full Code Here

    for (Article article : articles) {
      dates.add(article.getCreationDate());
    }
    model.addAttribute("dates", dates);

    AuthenticatedUser user = authenticationProvider.getCurrentUserDetails();

    if (user == null) {
      return "blog/show";
    } else {
      model.addAttribute("comment", new CommentForm(id));
View Full Code Here

  }

  @Override
  public int doStartTag() throws JspException {

    AuthenticatedUser principal = authenticationProvider.getCurrentUserDetails();
    User user = userDao.get(principal.getId());

    pageContext.setAttribute(var, messageDao.findNotReadByDestination(user));
    return SKIP_BODY;
  }
View Full Code Here

  @RequestMapping(method = RequestMethod.GET, value = "/{id}")
  public String show(@PathVariable("id") Long id, Model model) {
    model.addAttribute("article", articleDao.get(id));

    AuthenticatedUser user = authenticationProvider.getCurrentUserDetails();

    if (user == null) {
      return "article/show";
    } else {
      model.addAttribute("comment", new CommentForm(id));
View Full Code Here

  }

  @Override
  public int doStartTag() throws JspException {

    AuthenticatedUser principal = authenticationProvider.getCurrentUserDetails();
    User user = userDao.get(principal.getId());

    List<BlogContribution> blogs = blogContributionDao.findByUser(user);
    Collections.sort(blogs, new Comparator<BlogContribution>() {
      @Override
      public int compare(BlogContribution b1, BlogContribution b2) {
View Full Code Here

  }

  @Override
  public int doStartTag() throws JspException {

    AuthenticatedUser principal = authenticationProvider.getCurrentUserDetails();
    if (principal == null) {
      return SKIP_BODY;
    }

    User user = userDao.get(principal.getId());

    List<BlogContribution> blogs = blogContributionDao.findByUser(user);
    for (BlogContribution bc : blogs) {
      if (bc.getBlog().equals(blog)) {
        return EVAL_BODY_INCLUDE;
View Full Code Here

    AuthenticatedUser user = authenticationProvider.getCurrentUserDetails();

    if (user == null) {
      return "blog/show";
    } else {
      model.addAttribute("comment", new CommentForm(id));
      return "blog/showAndMenu";
    }
  }
View Full Code Here

    AuthenticatedUser user = authenticationProvider.getCurrentUserDetails();

    if (user == null) {
      return "article/show";
    } else {
      model.addAttribute("comment", new CommentForm(id));
      return "article/showAndComments";
    }
  }
View Full Code Here

    Collections.sort(totalCount);

    // coger los 5 con m�s comentarios
    List<FeaturedArticle> articles = new ArrayList<FeaturedArticle>(5);
    for (ArticleCount article : totalCount) {
      articles.add(new FeaturedArticle(article.getArticle(), commentDao.countByArticle(article.getArticle())));

      if (articles.size() == 5) {
        break;
      }
    }
View Full Code Here

TOP

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

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.