Пример #1
0
  @Override
  public void delete(Long id) throws UserRetrievalException {
    Date currentDate = new Date();

    InvitationEntity toDelete = getEntityById(id);
    if (toDelete != null) {
      toDelete.setDeleted(true);
      toDelete.setLastModifiedDate(currentDate);
      // TODO: can we update the last modified user field like this? is someone authenticated at
      // this point?
      // toDelete.setLastModifiedUser(Util.getCurrentUser().getId());

      update(toDelete);
    } else {
      throw new UserRetrievalException("Could not find invitation with id " + id);
    }
  }
Пример #2
0
  @Override
  public InvitationDTO create(InvitationDTO dto) throws UserCreationException {
    Date creationDate = new Date();

    InvitationEntity toCreate = new InvitationEntity();
    toCreate.setCreationDate(creationDate);
    toCreate.setDeleted(false);
    toCreate.setAcbId(dto.getAcbId());
    toCreate.setEmailAddress(dto.getEmail());
    toCreate.setToken(dto.getToken());
    toCreate.setLastModifiedDate(new Date());
    toCreate.setLastModifiedUser(Util.getCurrentUser().getId());

    create(toCreate);
    return new InvitationDTO(toCreate);
  }