Jive API (3.0.13) Core Javadocs

com.jivesoftware.community
Interface DraftManager

All Superinterfaces:
JiveManager

public interface DraftManager
extends JiveManager

Manages the draft features of Jive SBS. The following Jive properties correspond to the draft manager settings:

See Also:
JiveContext.getDraftManager()

Method Summary
 Draft createDraft(Draft draft)
          Creates a new draft.
 void deleteDraft(Draft draft)
          Delete an existing draft.
 void deleteUserDrafts(User user)
          Delete all of a given user's drafts.
 int getAutosaveInterval()
          Returns the setting for the number of seconds between autosave invocations when autosave is enabled for a text field.
 Draft getDraft(long draftID)
          Returns a draft by draft ID or null if no draft exists with the specified draftID.
 Draft getDraft(long userID, int draftObjectType, int draftContainerObjectType, long draftContainerObjectID)
          Returns the draft for a particular user associated with a particular community, thread and / or message.
 Iterable<Draft> getDraftsByContainer(int containerObjectType, long containerObjectID)
          Returns all drafts for a particular container.
 Iterable<Draft> getDraftsByUser(long userID)
          Returns all drafts for a particular user.
 boolean isAutosaveEnabled()
          Determines whether or not the system has been configured to allow for autosave in text fields.
 void moveDraftToContainer(EntityDescriptor destination, Draft draft)
          Moves the draft to the a different container.
 void moveDraftToContainer(JiveContainer destination, Draft draft)
          Moves the draft to the a different container.
 void setAutosaveEnabled(boolean enable)
          Enables or disables autosave.
 void setAutosaveInterval(int interval)
          Sets the amount of time (in seconds) that the browser should wait between updating the draft.
 void updateDraft(Draft draft)
          Update an existing draft.
 
Methods inherited from interface com.jivesoftware.community.JiveManager
destroy
 

Method Detail

createDraft

Draft createDraft(Draft draft)
Creates a new draft. If a draft already exists with the userid / drafttype / communityid / threadid / messageid combination, then the method will return the existing draft and will not create a new draft.

Parameters:
draft - a Draft
Returns:
a new Draft or an existing Draft that matches the given communityid / threadid / messageid.

getDraft

Draft getDraft(long draftID)
               throws UnauthorizedException
Returns a draft by draft ID or null if no draft exists with the specified draftID.

Parameters:
draftID - the ID of the draft to return.
Returns:
the draft or null if no draft exists with the specified draftID.
Throws:
UnauthorizedException - if the user is not either a System Admin or the user associated with the draft.

getDraft

Draft getDraft(long userID,
               int draftObjectType,
               int draftContainerObjectType,
               long draftContainerObjectID)
Returns the draft for a particular user associated with a particular community, thread and / or message. Used on thread posting page to determine whether or not the user has a draft already started for a particular community/thread/message. If no draft is found, the method returns null.

Parameters:
userID - the user to find draft for
draftObjectType - the draft type to filter the results by
draftContainerObjectType - the type of container to filter by
draftContainerObjectID - the id of a specific container to filter by
Returns:
Draft the draft, if any, that matches the search

getDraftsByUser

Iterable<Draft> getDraftsByUser(long userID)
Returns all drafts for a particular user.

Parameters:
userID - the id of the user
Returns:
iterable of all available drafts

getDraftsByContainer

Iterable<Draft> getDraftsByContainer(int containerObjectType,
                                     long containerObjectID)
Returns all drafts for a particular container.

Parameters:
containerObjectType - container object type
containerObjectID - container id
Returns:
iterable of all available drafts

updateDraft

void updateDraft(Draft draft)
                 throws UnauthorizedException
Update an existing draft. Automatically saves an updated modification date on the draft.

Parameters:
draft - The draft to be updated.
Throws:
UnauthorizedException - if the user associated with the draft is not either a system admin or the owner of the draft.

deleteDraft

void deleteDraft(Draft draft)
                 throws UnauthorizedException
Delete an existing draft.

Parameters:
draft - The draft to be deleted.
Throws:
UnauthorizedException - if the user associated with the draft is not either a system admin or the owner of the draft.

deleteUserDrafts

void deleteUserDrafts(User user)
                      throws UnauthorizedException
Delete all of a given user's drafts.

Parameters:
user - the owner of the drafts being deleted.
Throws:
UnauthorizedException - if the authenticated user is not a sys-admin or user-admin.

isAutosaveEnabled

boolean isAutosaveEnabled()
Determines whether or not the system has been configured to allow for autosave in text fields. By default, the system is configured to allow autosave. The value can be changed by modifying the 'draft.autosave.enabled' Jive property or via the admin console by using the Autosave Settings option or programatically using the setAutosaveEnabled() method.

Returns:
true if the system has been configured to allow autosave (default) or false if the system has been configured to disallow autosave.

setAutosaveEnabled

void setAutosaveEnabled(boolean enable)
Enables or disables autosave.

Parameters:
enable -

getAutosaveInterval

int getAutosaveInterval()
Returns the setting for the number of seconds between autosave invocations when autosave is enabled for a text field. By default the value is 30. The value can be changed by modifying the 'draft.autosave.interval' Jive property via the admin console.

Returns:
interval the number of seconds between autosave invocations

setAutosaveInterval

void setAutosaveInterval(int interval)
Sets the amount of time (in seconds) that the browser should wait between updating the draft.

Parameters:
interval -

moveDraftToContainer

void moveDraftToContainer(JiveContainer destination,
                          Draft draft)
Moves the draft to the a different container.

Parameters:
destination - container to move the draft to
draft - draft to be moved

moveDraftToContainer

void moveDraftToContainer(EntityDescriptor destination,
                          Draft draft)
Moves the draft to the a different container.

Parameters:
destination - object to move the draft to
draft - draft to be moved

Jive Product Page

Copyright © 1999-2007 Jive Software.