***  This class provides Binary Compatibility only, not Source Compatibility  ***

com.sas.services.information.metadata
Class Comment

com.sas.services.information.metadata.Comment
All Implemented Interfaces:
CommentInterface, java.io.Serializable, java.rmi.Remote

public class Comment
implements CommentInterface, java.io.Serializable

Represents a comment in a discussion thread

Since:
1.1
See Also:
Serialized Form

Constructor Summary
Comment()
          Creates a new comment.
Comment(UserContextInterface author, java.lang.String text)
          Creates a new comment with the author coming from the user context.
Comment(UserContextInterface author, java.lang.String text, boolean secret)
          Creates a new private comment with the author coming from the user context.
 
Method Summary
 void addAttachment(java.lang.String name, java.lang.String desc, java.lang.String mimeType, java.io.InputStream content)
          Add an attachment to the comment.
 void delete()
          Delete the comment - only available to the owner of the comment group
 java.lang.String formatComment(java.lang.String xsl)
          Format the content of the comment with the transformation
 java.util.List getAttachments()
          Returns the list of attachments for this comment
 java.lang.String getAuthor()
          Get the comment author
 java.lang.String getText()
          Get the comment text
 long getTimestamp()
          Get the comment timestamp
 java.lang.String getTimestamp(java.text.DateFormat dtFormat)
          Get the formatted comment timestamp
 boolean hasAttachments()
          Does the comment have an attachment?
 boolean isPrivate()
          Returns whether this comment is private or not
 void setAuthor(java.lang.String author)
          Sets the author for a comment.
 void setText(java.lang.String text)
          Sets the text for a comment.
 void setTimeStamp(long timestamp)
          Sets the timestamp for a comment.
 java.lang.String toString()
          Format a comment for processing as a String.
 

Constructor Detail

Comment

public Comment()
        throws java.rmi.RemoteException
Creates a new comment. Reserved for internal use.

Throws:
java.rmi.RemoteException - In the event of remote object failure.

Comment

public Comment(UserContextInterface author,
               java.lang.String text)
        throws java.rmi.RemoteException
Creates a new comment with the author coming from the user context. This is the preferred way of creating comments.

Parameters:
author - The user context under which the comment is authored
text - The text of the comment
Throws:
java.rmi.RemoteException - in the event of remote object failure.

Comment

public Comment(UserContextInterface author,
               java.lang.String text,
               boolean secret)
        throws java.rmi.RemoteException
Creates a new private comment with the author coming from the user context. This is the preferred way of creating comments.

Parameters:
author - The user context under which the comment is authored
text - The text of the comment
secret - Is this a private comment or not?
Throws:
java.rmi.RemoteException - in the event of remote object failure.
Method Detail

getText

public java.lang.String getText()
                         throws java.rmi.RemoteException
Description copied from interface: CommentInterface
Get the comment text

Specified by:
getText in interface CommentInterface
Returns:
String The comment text
Throws:
java.rmi.RemoteException - In the event of remote object failure.

getTimestamp

public java.lang.String getTimestamp(java.text.DateFormat dtFormat)
                              throws java.rmi.RemoteException
Description copied from interface: CommentInterface
Get the formatted comment timestamp

Specified by:
getTimestamp in interface CommentInterface
Parameters:
dtFormat - A DateFormat with which to format the comment timestamp
Returns:
String The formatted timestamp
Throws:
java.rmi.RemoteException - In the event of remote object failure.

getTimestamp

public long getTimestamp()
                  throws java.rmi.RemoteException
Description copied from interface: CommentInterface
Get the comment timestamp

Specified by:
getTimestamp in interface CommentInterface
Returns:
long The timestamp when the comment was initially created
Throws:
java.rmi.RemoteException - In the event of remote object failure.

getAuthor

public java.lang.String getAuthor()
                           throws java.rmi.RemoteException
Description copied from interface: CommentInterface
Get the comment author

Specified by:
getAuthor in interface CommentInterface
Returns:
String The comment author
Throws:
java.rmi.RemoteException - In the event of remote object failure.

hasAttachments

public boolean hasAttachments()
                       throws java.rmi.RemoteException
Description copied from interface: CommentInterface
Does the comment have an attachment?

Specified by:
hasAttachments in interface CommentInterface
Returns:
boolean True if there are attachments, false otherwise
Throws:
java.rmi.RemoteException - In the event of remote object failure.

getAttachments

public java.util.List getAttachments()
                              throws java.rmi.RemoteException
Description copied from interface: CommentInterface
Returns the list of attachments for this comment

Specified by:
getAttachments in interface CommentInterface
Returns:
List(of AttachmentInterface) The list of attachments for this comment
Throws:
java.rmi.RemoteException - In the event of remote object failure.

addAttachment

public void addAttachment(java.lang.String name,
                          java.lang.String desc,
                          java.lang.String mimeType,
                          java.io.InputStream content)
                   throws java.rmi.RemoteException
Description copied from interface: CommentInterface
Add an attachment to the comment. Multiple attachments can be made to each comment

Specified by:
addAttachment in interface CommentInterface
Parameters:
name - A name for this attachment
desc - A description for this attachment
mimeType - A MIME type for this attachment
content - An input stream with the content for this attachment
Throws:
java.rmi.RemoteException - In the event of remote object failure.

formatComment

public java.lang.String formatComment(java.lang.String xsl)
                               throws java.rmi.RemoteException
Description copied from interface: CommentInterface
Format the content of the comment with the transformation

Specified by:
formatComment in interface CommentInterface
Parameters:
xsl - The XSL transformation to use to format the comment.
Returns:
The formatted comment string.
Throws:
java.rmi.RemoteException - In the event of remote object failure.

delete

public void delete()
            throws java.rmi.RemoteException
Description copied from interface: CommentInterface
Delete the comment - only available to the owner of the comment group

Specified by:
delete in interface CommentInterface
Throws:
java.rmi.RemoteException - In the event of remote object failure.

setTimeStamp

public void setTimeStamp(long timestamp)
                  throws java.lang.IllegalStateException,
                         java.rmi.RemoteException
Description copied from interface: CommentInterface
Sets the timestamp for a comment. This method may only be called if the timestamp is missing. If it has already set then an illegalStateException is thrown. The preferred method of creating a comment is to use the non-default constructor

Specified by:
setTimeStamp in interface CommentInterface
Parameters:
timestamp - The timestamp for the comment
Throws:
java.lang.IllegalStateException - If the timestamp has already been set once.
java.rmi.RemoteException - In the event of remote object failure.

setAuthor

public void setAuthor(java.lang.String author)
               throws java.lang.IllegalStateException,
                      java.rmi.RemoteException
Description copied from interface: CommentInterface
Sets the author for a comment. This method may only be called if the author is missing. If it has already set then an illegalStateException is thrown. The preferred method of creating a comment is to use the non-default constructor

Specified by:
setAuthor in interface CommentInterface
Parameters:
author - The author for the comment
Throws:
java.lang.IllegalStateException - If the author has already been set once.
java.rmi.RemoteException - In the event of remote object failure.

setText

public void setText(java.lang.String text)
             throws java.lang.IllegalStateException,
                    java.rmi.RemoteException
Description copied from interface: CommentInterface
Sets the text for a comment. This method may only be called if the comment text is missing. If it has already set then an illegalStateException is thrown. The preferred method of creating a comment is to use the non-default constructor

Specified by:
setText in interface CommentInterface
Parameters:
text - The text for the comment
Throws:
java.lang.IllegalStateException - If the text is already been set once.
java.rmi.RemoteException - In the event of remote object failure.

isPrivate

public boolean isPrivate()
Description copied from interface: CommentInterface
Returns whether this comment is private or not

Specified by:
isPrivate in interface CommentInterface
Returns:
boolean True if comment is private, false otherwise

toString

public java.lang.String toString()
Format a comment for processing as a String. The format is [timestamp: (Author) Text]

Overrides:
toString in class java.lang.Object

***  This class provides Binary Compatibility only, not Source Compatibility  ***




Copyright © 2009 SAS Institute Inc. All Rights Reserved.