Beispiel #1
0
  @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
  public void deleteImage(User editor, Image image) {
    EditHistoryDto info = new EditHistoryDto();

    info.setEditor(editor.getId());
    info.setMsgid(image.getTopicId());
    info.setOldimage(image.getId());
    info.setObjectType(EditHistoryObjectTypeEnum.TOPIC);

    imageDao.deleteImage(image);

    editHistoryService.insert(info);
    topicDao.updateLastmod(image.getTopicId(), false);
  }
Beispiel #2
0
  @RequestMapping(
      value = "/memories.jsp",
      params = {"add"},
      method = RequestMethod.POST)
  public @ResponseBody Integer add(ServletRequest request, @RequestParam("msgid") int msgid)
      throws Exception {
    Template tmpl = Template.getTemplate(request);

    if (!tmpl.isSessionAuthorized()) {
      throw new AccessViolationException("Not authorized");
    }

    User user = tmpl.getCurrentUser();
    user.checkBlocked();
    user.checkAnonymous();

    Topic topic = messageDao.getById(msgid);
    if (topic.isDeleted()) {
      throw new UserErrorException("Тема удалена");
    }

    return memoriesDao.addToMemories(user.getId(), topic.getId());
  }