@Override
@PreAuthorize("hasPermission(#id, 'PRIVATE_MESSAGE', 'GeneralPermission.READ')")
public PrivateMessage get(Long id) throws NotFoundException {
PrivateMessage pm = super.get(id);
if (!hasCurrentUserAccessToPM(pm)) {
throw new NotFoundException(String.format("current user has no right to read pm %s with id %d",
userService.getCurrentUser(), id));
}
if (this.ifMessageShouldBeMarkedAsRead(pm)) {
pm.setRead(true);
this.getDao().saveOrUpdate(pm);