Jive API (3.0.13) Core Javadocs

com.jivesoftware.community.favorites.type
Interface FavoriteInfoProvider<O extends JiveObject,T extends JiveObjectType>


public interface FavoriteInfoProvider<O extends JiveObject,T extends JiveObjectType>

A provider for invormation needed to render favorites. Different favoritable types have different methods to determine the information around the favorited content and this will be reflected in the implementations.

Since:
Jive SBS 3.0

Nested Class Summary
static class FavoriteInfoProvider.EventType
           
 
Method Summary
 O getAncestor(JiveObject inheritor)
          For an inherited object, getInheritedTypes(), this will return the ancestor for which it inherits from.
 User getAuthor(O object)
           
 boolean getCanUserDefineSubject(O favoritedObject)
          Returns true if users can change the subject for a favorite of the given object and false if they cannot.
 JiveContainer getContainer(O object)
           
 List<String> getFavoritableTypeNames(T type)
          Returns the name utilized in hackable urls to specify a marked favorite of a particular type.
 String getFavoriteUrl(O object)
          Returns the landing page to view all meta-information pertaining to the passed in object.
 Set<JiveObjectType> getInheritedTypes()
          Inherited types allow the favoriting of an object to be encompassed by another type.
 FavoriteInfoProvider.EventType getMappedEventType(BaseJiveEvent e)
          Maps the event between the Jive Event domain to something that Favoriting can easily parse and understand.
 String getSubject(O object, String userProvidedSubject)
          Returns the subject for the given object to be displayed for the favorite.
 String getUrl(O favoritedObject)
          Returns the url to view the favorited object.
 boolean isUserDefinedSubject(O favoritedObject, String userProvidedSubject)
          Returns true if the subject returned by getSubject(com.jivesoftware.community.JiveObject, String) was defined by the user.
 

Method Detail

getSubject

String getSubject(O object,
                  String userProvidedSubject)
Returns the subject for the given object to be displayed for the favorite.

Parameters:
object - the object for which the subject is being determined.
userProvidedSubject - the subject, if it has been provided by the user, null otherwise. The subject may be ignored by particular implementations.
Returns:
the subject for the given object to be displayed for the favorite.

isUserDefinedSubject

boolean isUserDefinedSubject(O favoritedObject,
                             String userProvidedSubject)
Returns true if the subject returned by getSubject(com.jivesoftware.community.JiveObject, String) was defined by the user. A return value of false indicates that the subject was inherited from the favorited object.

Parameters:
favoritedObject - the object for which the subject is being determined.
userProvidedSubject - the subject, if it has been provided by the user, null otherwise. The subject may be ignored by particular implementations.
Returns:
true if the subject returned by getSubject(com.jivesoftware.community.JiveObject, String) was defined by the user.

getCanUserDefineSubject

boolean getCanUserDefineSubject(O favoritedObject)
Returns true if users can change the subject for a favorite of the given object and false if they cannot.

Parameters:
favoritedObject - the object for which it is being determined if users can set the favorite subject.
Returns:
true if users can change the subject for a favorite of the given object and false if they cannot.

getUrl

String getUrl(O favoritedObject)
Returns the url to view the favorited object. For instance, if this favorite relates to a discussion, this will return the url to view the discussion. Also, if this favorite relates to an com.jivesoftware.community.favorites.external.ExternalURL it will return the url which this favorite realtes to.

Parameters:
favoritedObject - the object for which the url will be returned
Returns:
the url to view the object that this favorite relates to.

getFavoriteUrl

String getFavoriteUrl(O object)
Returns the landing page to view all meta-information pertaining to the passed in object. In a default installation of Jive SBS the only type with an independent landing page is an com.jivesoftware.community.favorites.external.ExternalURL. If the type of object that this Favorite relates does not have a landing page for information about the favorite, as is the case with discussions, blog posts, and documents, this function will return the url for the piece of content.

Parameters:
object - the object for which the favorite meta-info landing page will be returned.
Returns:
the landing page to view all meta-information pertaining to a favorite.

getFavoritableTypeNames

List<String> getFavoritableTypeNames(T type)
Returns the name utilized in hackable urls to specify a marked favorite of a particular type.

Parameters:
type - the type for which the name is being returned
Returns:
the name utilized in hackable urls to specify a marked favorite of a particular type.

getAuthor

User getAuthor(O object)

getContainer

JiveContainer getContainer(O object)

getMappedEventType

FavoriteInfoProvider.EventType getMappedEventType(BaseJiveEvent e)
Maps the event between the Jive Event domain to something that Favoriting can easily parse and understand.

Parameters:
e - the event which is being mapped.
Returns:
the eventtype mapping for favoriting.

getInheritedTypes

Set<JiveObjectType> getInheritedTypes()
Inherited types allow the favoriting of an object to be encompassed by another type. For instance, attempting to favorite a message of a discussion should actually cause the discussion itself to be favorited as opposed to the message. In this example then the message is an inherited type of the discussion.

This allows multiple types to be encompassed in one greater type if conceptually they should be the same thing with regards to favoriting.

Returns:
the set of inherited types provided by this type.

getAncestor

O getAncestor(JiveObject inheritor)
                                 throws IllegalArgumentException
For an inherited object, getInheritedTypes(), this will return the ancestor for which it inherits from. For example, in the case of a message the forum thread that the message belongs to would be returned.

Parameters:
inheritor - the object for which the ancestor will return.
Returns:
the ancestor for an object of an inherited type.
Throws:
IllegalArgumentException - will be thrown when an ancestor cannot be deteremined for the given inheritor.

Jive Product Page

Copyright © 1999-2007 Jive Software.