Exemplo n.º 1
0
  // req: 24.2
  public void deleteMessageFromFolder(Message message, Folder folder) {
    Assert.notNull(message);
    Assert.isTrue(message.getId() != 0);
    Assert.notNull(folder);
    Assert.isTrue(folder.getId() != 0);

    Assert.isTrue(
        folder.getActor().equals(actorService.findByPrincipal()),
        "Only the owner of the folder can delete a message");

    folderService.removeMessage(folder, message);
  }
Exemplo n.º 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;
  }