SAP NetWeaver '04

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

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

An IDiscussionItem is a contribution of a user to a discussion.
It consists of the attributes name, description, date, author and content. Important is that the name of the IDiscussionItem is a unique identifier in the wcm. The description of the IDiscussionItem is a name which can be displayed for the user.


Method Summary
 boolean canAddFavorites()
          Checks if user can add item to her favorites.
 boolean canDeleteChild(IDiscussionItem item)
          Checks if the deletion of a child discussion item is possible.
 boolean canReply()
          Checks if a reply to this item is possible or not.
 boolean canUseSubscription()
          Checks if a subscription for the discussion item is possible
 IProperty getAuthor()
          Gets the author of an IDiscussionItem.
 IDiscussionItemList getChildren()
          Gets all replies to this IDiscussionItem.
 IDiscussionItemList getChildren(IDiscussionItem branchItem)
           
 IContent getContent()
          Deprecated. as of NW04.
 IProperty getDate()
          Gets the creation date of the IDiscussionItem.
 java.lang.String getDescription()
          Gets the description of the IDiscussionItem.
 IDiscussionItem getLastPost()
          Gets last reply.
 IProperty getName()
          Gets the name of an IDiscussionItem.
 int getNumberOfPosts()
          Gets the number of posts that belong to discussion topic.
 int getNumberOfPosts(IDiscussionItem branchItem)
          Gets the number of posts that belong to discussion topic.
 IDiscussionItem getParent()
          Gets the parent IDiscussionItem instance.
 IDiscussionItemList getPosts(java.lang.String sortCriterion, java.lang.String sortDirection, IDiscussionItem branchItem, IDiscussionItem selectedItem, int startIndex, int length)
          Gets a set (page) of discussion items of a discussion topic.
 IDiscussionItemList getPostsInTreeOrder()
          Gets all discussion items of a discussion topic.
 java.lang.String getPostStartingText()
           
 ICollection getReplyCollection()
          Get the ReplyCollection attribute of the IDiscussionItem object.
 IResource getResource()
          Gets the discussion item as an IResource object.
 IResourceContext getResourceContext()
          Gets resource context of a discussion item.
 RID getRid()
          Gets the RID (better WcmPath); This is an identifier for the IDiscussionItem
 java.lang.String getSubject()
           
 IDiscussionItem getTopic()
          Gets the topic IDiscussionItem instance.
 DiscussionItemType getType()
          Gets the type of a discussion item.
 RID getUri()
          Deprecated. as of NW04. Replaced by getRid()
 boolean hasChildren()
          Gets flag that shows whether the discussion item has replies.
 boolean isSubscribed()
          Checks if a subscription for this item exists.
 void setContent(java.lang.String content)
          Deprecated. as of NW04.
 void setDescription(java.lang.String description)
          Sets the description of the IDiscussionItem.
 void setLastPost()
          Sets the last post attribute for a topic discussion item.
 void setLastPost(IDiscussionItem item)
          Sets the last post attribute for a topic discussion item.
 void setNumberOfPost(int value)
          Sets the absolute value for property, property set for topic resource
 void setNumberOfPosts(boolean increment, int increment_value)
          Sets the number of posts that belong to discussion topic.
 void setResourceContext(IResourceContext resourceContext)
          Sets the resource context of a discussion item.
 void setType(DiscussionItemType type)
          Sets the type of a discussion item.
 void setUri(RID uri)
          Sets the RID (better WcmPath); This is an identifier for a the IDiscussionItem.
 

Method Detail

getDescription

public java.lang.String getDescription()
                                throws ResourceException
Gets the description of the IDiscussionItem. The description is the name of an IDiscussionItem. The name is normally used for displaying the IDiscussionItem on the user interface.
Returns:
String the name of the IDiscussionItem
Throws:
ResourceException - if the actual resource is null and the ResourceFactory cannot get an instance of the actual resource

setDescription

public void setDescription(java.lang.String description)
                    throws WcmException
Sets the description of the IDiscussionItem. The description is the name for an IDiscussionItem. The name is normally used for displaying the IDiscussionItem on the user interface. The caller of the method is responsible for making sure that the argument for description is a valid instance.
Parameters:
description - the name of the IDiscussionItem
Throws:
WcmException - if the actual resource is null and the ResourceFactory cannot get an instance of the actual resource

getContent

public IContent getContent()
                    throws ResourceException,
                           AccessDeniedException
Deprecated. as of NW04.

Gets the text of the IDiscussionItem. This is the statement that an user posts to the discussion.
Returns:
an IContent instance that contains the user's text
Throws:
ResourceException - if the actual resource is null and the ResourceFactory cannot get an instance of the actual resource
AccessDeniedException - if the user has no access rights

setContent

public void setContent(java.lang.String content)
                throws WcmException
Deprecated. as of NW04.

Sets the text of the IDiscussionItem. This is the statement that an user posts to the discussion. Thecaller of the method is responsible that the argument for content is a valid instance.
Parameters:
content - contains the user's text
Throws:
WcmException - if the actual resource is ResourceFactory cannot get an instance of the actual resource

getName

public IProperty getName()
                  throws ResourceException
Gets the name of an IDiscussionItem. The name here is a GUID, which is a unique id for each IDiscussionItem.
Returns:
IProperty instance with the GUID of the IDiscussionItem; The GUID is an unique id of the IDiscussionItem
Throws:
ResourceException - if the actual resource is null and the ResourceFactory cannot get an instance of the actual resource

getAuthor

public IProperty getAuthor()
                    throws ResourceException
Gets the author of an IDiscussionItem.
Returns:
IProperty instance with author of the IDiscussionItem
Throws:
ResourceException - if the actual resource is null and the ResourceFactory cannot get an instance of the actual resource

getDate

public IProperty getDate()
                  throws ResourceException
Gets the creation date of the IDiscussionItem.
Returns:
an IProperty instance with the creation date of the IDiscussionItem
Throws:
ResourceException - if the actual resource is null and the ResourceFactory cannot get an instance of the actual resource

getResource

public IResource getResource()
                      throws ResourceException
Gets the discussion item as an IResource object. An IDiscussionItem has a name, description, date, author and content.
Returns:
an IResource instance representing a discussion item with name, description, content etc.
Throws:
ResourceException - if the actual resource is null and the ResourceFactory cannot get an instance of the actual resource

setUri

public void setUri(RID uri)
Sets the RID (better WcmPath); This is an identifier for a the IDiscussionItem. The caller of the method is responsible for making sure that the RID argument is a valid instance.
Parameters:
uri - The new Uri value

getUri

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

Gets the RID (better WcmPath); This is an identifier for the IDiscussionItem.
Returns:
a RID for the WcmPath

getRid

public RID getRid()
Gets the RID (better WcmPath); This is an identifier for the IDiscussionItem
Returns:
a RID for the WcmPath

setResourceContext

public void setResourceContext(IResourceContext resourceContext)
Sets the resource context of a discussion item. The resource context provides information about the client such as country information, user, and session. The caller of the method is responsible for making sure that the argument for resourceContext is a valid instance.
Parameters:
resourceContext - instance with client information

getResourceContext

public IResourceContext getResourceContext()
Gets resource context of a discussion item. The resource context provides information about the client such as locale, user, and session.
Returns:
IResourceContext instance with client information

getType

public DiscussionItemType getType()
                           throws ResourceException
Gets the type of a discussion item. Discussion items can be distinguished between topic and posts.
Returns:
The Type value
Throws:
ResourceException - Exception raised in failure situation

setType

public void setType(DiscussionItemType type)
             throws ResourceException
Sets the type of a discussion item. Discussion items can be distinguished between topic and posts.
Parameters:
type - The new Type value

getChildren

public IDiscussionItemList getChildren()
                                throws ResourceException
Gets all replies to this IDiscussionItem.
Returns:
an instance of IDiscussionItemList which contains the discussion items
Throws:
ResourceException - if the IDiscussionItem cannot be located

getChildren

public IDiscussionItemList getChildren(IDiscussionItem branchItem)
                                throws ResourceException,
                                       WcmException

hasChildren

public boolean hasChildren()
                    throws ResourceException
Gets flag that shows whether the discussion item has replies.
Returns:
returns true if the IDiscussionItem has replies, if not, returns false
Throws:
ResourceException - if the IDiscussionItem cannot be located

getNumberOfPosts

public int getNumberOfPosts(IDiscussionItem branchItem)
                     throws ResourceException
Gets the number of posts that belong to discussion topic. If a brach item is specified only the numper of posts of this branch is calculated.
Parameters:
branchItem - a branch item
Returns:
the number of posts as an integer
Throws:
ResourceException - if the IDiscussionItem cannot be located

getPostStartingText

public java.lang.String getPostStartingText()
                                     throws ResourceException

getNumberOfPosts

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

getPosts

public IDiscussionItemList getPosts(java.lang.String sortCriterion,
                                    java.lang.String sortDirection,
                                    IDiscussionItem branchItem,
                                    IDiscussionItem selectedItem,
                                    int startIndex,
                                    int length)
                             throws ResourceException
Gets a set (page) of discussion items of a discussion topic. It is possible to determine a page either of a branch or a specified discussion item. If a branch item is specified the method gets the branch of the specified discussion item. This is the subtree below this item, i.e. all recursive replies to it, and all parent item up to a specified root item. If a selected discussion item is specified, the page of this selected item is determined. First a branch of the replies structure is determined, if a branch item is specified. Second this list will be sorted by criterion and direction. Third a set of discussion items is determined, beginning from starting index with the specified length. If current discussion item is not a topic null is returned. If the topic has no posts, null is returned. If length is set to 0, no set is determined, all replies to the topic are returned. If the start index for a set is not known, startIndex has to be set to -1 and branchItem or selectedItem has to be specified.
Parameters:
sortCriterion - Criterion for sorting, default is "Age", other is "Author"
sortDirection - 1 for ascending (default), 0 for descending
branchItem - the branch IDiscussionItem
selectedItem - the selected IDiscussionItem
startIndex - the first item of a page
length - the page length
Returns:
The Posts value
Throws:
ResourceException - Exception raised in failure situation

getPostsInTreeOrder

public IDiscussionItemList getPostsInTreeOrder()
                                        throws ResourceException
Gets all discussion items of a discussion topic. The list of discussion items is ordered as we can see it typically for trees. It is mixture between structered and a chronolocal view. If a discussion item has children these are listed behind the item. The discussion items for every level are sorted by creation date. The method has to be used only for discussion topics.
Returns:
the list of discussion items
Throws:
ResourceException -  

getLastPost

public IDiscussionItem getLastPost()
                            throws WcmException
Gets last reply. If topic has no replies, null is returned.
Returns:
The LastPost value
Throws:
WcmException - Exception raised in failure situation

setNumberOfPosts

public void setNumberOfPosts(boolean increment,
                             int increment_value)
                      throws WcmException
Sets the number of posts that belong to discussion topic.
Parameters:
increment - true for increment, false for decrement
increment_value - the value how to increment or decrement
Throws:
WcmException - Exception raised if application property service is not available

setNumberOfPost

public void setNumberOfPost(int value)
                     throws WcmException
Sets the absolute value for property, property set for topic resource
Parameters:
value - The new NumberOfPosts value
Throws:
WcmException - Exception raised if application property service is not available

setLastPost

public void setLastPost(IDiscussionItem item)
Sets the last post attribute for a topic discussion item.
Parameters:
item - The new LastPost value

setLastPost

public void setLastPost()
Sets the last post attribute for a topic discussion item.

getReplyCollection

public ICollection getReplyCollection()
                               throws ResourceException
Get the ReplyCollection attribute of the IDiscussionItem object.
Returns:
The ReplyCollection value
Throws:
ResourceException - Exception raised in failure situation

getParent

public IDiscussionItem getParent()
                          throws ResourceException,
                                 WcmException
Gets the parent IDiscussionItem instance.
Returns:
The Parent value
Throws:
ResourceException - Exception raised in failure situation
WcmException - Exception raised in failure situation

getTopic

public IDiscussionItem getTopic()
                         throws WcmException
Gets the topic IDiscussionItem instance.
Returns:
The topic instance
Throws:
WcmException - Exception raised in failure situation

getSubject

public java.lang.String getSubject()
                            throws ResourceException

canReply

public boolean canReply()
Checks if a reply to this item is possible or not. A reply is allowed if user is not anonymous.
Returns:
true, if creation of a reply item is allowed

canDeleteChild

public boolean canDeleteChild(IDiscussionItem item)
                       throws ResourceException,
                              WcmException
Checks if the deletion of a child discussion item is possible. A deletion is not allowed for anonymous user. Authors of an item which has no children can delete their own discussion item. And adminstrators with collaboration service rights can delete items in general.
Parameters:
item - is the child discussion item to be deleted
Returns:
true, if deletion is allowed
Throws:
ResourceException - if item resource is not found
WcmException - if problems with RID of item occurs

canUseSubscription

public boolean canUseSubscription()
Checks if a subscription for the discussion item is possible

isSubscribed

public boolean isSubscribed()
                     throws WcmException
Checks if a subscription for this item exists.

canAddFavorites

public boolean canAddFavorites()
Checks if user can add item to her favorites.

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.