org.apache.chemistry.opencmis.client.runtime
Class DocumentImpl

java.lang.Object
  extended by org.apache.chemistry.opencmis.client.runtime.AbstractCmisObject
      extended by org.apache.chemistry.opencmis.client.runtime.AbstractFilableCmisObject
          extended by org.apache.chemistry.opencmis.client.runtime.DocumentImpl
All Implemented Interfaces:
Serializable, CmisObject, CmisObjectProperties, Document, DocumentProperties, FileableCmisObject, ObjectId

public class DocumentImpl
extends AbstractFilableCmisObject
implements Document

See Also:
Serialized Form

Constructor Summary
DocumentImpl(SessionImpl session, ObjectType objectType, ObjectData objectData, OperationContext context)
          Constructor.
 
Method Summary
 void cancelCheckOut()
          If this is a PWC (private working copy) the check out will be reversed.
 ObjectId checkIn(boolean major, Map<String,?> properties, ContentStream contentStream, String checkinComment)
          If this is a PWC (private working copy) it performs a check in.
 ObjectId checkIn(boolean major, Map<String,?> properties, ContentStream contentStream, String checkinComment, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
          If this is a PWC (private working copy) it performs a check in.
 ObjectId checkOut()
          Checks out the document and returns the object id of the PWC (private working copy).
 Document copy(ObjectId targetFolderId)
          Creates a copy of this document, including content.
 Document copy(ObjectId targetFolderId, Map<String,?> properties, VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces, OperationContext context)
          Creates a copy of this document, including content.
protected  TransientCmisObject createTransientCmisObject()
           
 void deleteAllVersions()
          Deletes this document and all its versions.
 Document deleteContentStream()
          Removes the current content stream from the document.
 ObjectId deleteContentStream(boolean refresh)
          Removes the current content stream from the document.
 List<Document> getAllVersions()
          Fetches all versions of this document.
 List<Document> getAllVersions(OperationContext context)
          Fetches all versions of this document using the given OperationContext.
 String getCheckinComment()
          Returns the checkin comment (CMIS property cmis:checkinComment).
 ContentStream getContentStream()
          Retrieves the content stream of this document.
 ContentStream getContentStream(String streamId)
          Retrieves the content stream that is associated with the given stream id.
 String getContentStreamFileName()
          Returns the content stream filename or null if the document has no content (CMIS property cmis:contentStreamFileName).
 String getContentStreamId()
          Returns the content stream id or null if the document has no content (CMIS property cmis:contentStreamId).
 long getContentStreamLength()
          Returns the content stream length or -1 if the document has no content (CMIS property cmis:contentStreamLength).
 String getContentStreamMimeType()
          Returns the content stream MIME type or null if the document has no content (CMIS property cmis:contentStreamMimeType).
 Document getObjectOfLatestVersion(boolean major)
          Fetches the latest major or minor version of this document.
 Document getObjectOfLatestVersion(boolean major, OperationContext context)
          Fetches the latest major or minor version of this document using the given OperationContext.
 TransientDocument getTransientDocument()
           
 String getVersionLabel()
          Returns the version label (CMIS property cmis:versionLabel).
 String getVersionSeriesCheckedOutBy()
          Returns the user who checked out this version series (CMIS property cmis:versionSeriesCheckedOutBy).
 String getVersionSeriesCheckedOutId()
          Returns the PWC id of this version series (CMIS property cmis:versionSeriesCheckedOutId).
 String getVersionSeriesId()
          Returns the version series id (CMIS property cmis:versionSeriesId).
 Boolean isImmutable()
          Returns true if this CMIS object is immutable (CMIS property cmis:isImmutable).
 Boolean isLatestMajorVersion()
          Returns true if this CMIS object is the latest major version (CMIS property cmis:isLatestMajorVersion).
 Boolean isLatestVersion()
          Returns if this CMIS object is the latest version (CMIS property cmis:isLatestVersion).
 Boolean isMajorVersion()
          Returns true if this CMIS object is the latest version (CMIS property cmis:isMajorVersion).
 Boolean isVersionSeriesCheckedOut()
          Returns true if this version series is checked out (CMIS property cmis:isVersionSeriesCheckedOut).
 Document setContentStream(ContentStream contentStream, boolean overwrite)
          Sets a new content stream for the document.
 ObjectId setContentStream(ContentStream contentStream, boolean overwrite, boolean refresh)
          Sets a new content stream for the document.
 
Methods inherited from class org.apache.chemistry.opencmis.client.runtime.AbstractFilableCmisObject
addToFolder, getParents, getPaths, move, removeFromFolder
 
Methods inherited from class org.apache.chemistry.opencmis.client.runtime.AbstractCmisObject
addAcl, applyAcl, applyPolicy, delete, getAcl, getAcl, getAdapter, getAllowableActions, getBaseType, getBaseTypeId, getBinding, getChangeToken, getCreatedBy, getCreationContext, getCreationDate, getExtensions, getId, getLastModificationDate, getLastModifiedBy, getName, getObjectFactory, getObjectId, getObjectType, getPolicies, getProperties, getProperty, getPropertyQueryName, getPropertyValue, getRefreshTimestamp, getRelationships, getRenditions, getRepositoryId, getSession, getTransientObject, getType, initialize, readLock, readUnlock, refresh, refreshIfOld, removeAcl, removePolicy, updateProperties, updateProperties, writeLock, writeUnlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.chemistry.opencmis.client.api.FileableCmisObject
addToFolder, getParents, getPaths, move, removeFromFolder
 
Methods inherited from interface org.apache.chemistry.opencmis.client.api.CmisObject
addAcl, applyAcl, applyPolicy, delete, getAcl, getAdapter, getAllowableActions, getExtensions, getPolicies, getRefreshTimestamp, getRelationships, getRenditions, getTransientObject, refresh, refreshIfOld, removeAcl, removePolicy, updateProperties, updateProperties
 
Methods inherited from interface org.apache.chemistry.opencmis.client.api.ObjectId
getId
 
Methods inherited from interface org.apache.chemistry.opencmis.client.api.CmisObjectProperties
getBaseType, getBaseTypeId, getChangeToken, getCreatedBy, getCreationDate, getLastModificationDate, getLastModifiedBy, getName, getProperties, getProperty, getPropertyValue, getType
 

Constructor Detail

DocumentImpl

public DocumentImpl(SessionImpl session,
                    ObjectType objectType,
                    ObjectData objectData,
                    OperationContext context)
Constructor.

Method Detail

createTransientCmisObject

protected TransientCmisObject createTransientCmisObject()
Overrides:
createTransientCmisObject in class AbstractCmisObject

getTransientDocument

public TransientDocument getTransientDocument()
Specified by:
getTransientDocument in interface Document

getCheckinComment

public String getCheckinComment()
Description copied from interface: DocumentProperties
Returns the checkin comment (CMIS property cmis:checkinComment).

Specified by:
getCheckinComment in interface DocumentProperties

getVersionLabel

public String getVersionLabel()
Description copied from interface: DocumentProperties
Returns the version label (CMIS property cmis:versionLabel).

Specified by:
getVersionLabel in interface DocumentProperties

getVersionSeriesId

public String getVersionSeriesId()
Description copied from interface: DocumentProperties
Returns the version series id (CMIS property cmis:versionSeriesId).

Specified by:
getVersionSeriesId in interface DocumentProperties

getVersionSeriesCheckedOutId

public String getVersionSeriesCheckedOutId()
Description copied from interface: DocumentProperties
Returns the PWC id of this version series (CMIS property cmis:versionSeriesCheckedOutId).

Specified by:
getVersionSeriesCheckedOutId in interface DocumentProperties

getVersionSeriesCheckedOutBy

public String getVersionSeriesCheckedOutBy()
Description copied from interface: DocumentProperties
Returns the user who checked out this version series (CMIS property cmis:versionSeriesCheckedOutBy).

Specified by:
getVersionSeriesCheckedOutBy in interface DocumentProperties

isImmutable

public Boolean isImmutable()
Description copied from interface: DocumentProperties
Returns true if this CMIS object is immutable (CMIS property cmis:isImmutable).

Specified by:
isImmutable in interface DocumentProperties

isLatestMajorVersion

public Boolean isLatestMajorVersion()
Description copied from interface: DocumentProperties
Returns true if this CMIS object is the latest major version (CMIS property cmis:isLatestMajorVersion).

Specified by:
isLatestMajorVersion in interface DocumentProperties

isLatestVersion

public Boolean isLatestVersion()
Description copied from interface: DocumentProperties
Returns if this CMIS object is the latest version (CMIS property cmis:isLatestVersion).

Specified by:
isLatestVersion in interface DocumentProperties

isMajorVersion

public Boolean isMajorVersion()
Description copied from interface: DocumentProperties
Returns true if this CMIS object is the latest version (CMIS property cmis:isMajorVersion).

Specified by:
isMajorVersion in interface DocumentProperties

isVersionSeriesCheckedOut

public Boolean isVersionSeriesCheckedOut()
Description copied from interface: DocumentProperties
Returns true if this version series is checked out (CMIS property cmis:isVersionSeriesCheckedOut).

Specified by:
isVersionSeriesCheckedOut in interface DocumentProperties

getContentStreamLength

public long getContentStreamLength()
Description copied from interface: DocumentProperties
Returns the content stream length or -1 if the document has no content (CMIS property cmis:contentStreamLength).

Specified by:
getContentStreamLength in interface DocumentProperties

getContentStreamMimeType

public String getContentStreamMimeType()
Description copied from interface: DocumentProperties
Returns the content stream MIME type or null if the document has no content (CMIS property cmis:contentStreamMimeType).

Specified by:
getContentStreamMimeType in interface DocumentProperties

getContentStreamFileName

public String getContentStreamFileName()
Description copied from interface: DocumentProperties
Returns the content stream filename or null if the document has no content (CMIS property cmis:contentStreamFileName).

Specified by:
getContentStreamFileName in interface DocumentProperties

getContentStreamId

public String getContentStreamId()
Description copied from interface: DocumentProperties
Returns the content stream id or null if the document has no content (CMIS property cmis:contentStreamId).

Specified by:
getContentStreamId in interface DocumentProperties

copy

public Document copy(ObjectId targetFolderId,
                     Map<String,?> properties,
                     VersioningState versioningState,
                     List<Policy> policies,
                     List<Ace> addAces,
                     List<Ace> removeAces,
                     OperationContext context)
Description copied from interface: Document
Creates a copy of this document, including content.

Specified by:
copy in interface Document
Returns:
the new document object or null if the parameter context was set to null

copy

public Document copy(ObjectId targetFolderId)
Description copied from interface: Document
Creates a copy of this document, including content.

Specified by:
copy in interface Document
Returns:
the new document object

deleteAllVersions

public void deleteAllVersions()
Description copied from interface: Document
Deletes this document and all its versions.

Specified by:
deleteAllVersions in interface Document

checkOut

public ObjectId checkOut()
Description copied from interface: Document
Checks out the document and returns the object id of the PWC (private working copy).

Specified by:
checkOut in interface Document
Returns:
PWC id

cancelCheckOut

public void cancelCheckOut()
Description copied from interface: Document
If this is a PWC (private working copy) the check out will be reversed. If this is not a PWC it an exception will be thrown.

Specified by:
cancelCheckOut in interface Document

checkIn

public ObjectId checkIn(boolean major,
                        Map<String,?> properties,
                        ContentStream contentStream,
                        String checkinComment,
                        List<Policy> policies,
                        List<Ace> addAces,
                        List<Ace> removeAces)
Description copied from interface: Document
If this is a PWC (private working copy) it performs a check in. If this is not a PWC it an exception will be thrown.

Specified by:
checkIn in interface Document
Returns:
new document id

getAllVersions

public List<Document> getAllVersions()
Description copied from interface: Document
Fetches all versions of this document.

Specified by:
getAllVersions in interface Document

getAllVersions

public List<Document> getAllVersions(OperationContext context)
Description copied from interface: Document
Fetches all versions of this document using the given OperationContext.

Specified by:
getAllVersions in interface Document

getObjectOfLatestVersion

public Document getObjectOfLatestVersion(boolean major)
Description copied from interface: Document
Fetches the latest major or minor version of this document.

Specified by:
getObjectOfLatestVersion in interface Document
Parameters:
major - if true the latest major version will be returned, otherwise the very last version will be returned
Returns:
the latest document object

getObjectOfLatestVersion

public Document getObjectOfLatestVersion(boolean major,
                                         OperationContext context)
Description copied from interface: Document
Fetches the latest major or minor version of this document using the given OperationContext.

Specified by:
getObjectOfLatestVersion in interface Document
Parameters:
major - if true the latest major version will be returned, otherwise the very last version will be returned
Returns:
the latest document object

getContentStream

public ContentStream getContentStream()
Description copied from interface: Document
Retrieves the content stream of this document.

Specified by:
getContentStream in interface Document
Returns:
the content stream, or null

getContentStream

public ContentStream getContentStream(String streamId)
Description copied from interface: Document
Retrieves the content stream that is associated with the given stream id. This is usually a rendition of the document.

Specified by:
getContentStream in interface Document
Returns:
the content stream, or null

setContentStream

public Document setContentStream(ContentStream contentStream,
                                 boolean overwrite)
Description copied from interface: Document
Sets a new content stream for the document.

Specified by:
setContentStream in interface Document

setContentStream

public ObjectId setContentStream(ContentStream contentStream,
                                 boolean overwrite,
                                 boolean refresh)
Description copied from interface: Document
Sets a new content stream for the document.

Specified by:
setContentStream in interface Document

deleteContentStream

public Document deleteContentStream()
Description copied from interface: Document
Removes the current content stream from the document.

Specified by:
deleteContentStream in interface Document

deleteContentStream

public ObjectId deleteContentStream(boolean refresh)
Description copied from interface: Document
Removes the current content stream from the document.

Specified by:
deleteContentStream in interface Document

checkIn

public ObjectId checkIn(boolean major,
                        Map<String,?> properties,
                        ContentStream contentStream,
                        String checkinComment)
Description copied from interface: Document
If this is a PWC (private working copy) it performs a check in. If this is not a PWC it an exception will be thrown.

Specified by:
checkIn in interface Document
Returns:
new document id


Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.