|
Clearspace API (1.7.0) Core Javadocs | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Document
A Document object encapsulates a document in Clearspace. Each document can belong to one community 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.
Changes to a Document object are not persisted to storage until
save() is called.To get an instance of this class use the
DocumentManager.getDocument(String) method.
| Field Summary | |
|---|---|
static int |
AUTHORSHIP_MULTIPLE
Constant defining authorship policy for this document. |
static int |
AUTHORSHIP_OPEN
Constant defining authorship policy for this document. |
static int |
AUTHORSHIP_SINGLE
Constant defining authorship policy for this document. |
static boolean |
TRACKBACKS_DEFAULT
The default trackback status for a document. |
| Fields inherited from interface com.jivesoftware.community.JiveContentObject |
|---|
BODY_FIELD, SUBJECT_FIELD |
| Method Summary | |
|---|---|
void |
addApprover(User user)
Adds a user as a document approver for this document. |
void |
addAuthor(User author)
Adds the supplied User as an author of this document. |
void |
addReviewer(User reviewer)
Adds the supplied User as a reviewer of this document. |
void |
approve(User user)
Marks this document as being approved by the specified user. |
java.io.InputStream |
asPDF()
Returns the contents of this document as a pdf. |
void |
deleteAllRatings()
Deletes all ratings associated with this document. |
java.util.Collection<ApprovalStatus> |
getApprovalStatus()
Returns a collection of ApprovalStatus objects. |
int |
getApproverCount()
Returns a count of all of the users that must approve this document before it reaches a PUBLISHED state when it is in a PENDING_APPROVAL state. |
JiveIterator<User> |
getApprovers()
Returns all of the users that must approve this document before it reaches a PUBLISHED state when it is in a PENDING_APPROVAL state. |
com.jivesoftware.community.CommentDelegator |
getAuthorCommentDelegator()
Retrieve a comment manager to manage document author comments. |
int |
getAuthorCount()
Returns the count of authors. |
JiveIterator<User> |
getAuthors()
Returns the Users who are allowed to edit the document. |
int |
getAuthorshipPolicy()
Returns the authorship policy of this document, one of AUTHORSHIP_OPEN, AUTHORSHIP_SINGLE, or AUTHORSHIP_MULTIPLE. |
BinaryBody |
getBinaryBody()
Returns the binary body of the document. |
java.lang.String |
getBody()
Returns the textual body of the document. |
com.jivesoftware.community.CommentDelegator |
getCommentDelegator()
Retrieve a comment manager to manage document comments. |
int |
getCommentStatus()
Returns the comment status of this document which may be any one of the following: NONE -- no comments allowed
OPEN -- comments are permitted
CLOSED -- comments were permitted but are not allowed now
Defaults to OPEN. |
Community |
getCommunity()
Returns the community of the document. |
java.util.Date |
getCreationDate()
A convenience method which returns the date the document was originally created. |
DocumentAttributes |
getDocumentAttributes()
Return the attributes of the document. |
DocumentFieldValue |
getDocumentFieldValue(DocumentField field)
Returns the value of the document field as a DocumentFieldValue object. |
java.util.Map<java.lang.String,DocumentFieldValue> |
getDocumentFieldValues()
Returns a map of DocumentField -> DocumentFieldValue for the document. |
java.lang.String |
getDocumentID()
Returns the document ID corresponding to the document. |
DocumentState |
getDocumentState()
Return the state of the document. |
DocumentType |
getDocumentType()
Return the type of the document. |
DocumentVersion |
getDocumentVersion()
Returns a DocumentVersion object corresponding to the current instance. |
java.lang.String |
getEditGuest()
Returns the sessionID for the guest user editing the document, or null if the document is not currently being edited by a guest user. |
User |
getEditUser()
Returns the user editing the document, or null if the document is not currently being edited |
java.util.Date |
getExpirationDate()
Returns the date that the document is set to expire on. |
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 DocumentState.PUBLISHED state, or if no version has that state
the modification date of the current instance of the document. |
Permissions |
getPermissions(AuthToken auth)
Returns the permissions for the document that correspond to the passed-in AuthToken. |
PermissionsManager |
getPermissionsManager()
Returns a permissions manager that can be used to set permissions for the document. |
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
Retrieve a map of all the extended properties for the document. |
com.jivesoftware.community.RatingDelegator |
getRatingDelegator()
Retrieve a rating delegator to manage document ratings. |
int |
getReviewerCount()
Returns the count of reviewers which have been added to this document. |
JiveIterator<User> |
getReviewers()
Returns the Users who are intended to review the document. |
java.lang.String |
getSubject()
Returns the subject of the document. |
java.lang.String |
getSummary()
Returns the summary of the document. |
com.jivesoftware.community.TagDelegator |
getTagDelegator()
Retrieve a tag delegator to manage document tags. |
TrackbackManager |
getTrackbackManager()
Retrieve a trackback manager to manage document trackbacks. |
DocumentFieldValue |
getUnfilteredDocumentFieldValue(DocumentField field)
Returns the value of the document field bypassing any active filters. |
java.lang.String |
getUnfilteredProperty(java.lang.String name)
Returns an extended property of the document, bypassing any filters. |
java.lang.String |
getUnfilteredSummary()
Returns the document summary, bypassing any active filters. |
User |
getUser()
Returns the user that authored the document. |
VersionManager |
getVersionManager()
Returns the version manager for the document. |
int |
getViewCount()
Returns the number of times this document has been viewed. |
boolean |
hasApprovers()
Returns true if this document or its parent community has approvers. |
boolean |
isAnonymous()
Returns true if the document was created anonymously. |
boolean |
isAuthorized(long permissionType)
Returns true if the handle on the document has the permission specified. |
boolean |
isDocumentBeingEdited()
Returns true if the document is currently being editted by a user, false otherwise. |
boolean |
isInApproval()
Returns true if the document currently is in approval. |
boolean |
isMinorEdit()
If true, the next call to save() will result in a minor document version. |
boolean |
isTextBody()
Returns true if the body of the document is text, false if it's binary. |
boolean |
isTrackbacksEnabled()
Returns true if trackbacks are accepted on this blog post, false if not. |
void |
reject(User user)
Marks this document as being rejected by the specified user. |
void |
removeApprover(User user)
Removes the user as a document approver on this document. |
void |
removeAuthor(User author)
Removes the supplied User as an author of this document. |
void |
removeReviewer(User reviewer)
Removes the supplied User as a reviewer of this document. |
void |
save()
Changes to a document are not persisted until this method is called. |
void |
setAuthorshipPolicy(int policy)
Sets the authorship policy of this document, one of AUTHORSHIP_OPEN, AUTHORSHIP_SINGLE, or AUTHORSHIP_MULTIPLE. |
BinaryBody |
setBinaryBody(java.lang.String name,
java.lang.String contentType,
java.io.InputStream data)
Creates a new body object for the document. |
void |
setBody(java.lang.String body)
Sets the textual body of the document. |
void |
setCommentStatus(int status)
Sets the comment status of this document which may be any one of the following: NONE -- no comments allowed
OPEN -- comments are permitted
CLOSED -- comments were permitted but are not allowed now
|
void |
setDocumentFieldValue(DocumentField field,
DocumentFieldValue value)
Sets the value of the document field. |
void |
setDocumentID(java.lang.String documentID)
Sets the document ID corresponding to the document. |
void |
setDocumentState(DocumentState state)
Sets the state of the document. |
void |
setExpirationDate(java.util.Date expirationDate)
Sets the date the document should expire on. |
void |
setLanguage(java.lang.String language)
Sets the language of the document. |
void |
setMinorEdit(boolean minorEdit)
Set to true to cause the next call to save() to result in a minor document version. |
void |
setSubject(java.lang.String subject)
Sets the subject of the document. |
void |
setSummary(java.lang.String summary)
Sets the summary of the document. |
void |
setTrackbacksEnabled(boolean enable)
Enables and disables trackbacks for this blog post. |
void |
setUser(User user)
Returns the user that authored the document. |
void |
startEdit(java.lang.String sessionID)
Sets the sessionID of the editing guest user for the document. |
void |
startEdit(User user)
Sets the editing user for the document. |
void |
stopEdit(java.lang.String sessionID)
Set the guest user with the given sessionID as no longer editing the document. |
void |
stopEdit(User user)
Set the user as no longer editing the document. |
| Methods inherited from interface com.jivesoftware.community.JiveContentObject |
|---|
getIndexContent, getPlainBody, getPlainSubject, getUnfilteredBody, getUnfilteredSubject |
| Methods inherited from interface com.jivesoftware.community.JiveObject |
|---|
getID, getObjectType |
| Methods inherited from interface com.jivesoftware.community.AttachmentContentResource |
|---|
createAttachment, deleteAttachment, getAttachment, getAttachmentCount, getAttachments |
| Methods inherited from interface com.jivesoftware.community.ImageContentResource |
|---|
addImage, createImage, deleteImage, getImage, getImageCount, getImages |
| Field Detail |
|---|
static final int AUTHORSHIP_OPEN
static final int AUTHORSHIP_SINGLE
static final int AUTHORSHIP_MULTIPLE
static final boolean TRACKBACKS_DEFAULT
| Method Detail |
|---|
java.lang.String getDocumentID()
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.
void setDocumentID(java.lang.String documentID)
throws UnauthorizedException,
DuplicateIDException
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
documentID - the document ID to associate with the document.
UnauthorizedException - if the user does not have permission to modify the document.
DuplicateIDException - if the documentID already exists in the system.DocumentType getDocumentType()
DocumentTypeDocumentState getDocumentState()
DocumentState
void setDocumentState(DocumentState state)
throws UnauthorizedException,
DocumentAlreadyExistsException
DocumentState.PENDING_APPROVAL will be assigned. Setting
a state of DocumentState.PUBLISHED and calling save() will cause any other
version of the document in that state to be altered to have a state of
DocumentState.ARCHIVED.
Setting a document state of DocumentState.PUBLISHED may cause a
DocumentAlreadyExistsException to be thrown if the subject of the document is not
unique among the published documents in the community the document is contained within.
state - the new state of the document.
UnauthorizedException - if the user does not have permission to modify the document.
DocumentAlreadyExistsException - if the subject of the document is not unique in the communityDocumentAttributes getDocumentAttributes()
DocumentAttributesDocumentVersion getDocumentVersion()
int getAuthorshipPolicy()
void setAuthorshipPolicy(int policy)
throws UnauthorizedException
policy - the authorship policy of this document, one of AUTHORSHIP_OPEN, AUTHORSHIP_SINGLE, or AUTHORSHIP_MULTIPLE.
UnauthorizedException - if the user does not have permission to modify the document.
void save()
throws UnauthorizedException
getDocumentVersion()
will return a different version object than one obtained prior to calling this method. Users
of this api should call getDocumentVersion() after calling this method to determine if a
new version of the document was created or not. In addition, if no documentID was specified
when the document was created a new documentID will be assigned to the document replacing
the temporary ID that was assigned when the document was created.
Note that calling save on a document will not automatically mark the document as no longer being
editted by the user.
UnauthorizedException - if the user does not have permission to modify the document.
java.lang.IllegalStateException - if the document state is DocumentState.PUBLISHED and
not all of the required document fields have been set.java.lang.String getLanguage()
void setLanguage(java.lang.String language)
throws UnauthorizedException,
InvalidLanguageException
language - the IS0-639 language code
UnauthorizedException - if the user does not have permission to modify the document.
InvalidLanguageException - if the language code specified is not one of the language
codes allowed by the system configuration.boolean isAnonymous()
User getUser()
getUser in interface JiveContentObject
void setUser(User user)
throws UnauthorizedException
user - the user to change the ownership of the document to.
UnauthorizedException - if the user does not have permission to modify the document.int getAuthorCount()
AUTHORSHIP_OPEN.
AUTHORSHIP_OPEN.JiveIterator<User> getAuthors()
Users who are allowed to edit the document. If the AuthorshipPolicy is set to
AUTHORSHIP_OPEN, this method returns an empty iterator. If the AuthorshipPolicy is set to
AUTHORSHIP_SINGLE, this method returns an iterator containing only the result of getUser().
If the AuthorshipPolicy is set to AUTHORSHIP_MULTIPLE, this method returns an iterator
containing any users who have been added by addAuthor(com.jivesoftware.base.User), as well as the user returned by getUser().
Users who are allowed to edit the document.
void addAuthor(User author)
throws UnauthorizedException
User as an author of this document.
author - the User to add as an author.
UnauthorizedException - if the user does not have permission to modify the document.
void removeAuthor(User author)
throws UnauthorizedException
User as an author of this document.
author - the User to remove as an author.
UnauthorizedException - if the user does not have permission to modify the document.java.util.Date getCreationDate()
DocumentVersion.getCreationDate() instead.
getCreationDate in interface JiveContentObjectjava.util.Date getModificationDate()
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.
getModificationDate in interface JiveContentObjectjava.util.Date getExpirationDate()
void setExpirationDate(java.util.Date expirationDate)
throws UnauthorizedException
expirationDate - the date the document should expire on.
UnauthorizedException - if the user does not have permission to modify the document.java.lang.String getSubject()
getSubject in interface JiveContentObject
void setSubject(java.lang.String subject)
throws UnauthorizedException,
DocumentAlreadyExistsException
DocumentAlreadyExistsException thrown
however a published document that has the subject changed to be the same as a draft document
will not have a DocumentAlreadyExistsException thrown.
subject - the subject of the document.
UnauthorizedException - if the user does not have permission to modify the document.
DocumentAlreadyExistsException - if the subject of the document is not unique in the communityjava.lang.String getSummary()
java.lang.String getUnfilteredSummary()
Unfiltered content is necessary for a few reasons. One is when saving document content to another persistence mechanism such as an XML format.
void setSummary(java.lang.String summary)
throws UnauthorizedException
summary - the summary of the document.
UnauthorizedException - if the user does not have permission to modify the document.boolean isTextBody()
java.lang.String getBody()
getBody in interface JiveContentObject
void setBody(java.lang.String body)
throws UnauthorizedException
body - the textual body of the document.
UnauthorizedException - if the user does not have permission to modify the document.BinaryBody getBinaryBody()
BinaryBody setBinaryBody(java.lang.String name,
java.lang.String contentType,
java.io.InputStream data)
throws java.lang.IllegalStateException,
BinaryBodyException,
UnauthorizedException
name - the name of the new body object, usually the file name.contentType - the content type of the body object.data - an InputStream that contains the binary data of the body object. The stream will
never be closed so you must close it manually after calling this method.
BinaryBodyException - if an error occurred while creating the body object.
UnauthorizedException - if not allowed to modify the document.
java.lang.IllegalStateException - if the document hasn't yet been added to a community.BinaryBody,
BinaryBodyManagerjava.util.Map<java.lang.String,DocumentFieldValue> getDocumentFieldValues()
DocumentFieldValue getDocumentFieldValue(DocumentField field)
field - the document field to return the value for
java.lang.IllegalArgumentException - if the field doesn't exist in the document type associated
with the document.DocumentFieldValue getUnfilteredDocumentFieldValue(DocumentField field)
Since 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.
field - the document field to return the unfiltered value for
java.lang.IllegalArgumentException - if the field doesn't exist in the document type associated
with the document.
void setDocumentFieldValue(DocumentField field,
DocumentFieldValue value)
throws UnauthorizedException
DocumentFieldType.DataType.LIST_MULTI there may be more than one option in the
value parameter, otherwise only a single option or text value may be provided.
field - the document field to set the value for.value - a DocumentFieldValue object corresponding to the value of the field
UnauthorizedException - if the user does not have create permissions.
java.lang.IllegalArgumentException - if the field doesn't exist in the document type associated
with the document.Community getCommunity()
int getCommentStatus()
NONE -- no comments allowed
OPEN -- comments are permitted
CLOSED -- comments were permitted but are not allowed now
OPEN.
void setCommentStatus(int status)
throws UnauthorizedException
NONE -- no comments allowed
OPEN -- comments are permitted
CLOSED -- comments were permitted but are not allowed now
status - the comment status of this document
UnauthorizedException - if the user does not have permission to modify the document.com.jivesoftware.community.CommentDelegator getCommentDelegator()
com.jivesoftware.community.CommentDelegator getAuthorCommentDelegator()
throws UnauthorizedException
UnauthorizedException - if the user isn't allowed to edit the document and the user ins't an approverboolean isTrackbacksEnabled()
void setTrackbacksEnabled(boolean enable)
throws UnauthorizedException
enable - true to enable trackbacks, false to disable trackbacks
UnauthorizedException - if the user isn't allwed to edit the documentTrackbackManager getTrackbackManager()
com.jivesoftware.community.TagDelegator getTagDelegator()
com.jivesoftware.community.RatingDelegator getRatingDelegator()
int getViewCount()
PermissionsManager getPermissionsManager()
throws UnauthorizedException
UnauthorizedException - if user does not have administrator permissions for the
document.VersionManager getVersionManager()
Permissions getPermissions(AuthToken auth)
auth - the auth token to lookup permissions for.
boolean isAuthorized(long permissionType)
A list of possible permissions can be found in the
Permissions
and the Permissions classes. Certain methods of this class
are restricted to certain permissions as specified in the method comments.
permissionType - a permission type from the Permissions class.
Permissions,
Permissionsjava.util.Map<java.lang.String,java.lang.String> getProperties()
Values returned from the map are filtered through the filter system. To retrieve unfiltered property values use the
getUnfilteredProperty(String) method.If the user is not authorized to modify the document any method which modifies the map will fail with a UnsupportedOperationException;
java.lang.String getUnfilteredProperty(java.lang.String name)
Because properties are not filtered before being returned, this method should be used with caution. In particular, you should avoid showing unfiltered data in an environment where embedded HTML might be interpreted.
name - the name of the property to get.
void deleteAllRatings()
throws UnauthorizedException
UnauthorizedException - if the user isn't an adminint getReviewerCount()
JiveIterator<User> getReviewers()
Users who are intended to review the document.
Users who are intended to review the document.
void addReviewer(User reviewer)
throws UnauthorizedException
User as a reviewer of this document.
reviewer - the User to add as a reviewer.
UnauthorizedException - if the user does not have permission to modify the document.
void removeReviewer(User reviewer)
throws UnauthorizedException
User as a reviewer of this document.
reviewer - the User to remove as a reviewer.
UnauthorizedException - if the user does not have permission to modify the document.int getApproverCount()
JiveIterator<User> getApprovers()
void addApprover(User user)
throws UnauthorizedException
approve(com.jivesoftware.base.User) this document to before it will be changed to a PUBLISHED
status when it is edited.
user - The user to add as a document approver
UnauthorizedException - if the user does not have permission to modify the document.
void removeApprover(User user)
throws UnauthorizedException
user - The user to remove as a document approver.
UnauthorizedException - if the user does not have permission to modify the document.
void approve(User user)
throws UnauthorizedException
user - User to approve the document.
UnauthorizedException - if the user does not have permission to modify the document.
void reject(User user)
throws UnauthorizedException
user - User to reject the document.
UnauthorizedException - if the user does not have permission to modify the document.java.util.Collection<ApprovalStatus> getApprovalStatus()
ApprovalStatus objects. The ApprovalStatus objects
show which user has approved the Document and which hasn't.
ApprovalStatus documents.ApprovalStatusboolean hasApprovers()
boolean isInApproval()
boolean isDocumentBeingEdited()
User getEditUser()
java.lang.String getEditGuest()
void startEdit(User user)
throws UnauthorizedException,
java.lang.IllegalStateException
user - the editing user
UnauthorizedException - if the user does not have permission to modify the document.
java.lang.IllegalStateException - if another user (guest or otherwise) is currently editing the documentDocumentManager.getEditAutoExpireTimeout()
void startEdit(java.lang.String sessionID)
throws UnauthorizedException,
java.lang.IllegalStateException
sessionID - the sessionID of the editing guest user
UnauthorizedException - if the guest user does not have permission to modify the document.
java.lang.IllegalStateException - if another user (guest or otherwise) is currently editing the documentDocumentManager.getEditAutoExpireTimeout()
void stopEdit(User user)
throws UnauthorizedException
user - the editing user
UnauthorizedException - if the user does not have permission to modify the document.
void stopEdit(java.lang.String sessionID)
throws UnauthorizedException
sessionID - the sessionID of the editing guest user
UnauthorizedException - if the guest user does not have permission to modify the document.void setMinorEdit(boolean minorEdit)
save() to result in a minor document version.
No notifications will be sent to users watching the document.
minorEdit - true to cause the next call to save() to result in a minor document version.boolean isMinorEdit()
save() will result in a minor document version. No notifications will
be sent to users watching the document.
java.io.InputStream asPDF()
throws javax.xml.transform.TransformerException,
org.xml.sax.SAXException
javax.xml.transform.TransformerException - if an error occurs transforming the document
org.xml.sax.SAXException - if an error occurs parsing the document
|
Clearspace Project Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||