Пример #1
0
  public Message findOne(int messageId) {
    Message result;

    result = messageRepository.findOne(messageId);

    Assert.notNull(result, "message.findOne.UnknownID");

    checkActor(result);

    return result;
  }
Пример #2
0
  // req: 24.1
  public Collection<Message> findAllByFolder(Folder folder) {
    Assert.notNull(folder);
    Assert.isTrue(
        folder.getActor().equals(actorService.findByPrincipal()),
        "Only the owner of the folder can display them");

    Collection<Message> result;

    result = messageRepository.findAllByFolderId(folder.getId());

    return result;
  }
Пример #3
0
  // req: 24.2
  private Message save(Message message) {
    Assert.notNull(message);
    Assert.isTrue(
        message.getSender().equals(actorService.findByPrincipal()),
        "Only the sender can save the message");

    message.setMoment(new Date());

    Message result;

    result = messageRepository.save(message);

    return result;
  }