Clearspace API (2.0.15) Web Services Client Javadocs

com.jivesoftware.community.webservices
Class WSDocument

java.lang.Object
  extended by com.jivesoftware.community.webservices.WSJiveObject
      extended by com.jivesoftware.community.webservices.WSDocument

public class WSDocument
extends WSJiveObject

A Document object encapsulates a document in the Clearspace system. Each document can belong to one or more communities and consists of document fields, attachments, images, comments, ratings, relationships and properties. The main content of a document is held within the document body(text or binary) and document fields. The body of a Document object can either be textual or binary but not both. Having the body of a document be a binary object such as a pdf can be useful in a lot of situations especially if the document was created as part of an import process. Not all aspects of a document is versioned. The only changes that will trigger a new version of a document to be created are changes to the follow: author, language, title, body (text or binary), document fields, attachments or images. To get an instance of this class use the com.jivesoftware.community.DocumentManager#getDocument(String) method.


Field Summary
static int COMMENTS_CLOSED
          Comment status for documents that may have allowed comments in the past but presently do not accept comments.
static int COMMENTS_NONE
          Comment status for documents that do not accept comments.
static int COMMENTS_OPEN
          Comment status for documents that do accept comments.
 
Fields inherited from class com.jivesoftware.community.webservices.WSJiveObject
id, objectType
 
Constructor Summary
WSDocument()
           
 
Method Summary
 boolean equals(java.lang.Object o)
           
 int getAttachmentCount()
           
 int getAuthorCount()
          Returns the count of authors which have been added to this document.
 java.lang.String getBody()
          Returns the textual body of the document.
 int getCommentStatus()
          Returns the comment status of this document.
 long getContainerID()
           
 int getContainerType()
           
 java.util.Date getCreationDate()
          A convenience method which returns the date the document was originally created.
 java.lang.String getDocumentID()
          Returns the document ID corresponding to the document.
 java.lang.String getDocumentState()
           
 long getDocumentTypeID()
          Return the type of the document.
 java.util.Date getExpirationDate()
          Returns the date that the document is set to expire on.
 int getImageCount()
          Returns the number of images the document has.
 java.lang.String getLanguage()
          Return the ISO-639 code of the language associated with the document, or null if the document has no language specified (thus implying that it uses the global default language).
 java.util.Date getModificationDate()
          A convenience method which returns the date the document was last modified as determined by the version with a com.jivesoftware.community.DocumentState#PUBLISHED state, or if no version has that state the modification date of the current instance of the document.
 WSProperty[] getProperties()
          Returns the properties associated with this document.
 java.lang.String getSubject()
          Returns the title of the document.
 java.lang.String getUnfilteredSubject()
          Returns the document title, bypassing any active filters.
 long getUserID()
          Returns the user that authored the document.
 int getViewCount()
           
 int hashCode()
           
 boolean isAnonymous()
           
 boolean isApprovalEnabled()
           
 boolean isTextBody()
          Returns true if the body of the document is text, false if it's binary.
 boolean isTrackbacksEnabled()
           
 void setAnonymous(boolean anonymous)
           
 void setApprovalEnabled(boolean approvalEnabled)
           
 void setAttachmentCount(int attachmentCount)
           
 void setAuthorCount(int authorCount)
           
 void setBody(java.lang.String body)
           
 void setCommentStatus(int commentStatus)
           
 void setContainerID(long containerID)
           
 void setContainerType(int containerType)
           
 void setCreationDate(java.util.Date creationDate)
           
 void setDocumentID(java.lang.String documentID)
          Sets the document ID corresponding to the document.
 void setDocumentState(java.lang.String documentState)
           
 void setDocumentTypeID(long documentTypeID)
           
 void setExpirationDate(java.util.Date expirationDate)
          Sets the date the document should expire on.
 void setImageCount(int imageCount)
           
 void setLanguage(java.lang.String language)
          Sets the language of the document.
 void setModificationDate(java.util.Date modificationDate)
           
 void setProperties(WSProperty[] properties)
          Sets the properties associated with this document.
 void setSubject(java.lang.String subject)
          Sets the title of the document.
 void setTextBody(boolean textBody)
           
 void setTrackbacksEnabled(boolean trackbacksEnabled)
           
 void setUnfilteredSubject(java.lang.String unfilteredSubject)
           
 void setUserID(long userID)
          Returns the user that authored the document.
 void setViewCount(int viewCount)
           
 java.lang.String toString()
           
 
Methods inherited from class com.jivesoftware.community.webservices.WSJiveObject
getID, getObjectType, setID, setObjectType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

COMMENTS_NONE

public static final int COMMENTS_NONE
Comment status for documents that do not accept comments.

See Also:
Constant Field Values

COMMENTS_OPEN

public static final int COMMENTS_OPEN
Comment status for documents that do accept comments.

See Also:
Constant Field Values

COMMENTS_CLOSED

public static final int COMMENTS_CLOSED
Comment status for documents that may have allowed comments in the past but presently do not accept comments.

See Also:
Constant Field Values
Constructor Detail

WSDocument

public WSDocument()
Method Detail

isAnonymous

public boolean isAnonymous()

setAnonymous

public void setAnonymous(boolean anonymous)

getDocumentID

public java.lang.String getDocumentID()
Returns the document ID corresponding to the document.

A document ID is a way to reference a document using a company specific naming scheme such as ASE-2004-CE. Document ID's must be unique within the system.

Returns:
the document ID corresponding to the document, or null if the document hasn't been added to a community yet and no document ID has been specified.

setDocumentID

public void setDocumentID(java.lang.String documentID)
Sets the document ID corresponding to the document.

A document ID is a way to reference a document using a company specific naming scheme such as ASE-2004-CE. Document ID's must be unique within the system and are required - if no document ID is provided the system will generate one.

NOTE: It is not recommended to change the document ID for a document since this will likely break bookmarked URL's

Parameters:
documentID - the document ID to associate with the document.

getContainerType

public int getContainerType()

setContainerType

public void setContainerType(int containerType)

getContainerID

public long getContainerID()

setContainerID

public void setContainerID(long containerID)

getDocumentTypeID

public long getDocumentTypeID()
Return the type of the document. If no document type was specified when the document was created the default document type will be assigned.

Returns:
the document type associated with the document.

setDocumentTypeID

public void setDocumentTypeID(long documentTypeID)

getLanguage

public java.lang.String getLanguage()
Return the ISO-639 code of the language associated with the document, or null if the document has no language specified (thus implying that it uses the global default language).

Returns:
the ISO-639 code of the language associated with the document.

setLanguage

public void setLanguage(java.lang.String language)
Sets the language of the document. If no language was specified when the document was created the global default language will be used.

Parameters:
language - the IS0-639 language code

getUserID

public long getUserID()
Returns the user that authored the document. If the document was created anonymously, this method will return null.

Returns:
the author of the document.

setUserID

public void setUserID(long userID)
Returns the user that authored the document. If the document was created anonymously, this method will return null.

Parameters:
userID - the id of the user to change the ownership of the document to.
Throws:
UnauthorizedException - if the user does not have permission to modify the document.

getAuthorCount

public int getAuthorCount()
Returns the count of authors which have been added to this document. If zero, anyone with the appropriate permissions can edit the document.

Returns:
the count of authors which have been added to this document. If zero, anyone with the appropriate permissions can edit the document.

setAuthorCount

public void setAuthorCount(int authorCount)

getCreationDate

public java.util.Date getCreationDate()
A convenience method which returns the date the document was originally created. To obtain the creation date of a particular version of a document use the com.jivesoftware.community.DocumentVersion#getCreationDate() instead.

Returns:
the date the document was originally created.

setCreationDate

public void setCreationDate(java.util.Date creationDate)

getExpirationDate

public java.util.Date getExpirationDate()
Returns the date that the document is set to expire on. This method will return null if the expiry date is not set.

Returns:
the date the document is set to expire.

setExpirationDate

public void setExpirationDate(java.util.Date expirationDate)
Sets the date the document should expire on. By default the date is not set.

Parameters:
expirationDate - the date the document should expire on.

getSubject

public java.lang.String getSubject()
Returns the title of the document.

Returns:
the title of the document.

setSubject

public void setSubject(java.lang.String subject)
Sets the title of the document.

Parameters:
subject - the title of the document.

getUnfilteredSubject

public java.lang.String getUnfilteredSubject()
Returns the document title, bypassing any active filters. Because filters often provide security, this method should be used with caution. In particular, you should avoid showing unfiltered data in an environment where embedded HTML might be interpreted.

Unfiltered content is necessary for a few reasons. One is when saving document content to another persistence mechanism such as an XML format.

Returns:
the unfiltered title of the document.

setUnfilteredSubject

public void setUnfilteredSubject(java.lang.String unfilteredSubject)

isTextBody

public boolean isTextBody()
Returns true if the body of the document is text, false if it's binary.

Returns:
true if the body of the document is text, false if it's binary.

setTextBody

public void setTextBody(boolean textBody)

getBody

public java.lang.String getBody()
Returns the textual body of the document. If the document has a binary body this method will return null.

Returns:
the textual body of the document if it exists, or null otherwise.

setBody

public void setBody(java.lang.String body)

getAttachmentCount

public int getAttachmentCount()

setAttachmentCount

public void setAttachmentCount(int attachmentCount)

getImageCount

public int getImageCount()
Returns the number of images the document has.

Returns:
the number of images the document has.

setImageCount

public void setImageCount(int imageCount)

getCommentStatus

public int getCommentStatus()
Returns the comment status of this document. The status may be any one of the following: Defaults to OPEN.

Returns:
status the comment status of this document

setCommentStatus

public void setCommentStatus(int commentStatus)

isTrackbacksEnabled

public boolean isTrackbacksEnabled()

setTrackbacksEnabled

public void setTrackbacksEnabled(boolean trackbacksEnabled)

isApprovalEnabled

public boolean isApprovalEnabled()

setApprovalEnabled

public void setApprovalEnabled(boolean approvalEnabled)

getModificationDate

public java.util.Date getModificationDate()
A convenience method which returns the date the document was last modified as determined by the version with a com.jivesoftware.community.DocumentState#PUBLISHED state, or if no version has that state the modification date of the current instance of the document.

When a document is first created, the date returned by this method is identical to the creation date.

Returns:
the date the document was last modified.

setModificationDate

public void setModificationDate(java.util.Date modificationDate)

getDocumentState

public java.lang.String getDocumentState()

setDocumentState

public void setDocumentState(java.lang.String documentState)

getProperties

public WSProperty[] getProperties()
Returns the properties associated with this document.

Returns:
the properties associated with this document.

setProperties

public void setProperties(WSProperty[] properties)
Sets the properties associated with this document.

Parameters:
properties - the properties associated with this document.

getViewCount

public int getViewCount()

setViewCount

public void setViewCount(int viewCount)

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class WSJiveObject

hashCode

public int hashCode()
Overrides:
hashCode in class WSJiveObject

toString

public java.lang.String toString()
Overrides:
toString in class WSJiveObject

Clearspace Project Page

Copyright © 1999-2007 Jive Software.