SAP NetWeaver '04

com.sapportals.wcm.repository.service.discussion
Interface IDiscussion

[contained in: com.sap.km.cm.repository.service.par - km.shared.repository.service.app.discussion_api.jar]
public interface IDiscussion

The class IDiscussion handles everything to do with a single discussion.
A discussion is comprised of IDiscussionItems in the tree structure. Each item is a contribution of a user. A discussion item can be a topic, which is a main statement inside a discussion. It can also be a reply to a topic which is called a post. Several levels of answers to posts are possible. The whole structure beneath a topic, a tree, is called a thread.
Discussion items can be created and deleted. The relationships between different items can be determined (parent, children, etc.). Every discussion item is saved in a text file.


Field Summary
static java.lang.String DISCUSSION_ITEM_EXTENSION
           
static java.lang.String DISCUSSION_ITEM_SUFFIX
          The content of each IDiscussionItem is saved in a file with the extension .txt
static java.lang.String DISCUSSION_REPLY_EXTENSION
           
static java.lang.String DISCUSSION_REPLY_SUFFIX
          The content of each post of an IDiscussionItem is saved in a file with the extension .replies
 
Method Summary
 boolean canAccessDiscussion()
          Checks is user has read permission on discussion primary resource to access discussion.
 boolean canAddFavorites()
          Checks if user can add discussion to her favorites.
 boolean canCreateItem()
          Checks is user has read permission on discussion primary resource to access discussion.
 boolean canDeleteItem(IDiscussionItem topic)
          Checks if the deletion of a topic discussion item is possible.
 boolean canUseSubscription()
          Checks if a subscription to the discussion is possible
 IDiscussionItem createItem(IDiscussionItem parent, java.lang.String name, java.lang.String content, java.lang.String description)
          Creates a discussion item within a thread.
 IDiscussionItem createItem(java.lang.String name, java.lang.String content, java.lang.String description)
          Creates first topic of a discussion thread (root discussion item also called topic).
 IDiscussionItem createSingleTopic()
          Creates first topic of a discussion thread (root discussion item also called topic).
 void deleteItem(IDiscussionItem item)
          Deletes a discussion item.
 void deleteItemReplies(IDiscussionItem item)
          Deletes a the replies folder of discussion item.
 void deleteItemReplies(IResource itemResource)
          Deletes a the replies folder of discussion item.
 void editItem(IDiscussionItem item, java.lang.String content, java.lang.String description)
          Edits a discussion item.
 IDiscussionItemList getChildren(IDiscussionItem item)
          Deprecated. as of NW04. Replaced by method of IDiscussionItem
 IDiscussionItem getDiscussionItem(RID itemRid)
          Gets the IDiscussionItem instance for the specified RID.
 IDiscussionManager getDiscussionManager()
          Gets DiscussionManager for interactions between discussion classes.
 int getNumberOfThreads()
          Deprecated. as of NW04. Replaced by getNumberOfTopics()
 int getNumberOfTopics()
          Gets the number of threads that belong to the discussion.
 IDiscussionItem getParent(IDiscussionItem item)
          Deprecated. as of NW04. Replaced by getParent method at IDiscussionItem
 IResource getPrimaryResource()
          Gets primary resource of the discussion.
 RID getReplyUri(RID itemRid)
          Gets RID of the folder that contains the replies for the specified RID of an IDiscussionItem .
 IResource getResource()
          Gets primary resource of the discussion.
 IResourceContext getResourceContext()
          Gets context of a discussion resource.
 RID getRid()
          Gets the RID of a discussion.
 IDiscussionItemList getThreads()
          Deprecated. as of NW04. Replaced by getTopics()
 IDiscussionItemList getTopics()
          Gets all topics that belong to the discussion.
 IDiscussionItemList getTopics(java.lang.String sortCriterion, java.lang.String sortDirection)
          Gets all topics that belong to the discussion.
 IDiscussionItemList getTopics(java.lang.String sortCriterion, java.lang.String sortDirection, int startIndex, int length)
          Gets set of topics that belong to the discussion.
 RID getUri()
          Deprecated. as of NW04. Replaced by getRid() method
 RID getUri(IDiscussionItem item)
          Deprecated. as of NW04. Replaced by getRid() method
 boolean hasChildren(IDiscussionItem item)
          Deprecated. as of NW04. Replaced by the hasChildren() of the IDiscussion interface
 boolean isSingleTopic(IDiscussionItem item)
          Returns true if specified IDiscussionItem is a discussion topic and has the same description as a single topic.
 boolean isSubscribed()
          Checks if a subscription for this discussion exists.
 void setResource(IResource resource)
          Sets primary resource of the discussion.
 void setResourceContext(IResourceContext context)
          Sets the context for a discussion resource.
 boolean withTopics()
          Gets a flag that indicates if the discussion is running with topics or without topic layer.
 

Field Detail

DISCUSSION_ITEM_SUFFIX

public static final java.lang.String DISCUSSION_ITEM_SUFFIX
The content of each IDiscussionItem is saved in a file with the extension .txt

DISCUSSION_ITEM_EXTENSION

public static final java.lang.String DISCUSSION_ITEM_EXTENSION

DISCUSSION_REPLY_SUFFIX

public static final java.lang.String DISCUSSION_REPLY_SUFFIX
The content of each post of an IDiscussionItem is saved in a file with the extension .replies

DISCUSSION_REPLY_EXTENSION

public static final java.lang.String DISCUSSION_REPLY_EXTENSION
Method Detail

getUri

public RID getUri()
Deprecated. as of NW04. Replaced by getRid() method

Gets the RID of a discussion.
Returns:
The Uri value

getRid

public RID getRid()
Gets the RID of a discussion.
Returns:
The Uri value

getUri

public RID getUri(IDiscussionItem item)
Deprecated. as of NW04. Replaced by getRid() method

Gets the RID of an IDiscussionItem. Passing null as an argument for item returns null.
Parameters:
item - instance of an IDiscussionItem
Returns:
the RID of the IDiscussionItem instance

withTopics

public boolean withTopics()
                   throws ResourceException
Gets a flag that indicates if the discussion is running with topics or without topic layer.
Returns:
true if service is configured to show topics or if the discussion has more than one topic even if the service is configured in the other way false if the service is configured not to display a topic layer and the current discussion has no or only a specific single topic
Throws:
ResourceException - if the discussion service for this discussion is not found

getDiscussionItem

public IDiscussionItem getDiscussionItem(RID itemRid)
                                  throws ResourceException
Gets the IDiscussionItem instance for the specified RID. Passing null as an argument for itemRid causes an exception.
Parameters:
itemRid - a RID instance related to a discussion item
Returns:
an IDiscussionItem instance related to the RID
Throws:
ResourceException - if no discussion item is found

createItem

public IDiscussionItem createItem(java.lang.String name,
                                  java.lang.String content,
                                  java.lang.String description)
                           throws ResourceException,
                                  WcmException
Creates first topic of a discussion thread (root discussion item also called topic). The resource for the specified discussion item (topic) is created. If the subscription service is enabled, a NEW_DISCUSSION_ITEM event is sent. The application property for the number of threads is updated. Passing null for the parameter name is best practise. A GUID will then be automatically generated. If you pass a value for name, then you have to take care, that each value you pass for a topic is unique. Passing null as an argument for description throws an exception, because the description is mandatory for topics. If content is null, the content of the resource is empty.
Parameters:
name - is the GUID of the root discussion item, generated by URIMapper
content - is the content of the root discussion item
description - is the title of the root discussion item
Returns:
an IDiscussionItem instance
Throws:
WcmException - if an argument is set to null or if no event for subscription service can be sent
ResourceException - if no resource for discussion item can be created

editItem

public void editItem(IDiscussionItem item,
                     java.lang.String content,
                     java.lang.String description)
              throws WcmException
Edits a discussion item. The resource content and description is modified. If the subscription service is enabled, a CHANGE_DISCUSSION_ITEM event is sent.
Parameters:
item - is the IDiscussionItem to be modified
content - is the content of the root discussion item
description - is the title of the root discussion item
Throws:
WcmException - if no event for subscription service can be sent

createSingleTopic

public IDiscussionItem createSingleTopic()
                                  throws ResourceException,
                                         WcmException
Creates first topic of a discussion thread (root discussion item also called topic). The resource for the specified discussion item (topic) is created. If the discussion service is running without topic level, the discussion has a special single topic which is not displayed at all. The discussion thread is set below of this single topic. The single topic has a specific description, that has to be always the same for all discussions running without topic level. If the subscription service is enabled, a NEW_DISCUSSION_ITEM event is sent. The application property for the number of threads is updated.
Returns:
an IDiscussionItem instance
Throws:
WcmException - if no event for subscription service can be sent
ResourceException - if no resource for discussion item can be created

isSingleTopic

public boolean isSingleTopic(IDiscussionItem item)
                      throws ResourceException
Returns true if specified IDiscussionItem is a discussion topic and has the same description as a single topic.
Parameters:
item - is an IDiscussionItem instance
Returns:
true if the specified item is a single topic
Throws:
ResourceException - if the specified item has no type or no description.

createItem

public IDiscussionItem createItem(IDiscussionItem parent,
                                  java.lang.String name,
                                  java.lang.String content,
                                  java.lang.String description)
                           throws ResourceException,
                                  WcmException
Creates a discussion item within a thread. This is a discussion post.
Parameters:
parent - is an IDiscussionItem instance that is the parent of the item created
name - is the GUID of the root discussion item, generated by URIMapper
content - is the content of the discussion item
description - is the title of the discussion item
Returns:
an IDiscussionItem instance
Throws:
WcmException - if an argument is set to null or if no event for subscription service can be sent
ResourceException - if no resource for discussion item can be created

deleteItem

public void deleteItem(IDiscussionItem item)
                throws ResourceException,
                       AuthorizationRequiredException,
                       WcmException
Deletes a discussion item. Subscription events are sent and application properties are set.
Parameters:
item - IDiscussionItem to be deleted
Throws:
ResourceException - if the IDiscussionItem cannot be located
AuthorizationRequiredException - if the user is not authorized to delete the IDiscussionItem
WcmException - Exception raised in failure situation

deleteItemReplies

public void deleteItemReplies(IDiscussionItem item)
                       throws ResourceException,
                              AuthorizationRequiredException,
                              WcmException
Deletes a the replies folder of discussion item. Subscription events are sent and application properties are set.
Parameters:
item - IDiscussionItem to be deleted
Throws:
ResourceException - if the IDiscussionItem cannot be located
AuthorizationRequiredException - if the user is not authorized to delete the IDiscussionItem
WcmException - Exception raised in failure situation

deleteItemReplies

public void deleteItemReplies(IResource itemResource)
                       throws ResourceException,
                              AuthorizationRequiredException,
                              WcmException
Deletes a the replies folder of discussion item. Subscription events are sent and application properties are set. This method is used within PRE_DELETE period of a resource.
Parameters:
itemResource - IResource to be deleted
Throws:
ResourceException - if the IDiscussionItem cannot be located
AuthorizationRequiredException - if the user is not authorized to delete the IDiscussionItem
WcmException - Exception raised in failure situation

getThreads

public IDiscussionItemList getThreads()
                               throws ResourceException
Deprecated. as of NW04. Replaced by getTopics()

Gets all threads that belong to the discussion. These are all the topics for a discussion.
Returns:
list of IDiscussionItem
Throws:
ResourceException - if the IDiscussionItem cannot be located

getTopics

public IDiscussionItemList getTopics()
                              throws ResourceException
Gets all topics that belong to the discussion. The method never returns null. If the discussion has no topics an empty list will be returned.
Returns:
list of IDiscussionItem
Throws:
ResourceException - if the IDiscussionItem cannot be located

getTopics

public IDiscussionItemList getTopics(java.lang.String sortCriterion,
                                     java.lang.String sortDirection)
                              throws ResourceException
Gets all topics that belong to the discussion. List is sorted by criterion and direction. The method never returns null. If the discussion has no topics an empty list will be returned.
Parameters:
sortCriterion - Criterion for sorting, default is "Age", other is "Author"
sortDirection - 1 for ascending (default), 0 for descending
Returns:
a list of topics (a page), sorted by criterion
Throws:
ResourceException - if the IDiscussionItem cannot be located

getTopics

public IDiscussionItemList getTopics(java.lang.String sortCriterion,
                                     java.lang.String sortDirection,
                                     int startIndex,
                                     int length)
                              throws ResourceException
Gets set of topics that belong to the discussion. List is sorted by criterion and direction. The method never returns null. If the discussion has no topics an empty list will be returned.
Parameters:
sortCriterion - Criterion for sorting, default is "Age", other is "Author"
sortDirection - 1 for ascending (default), 0 for descending
startIndex - the first item of a page
length - the page length
Returns:
a list of topics (a page), sorted by criterion
Throws:
ResourceException - if the IDiscussionItem cannot be located

getNumberOfThreads

public int getNumberOfThreads()
                       throws ResourceException
Deprecated. as of NW04. Replaced by getNumberOfTopics()

Gets the number of threads that belong to the discussion.
Returns:
the number of threads as an integer
Throws:
ResourceException - if the IDiscussionItem cannot be located

getNumberOfTopics

public int getNumberOfTopics()
                      throws ResourceException
Gets the number of threads that belong to the discussion.
Returns:
the number of threads as an integer
Throws:
ResourceException - if the IDiscussionItem cannot be located

getChildren

public IDiscussionItemList getChildren(IDiscussionItem item)
                                throws ResourceException
Deprecated. as of NW04. Replaced by method of IDiscussionItem

Gets all replies to one IDiscussionItem.
Parameters:
item - gets all replies for this IDiscussionItem
Returns:
an instance of IDiscussionItemList which contains the discussion items
Throws:
ResourceException - if the IDiscussionItem cannot be located

hasChildren

public boolean hasChildren(IDiscussionItem item)
                    throws ResourceException
Deprecated. as of NW04. Replaced by the hasChildren() of the IDiscussion interface

Gets flag that shows whether discussion item has replies.
Parameters:
item - The IDiscussionItem for which the replies are returned
Returns:
returns true if the IDiscussionItem has replies, if not, returns false
Throws:
ResourceException - if the IDiscussionItem cannot be located

getParent

public IDiscussionItem getParent(IDiscussionItem item)
                          throws ResourceException
Deprecated. as of NW04. Replaced by getParent method at IDiscussionItem

Gets the parent discussion item for a particular IDiscussionItem. It returns, for example, the topic of a reply.
Parameters:
item - IDiscussionItem that is a sub-item of another IDiscussionItem
Returns:
IDiscussionItem, the parent item
Throws:
ResourceException - if the IDiscussionItem cannot be located

getReplyUri

public RID getReplyUri(RID itemRid)
Gets RID of the folder that contains the replies for the specified RID of an IDiscussionItem .
Parameters:
itemRid - RID of an IDiscussionItem
Returns:
RID to a folder that contains all replies for the related IDiscussionItem

setResourceContext

public void setResourceContext(IResourceContext context)
Sets the context for a discussion resource. The context object contains information about the user, the country settings etc.
Parameters:
context - Context of the IDiscussionItem

getResourceContext

public IResourceContext getResourceContext()
Gets context of a discussion resource.
Returns:
IResourceContext Context of a discussion resource

setResource

public void setResource(IResource resource)
Sets primary resource of the discussion.
Parameters:
resource - the new resource value

getResource

public IResource getResource()
Gets primary resource of the discussion.
Returns:
IResource the primary resource of the discussion

getPrimaryResource

public IResource getPrimaryResource()
                             throws ResourceException
Gets primary resource of the discussion.
Returns:
IResource the primary resource of the discussion

canAccessDiscussion

public boolean canAccessDiscussion()
Checks is user has read permission on discussion primary resource to access discussion.
Returns:
true, if user has read permission

canCreateItem

public boolean canCreateItem()
Checks is user has read permission on discussion primary resource to access discussion.
Returns:
true, if creation of an item is allowed

canDeleteItem

public boolean canDeleteItem(IDiscussionItem topic)
                      throws ResourceException
Checks if the deletion of a topic discussion item is possible. A deletion is not allowed for anonymous user. Authors of a topic which has no children can delete the topic. And adminstrators with collaboration service rights can delete items in general.
Parameters:
topic - a topic discussion item instance
Returns:
true, if deletion is allowed
Throws:
ResourceException - if item resource is not found

canUseSubscription

public boolean canUseSubscription()
Checks if a subscription to the discussion is possible
Returns:
ture, is subscription service can be used

isSubscribed

public boolean isSubscribed()
                     throws WcmException
Checks if a subscription for this discussion exists.
Returns:
The Subscribed value
Throws:
WcmException - Exception raised in failure situation

canAddFavorites

public boolean canAddFavorites()
Checks if user can add discussion to her favorites.
Returns:
true, is user can add discussion to its favorites

getDiscussionManager

public IDiscussionManager getDiscussionManager()
                                        throws ResourceException
Gets DiscussionManager for interactions between discussion classes.
Returns:
The DiscussionManager value

SAP NetWeaver '04

Copyright © 2004 by SAP AG. All Rights Reserved.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.