/** * Gets the rating applied to the specified node in the specified scheme by * the currently authenticated user. * @param node ScriptNode * @param ratingSchemeName String * @return rating if there is one, else -1. * TODO -1 could be a valid rating. */ public float getRating(ScriptNode node, String ratingSchemeName) { final Rating ratingByCurrentUser = ratingService.getRatingByCurrentUser(node.getNodeRef(), ratingSchemeName); return ratingByCurrentUser == null ? -1f : ratingByCurrentUser.getScore(); }
/** * Gets the rating applied date for the specified node in the specified scheme by * the currently authenticated user. * @param node ScriptNode * @param ratingSchemeName String * @return rating applied date if there is one, else <code>null</code> */ public Date getRatingAppliedAt(ScriptNode node, String ratingSchemeName) { final Rating ratingByCurrentUser = ratingService.getRatingByCurrentUser(node.getNodeRef(), ratingSchemeName); return ratingByCurrentUser == null ? null : ratingByCurrentUser.getAppliedAt(); }
/** * Gets the rating applied to the specified node in the specified scheme by * the currently authenticated user. * @param node ScriptNode * @param ratingSchemeName String * @return rating if there is one, else -1. * TODO -1 could be a valid rating. */ public float getRating(ScriptNode node, String ratingSchemeName) { final Rating ratingByCurrentUser = ratingService.getRatingByCurrentUser(node.getNodeRef(), ratingSchemeName); return ratingByCurrentUser == null ? -1f : ratingByCurrentUser.getScore(); }
/** * Gets the rating applied date for the specified node in the specified scheme by * the currently authenticated user. * @param node ScriptNode * @param ratingSchemeName String * @return rating applied date if there is one, else <code>null</code> */ public Date getRatingAppliedAt(ScriptNode node, String ratingSchemeName) { final Rating ratingByCurrentUser = ratingService.getRatingByCurrentUser(node.getNodeRef(), ratingSchemeName); return ratingByCurrentUser == null ? null : ratingByCurrentUser.getAppliedAt(); }
@Override public NodeRef execute() throws Throwable { // Create a new folder to copy the rated node to. NodeRef testFolder = testNodes.createNode(COMPANY_HOME, "copyTarget", ContentModel.TYPE_FOLDER, AuthenticationUtil.getAdminUserName()); // Ensure the test document is not rated initially. assertNull(RATING_SERVICE.getRatingByCurrentUser(testDoc_Admin, LIKES_SCHEME_NAME)); // Apply a rating to the test document. RATING_SERVICE.applyRating(testDoc_Admin, 1, LIKES_SCHEME_NAME); return testFolder; } });
public Void execute() throws Throwable Rating nullRating = RATING_SERVICE.getRatingByCurrentUser(testDoc_Admin, LIKES_SCHEME_NAME); assertNull("Expected a null rating,", nullRating); assertNull("Expected a null remove result.", RATING_SERVICE.removeRatingByCurrentUser(testDoc_Admin, LIKES_SCHEME_NAME)); Rating fiveStarRating = RATING_SERVICE.getRatingByCurrentUser(testDoc_Admin, FIVE_STAR_SCHEME_NAME); Rating updatedFiveStarRating = RATING_SERVICE.getRatingByCurrentUser(testDoc_Admin, FIVE_STAR_SCHEME_NAME); assertNull("5* rating not null.", RATING_SERVICE.getRatingByCurrentUser(testDoc_Admin, FIVE_STAR_SCHEME_NAME));