Clearspace API (2.5.29) Core Javadocs

com.jivesoftware.community.moderation
Interface ModerationStrategy


public interface ModerationStrategy

Class to represent a moderation strategy.


Method Summary
 void approvalCallback(Long workflowID, JiveObject jiveObject, User user, String responseMessage)
          Handles the approval callback.
 void approve(Long workflowID, JiveObject jiveObject, User user, String responseMessage)
          Approves the workflow for the given workflow ID and JiveObject.
 JiveObject finishCallback(Long workflowID, JiveObject jiveObject)
          Handles the finish call back.
 List<JiveObjectType> getModeratedTypes()
          Specifies a list of JiveObjectType that the strategy supports.
 Set<Long> getModerators(JiveObject jiveObject)
          Retrieves a list of unique User IDs representing the available moderators for a given JiveObject.
 void newCallback(User user, long entryID, JiveObject jiveObject, Set<Long> moderators, String requestMessage)
          Handles the new callback.
 void notificationCallback(Long workflowID, JiveObject jiveObject, User user, String responseMessage)
          Handles the notification callback.
 void reject(Long workflowID, JiveObject jiveObject, User user, String responseMessage)
          Rejects the workflow for the given workflow ID and JiveObject.
 void rejectionCallback(Long workflowID, JiveObject jiveObject, User user, String responseMessage)
          Handles the rejection callback.
 boolean shouldModerate(JiveContainer jiveContainer, int objectType, User user)
          Determines if moderation is enabled for the given JiveContainer and object Type.
 boolean shouldModerate(JiveObject jiveObject, User user)
          Determines if moderation for the given JiveObject is enabled.
 void startWorkflow(JiveObject jiveObject, User user, String requestMessage)
          Puts the JiveObject into the moderation queue.
 void stateChangeCallback(JiveObject jiveObject, JiveContentObject.Status status)
          Handles any state changes for a given object.
 

Method Detail

shouldModerate

boolean shouldModerate(JiveObject jiveObject,
                       User user)
Determines if moderation for the given JiveObject is enabled. Moderation is enabled for an object if the space/community it is created in has moderation enabled for jiveObject's type.

Parameters:
jiveObject - the jiveObject for which moderation might be enabled.
user - the user that owns the jiveObject.
Returns:
true if moderation is enabled for the given jiveObject, false otherwise.

shouldModerate

boolean shouldModerate(JiveContainer jiveContainer,
                       int objectType,
                       User user)
Determines if moderation is enabled for the given JiveContainer and object Type. Moderation is enabled if the moderation enabled property is set for the given object type on the container.

Parameters:
jiveContainer - the jiveContainer.
objectType - the object type for which moderation might be enabled.
user - the user that owns the jiveObject.
Returns:
true if moderation is enabled for the particular object type, false otherwise.

startWorkflow

void startWorkflow(JiveObject jiveObject,
                   User user,
                   String requestMessage)
Puts the JiveObject into the moderation queue.

Parameters:
jiveObject - the jiveObject to send into moderation.
user - the user that owns the jiveObject.
requestMessage - an optional message stating why the message is in moderation.

getModerators

Set<Long> getModerators(JiveObject jiveObject)
Retrieves a list of unique User IDs representing the available moderators for a given JiveObject.

Parameters:
jiveObject - the jiveObject.
Returns:
A set of Longs representing the user IDs of the moderators.

approve

void approve(Long workflowID,
             JiveObject jiveObject,
             User user,
             String responseMessage)
Approves the workflow for the given workflow ID and JiveObject. This method is responsible for advancing the workflow into the "Approved" step and toggling the status of the JiveObject to "APPROVED".

Parameters:
workflowID - the unique ID of the workflow.
jiveObject - the jiveObject.
user - the user approving the workflow item.
responseMessage - an optional message stating why the jiveObject was approved.

reject

void reject(Long workflowID,
            JiveObject jiveObject,
            User user,
            String responseMessage)
Rejects the workflow for the given workflow ID and JiveObject. This method is responsible for advancing the workflow into the "Rejected" step and toggling the status of the JiveObject to "REJECTED".

Parameters:
workflowID - the unique ID of the workflow.
jiveObject - the jiveObject.
user - the user who rejected the workflow item.
responseMessage - an optional message stating why the jiveObject was rejected.

approvalCallback

void approvalCallback(Long workflowID,
                      JiveObject jiveObject,
                      User user,
                      String responseMessage)
Handles the approval callback. This method is responsible for any functions that need to happen after the workflow is advanced to the "Approved" step. By default this method will update the workflow bean for the given workflowID and JiveObject.

Parameters:
workflowID - the unique ID of the workflow.
jiveObject - the jiveObject.
user - the user who approved the workflow item.
responseMessage - an optional message stating why the jiveObject was approved.

rejectionCallback

void rejectionCallback(Long workflowID,
                       JiveObject jiveObject,
                       User user,
                       String responseMessage)
Handles the rejection callback. This method is responsible for any functions that need to happen after the workflow is advanced to the "Rejected" step. By default this method will update the workflow bean for the given workflowID and JiveObject.

Parameters:
workflowID - the unique ID of the workflow.
jiveObject - the jiveObject.
user - the user who rejected the workflow item.
responseMessage - an optional message stating why the jiveObject was rejected.

newCallback

void newCallback(User user,
                 long entryID,
                 JiveObject jiveObject,
                 Set<Long> moderators,
                 String requestMessage)
Handles the new callback. This method is responsible for any functions that need to happen after the workflow is advanced to the "New" step. This step happens automatically when an item is sent into moderation. By default this makes a call to change the status to "AWAITING_MODERATION", assigns moderators for the piece of content and creates a new workflow entry.

Parameters:
user - the user who owns the jiveObject.
entryID - the unique ID that will be used for the workflow ID.
jiveObject - the jiveObject.
moderators - a set of long values representing moderators user IDs.
requestMessage - an option message stating why the message was sent into moderation.

notificationCallback

void notificationCallback(Long workflowID,
                          JiveObject jiveObject,
                          User user,
                          String responseMessage)
Handles the notification callback. This method is responsible for any functions that need to happen after the workflow is advanced to the "Notification" step. This step happens after the approval and rejected callbacks and before the finish callback. By default this method will send a notification email to the content owner notifying them that the content item was approved/rejected.

Parameters:
workflowID - the unique ID of the workflow.
jiveObject - the jiveObject.
user - the user who approved or rejected the workflow item.
responseMessage - an optional message why the jiveObject was approved/rejected.

finishCallback

JiveObject finishCallback(Long workflowID,
                          JiveObject jiveObject)
Handles the finish call back. This method is responsible for any functions that need to happen after the workflow is advanced to the finish step. This step happens automatically after the notification callback. By default this method will delete any empty workflow entries for the specified workflow id and JiveObject. A workflow entry is considered to be empty if it's neither approved nor rejected and its request/response message field is empty.

Parameters:
workflowID - the unique ID of the workflow.
jiveObject - the jiveObject.

stateChangeCallback

void stateChangeCallback(JiveObject jiveObject,
                         JiveContentObject.Status status)
Handles any state changes for a given object. Currently this method supports the following jiveObjects :

Parameters:
jiveObject - the jiveObject to change.
status - the new status.

getModeratedTypes

List<JiveObjectType> getModeratedTypes()
Specifies a list of JiveObjectType that the strategy supports.

Returns:
a list of jive object types.

Clearspace Project Page

Copyright © 1999-2007 Jive Software.