Search in sources :

Example 1 with DocumentRatingSummary

use of org.alfresco.rest.api.model.DocumentRatingSummary in project alfresco-remote-api by Alfresco.

the class AbstractRatingScheme method getNodeRating.

public NodeRating getNodeRating(NodeRef nodeRef) {
    Rating ratingByCurrentUser = ratingService.getRatingByCurrentUser(nodeRef, ratingSchemeName);
    Float rating = null;
    Date appliedAt = null;
    if (ratingByCurrentUser != null) {
        rating = ratingByCurrentUser.getScore();
        appliedAt = ratingByCurrentUser.getAppliedAt();
    }
    Object myRating = null;
    if (rating != null) {
        validateRating(rating);
        myRating = getApiRating(rating);
    }
    DocumentRatingSummary documentRatingSummary = getDocumentRatingSummary(nodeRef);
    NodeRating nodeRating = new NodeRating(ratingSchemeId, myRating, appliedAt, documentRatingSummary);
    return nodeRating;
}
Also used : DocumentRatingSummary(org.alfresco.rest.api.model.DocumentRatingSummary) Rating(org.alfresco.service.cmr.rating.Rating) NodeRating(org.alfresco.rest.api.model.NodeRating) JSONObject(org.json.simple.JSONObject) NodeRating(org.alfresco.rest.api.model.NodeRating) Date(java.util.Date)

Aggregations

Date (java.util.Date)1 DocumentRatingSummary (org.alfresco.rest.api.model.DocumentRatingSummary)1 NodeRating (org.alfresco.rest.api.model.NodeRating)1 Rating (org.alfresco.service.cmr.rating.Rating)1 JSONObject (org.json.simple.JSONObject)1