Esempio n. 1
0
 @RequestMapping(value = "/postdetails", method = RequestMethod.GET)
 public String postDetails(
     Model model, @RequestParam("post_id") Long postId, HttpServletRequest request) {
   Post currentPost = postsService.getPost(postId);
   model.addAttribute("post", currentPost);
   model.addAttribute("author", usersService.getUser(currentPost.getAuthor().getId()));
   return "textview";
 }
 @Transactional
 public ArrayList<Point> getLinesById(Long id) {
   ArrayList<Point> list = new ArrayList<>();
   Post post = postsRepo.findOne(id);
   if (post != null) {
     return post.getTrack();
   }
   /*	for(Post e: postsRepo.findAll()) {
   	Calendar c = Calendar.getInstance();
   	c.setTime(e.getMdate());
   	c.add(Calendar.DATE, toIntExact(e.getDays()));  // number of days to add
   	if(e != null && c.getTime().after(e.getMdate())) {
   		list.put(e.getId(), e.getTrack().get(e.getTrack().size() - 1));
   	}
   }*/
   return list;
 }
 @Transactional
 public HashMap<Long, MarkerData> getTracks() {
   HashMap<Long, MarkerData> list = new HashMap<>();
   for (Post e : postsRepo.findAll()) {
     Calendar c = Calendar.getInstance();
     c.setTime(e.getMdate());
     c.add(Calendar.DATE, toIntExact(e.getDays())); // number of days to add
     if (e != null && c.getTime().after(e.getMdate())) {
       MarkerData data = new MarkerData(e.getTrack().get(e.getTrack().size() - 1), "ava1.jpg");
       list.put(e.getId(), data);
     }
   }
   return list;
 }