/**
  * Loops over the {@code rightsCombinations} and attaches a new rights object for each combination
  * to the document.
  *
  * @param rightsCombinations the string array containing all the combinations for which there
  *     should be an object created
  * @param rightsObjects the map of existing rights objects
  * @param doc XWikiDocument
  * @param context XWikiContext
  */
 private void createRights(
     List<String> rightsCombinations,
     Map<String, BaseObject> rightsObjects,
     XWikiDocument doc,
     XWikiContext context) {
   for (String rights : rightsCombinations) {
     try {
       BaseObject newRightObject = doc.newXObject(RIGHTS_CLASS, context);
       newRightObject.setStringValue("levels", rights);
       newRightObject.setIntValue("allow", 1);
       rightsObjects.put(rights, newRightObject);
     } catch (XWikiException ex) {
       this.logger.error("Failed to create rights: {}", ex.getMessage(), ex);
     }
   }
 }
 private XWikiDocument addDocument(String documentName, String author, Date date, int vote)
     throws RatingsException {
   try {
     String ratingsClassName = RatingsManager.RATINGS_CLASSNAME;
     String pageName = getPageName(documentName);
     String parentDocName = documentName;
     XWiki xwiki = context.getWiki();
     XWikiDocument doc = xwiki.getDocument(pageName, context);
     doc.setParent(parentDocName);
     BaseObject obj = new BaseObject();
     obj.setClassName(ratingsClassName);
     obj.setName(pageName);
     obj.setStringValue(RatingsManager.RATING_CLASS_FIELDNAME_AUTHOR, author);
     obj.setDateValue(RatingsManager.RATING_CLASS_FIELDNAME_DATE, date);
     obj.setIntValue(RatingsManager.RATING_CLASS_FIELDNAME_VOTE, vote);
     obj.setStringValue(RatingsManager.RATING_CLASS_FIELDNAME_PARENT, parentDocName);
     doc.addObject(ratingsClassName, obj);
     return doc;
   } catch (XWikiException e) {
     throw new RatingsException(e);
   }
 }