if (!SecurityHelper.doesUserHavePermission(session.get(), authUser, permissibleObject, PERM.READ)) {
throw new SimpleMessageException("User is not authorized to set thumbs on this content.");
}
UserThumb userThumb = ThumbHelper.getUserThumb(session.get(), permissibleObject, authUser, getVoterGUID());
// check if thumb already exists
if (userThumb != null) {
// TODO: consider changing the vote
// simply subtract the previous amount and decrement the numRatingVotes and redivide
throw new SimpleMessageException("Already voted.");
}
if (like) {
permissibleObject.setNumUpVotes(permissibleObject.getNumUpVotes() + 1);
} else {
permissibleObject.setNumDownVotes(permissibleObject.getNumDownVotes() + 1);
}
session.get().save(permissibleObject);
userThumb = new UserThumb();
userThumb.setPermissibleObject(permissibleObject);
userThumb.setLikeThumb(like);
userThumb.setVoter(authUser);
userThumb.setVoterGUID(getVoterGUID());
session.get().save(userThumb);
tx.commit();
return userThumb;
} catch (Throwable t) {