Exemplo n.º 1
0
 @Override
 public Set<User> getUnapprovedSpammers(User moderator) {
   List<ApprovalWorkflowBean> workflows =
       approvalManager.getUnApprovedWorkflowBeans(
           moderator.getID(), -1, JiveObjectModerator.Type.ABUSE);
   Set<User> users = new HashSet<User>();
   for (ApprovalWorkflowBean approvalWorkflowBean : workflows) {
     try {
       JiveObject jiveObject =
           jiveObjectLoader.getJiveObject(
               (int) approvalWorkflowBean.getTypeID(), approvalWorkflowBean.getObjID());
       if (jiveObject instanceof UserAuthoredObject) {
         if (log.isTraceEnabled()) {
           log.trace(
               "Adding "
                   + ((UserAuthoredObject) jiveObject).getUser().getUsername()
                   + " user from object "
                   + jiveObject);
         }
         users.add(((UserAuthoredObject) jiveObject).getUser());
       }
     } catch (NotFoundException e) {
       log.error("Cannot find object for approval", e);
     }
   }
   return users;
 }
Exemplo n.º 2
0
 public void resolveSpamReport(JiveObject jiveObject, User moderator) {
   abuseManager.resolveAbuseReports(jiveObject);
   List<ApprovalWorkflowBean> workflows =
       approvalManager.getWorkflowBeans(jiveObject, JiveObjectModerator.Type.ABUSE);
   for (ApprovalWorkflowBean workflow : workflows) {
     try {
       jiveObjectModerator.approve(
           workflow.getWorkflowID(), jiveObject, moderator, "Spam report: Content is not spam");
     } catch (ModerationItemException e) {
       log.error(
           "Cannot approve workflow, id: "
               + workflow.getWorkflowID()
               + ", message: "
               + e.getMessage());
       if (log.isTraceEnabled()) {
         log.error("Moderation exception", e);
       }
     }
   }
 }