NAME

WebService::Cmis::Document - Representation of a cmis document

DESCRIPTION

Document objects are the elementary information entities managed by the repository. This class represents a document object as returned by a "getObject" in WebService::Cmis::Repository.

See CMIS specification document 2.1.4 Document Object

Parent class: WebService::Cmis::Object

METHODS

checkOut() -> $pwc

performs a checkOut on this document and returns the Private Working Copy (PWC), which is also an instance of Document

See CMIS specification document 2.2.7.1 checkOut

isCheckedOut() -> $boolean

Returns true if the document is checked out.

getCheckedOutBy() -> $userId

returns the ID who currently has the document checked out.

getPrivateWorkingCopy() -> $cmisDocument

retrieves the object using the object ID in the property: cmis:versionSeriesCheckedOutId then uses getObject to instantiate the object.

cancelCheckOut() -> $this

cancels the checkout of this object by retrieving the Private Working Copy (PWC) and then deleting it. After the PWC is deleted, this object will be reloaded to update properties related to a checkout.

See CMIS specification document 2.2.7.2 cancelCheckOut

checkIn($checkinComment, %params) -> $this

checks in this Document which must be a private working copy (PWC).

See CMIS specification document 2.2.7.3 checkIn

The following optional arguments are supported:

  • major

These aren't supported:

  • properties

  • contentStream

  • policies

  • addACEs

  • removeACEs

TODO: support repositories without PWCUpdate capabilities

getContentLink(%params) -> $url

returns the source link to this document

The params are added to the url.

getContentStream($streamId) -> $data

returns the CMIS service response from invoking the 'enclosure' link. it will return the binary content of the document stored on the server.

The optional argument:

  • streamId: id of the content rendition (TODO: not implemented yet)

See CMIS specification document 2.2.4.10 getContentStream

my $doc = $repo->getObjectByPath("/User homes/jeff/sample.pdf");
my $content = $doc->getContentStream;

my $FILE;
unless (open($FILE, '>', $name)) {
  die "Can't create file $name - $!\n";
}
print $FILE $text;
close($FILE);
getAllVersions(%params) -> $atomFeed

returns a AtomFeed` of document objects for the entire version history of this object, including any PWC's.

See CMIS specification document 2.2.7.5 getAllVersions

The optional filter and includeAllowableActions are supported.

TODO: is it worth caching these inside?

getRenditions(%params) -> %renditions

returns a hash of associated Renditions for the specified object. Only rendition attributes are returned, not rendition stream.

The following optional arguments are currently supported:

  • renditionFilter

  • maxItems

  • skipCount

A rendition has the following attributes:

  • streamId: Identifies the rendition stream

  • mimetype: The MIME type of the rendition stream

  • kind: A categorization String associated with the rendition

  • length: The length of the rendition stream in bytes (optional)

  • title: Human readable information about the rendition (optional)

  • height: Typically used for 'image' renditions (expressed as pixels). SHOULD be present if kind = cmis:thumbnail (optional)

  • width: Typically used for 'image' renditions (expressed as pixels). SHOULD be present if kind = cmis:thumbnail (optional)

  • renditionDocumentId: If specified, then the rendition can also be accessed as a document object in the CMIS services. If not set, then the rendition can only be accessed via the rendition services. Referential integrity of this ID is repository-specific. (optional)

See CMIS specification document 2.1.4.2 Renditions

TODO: use <link rel="alternate" ... />

getRenditionLink(%params)

returns a link to the documents rendition

Use the renditions properties to get a specific one (see "getRenditions"):

  • streamId

  • mimetype

  • kind

  • height

  • width

  • length

  • title

  • renditionDocumentId

my $doc = $repo->getObjectByPath("/User homes/jeff/sample.pdf");
my $thumbnailUrl => $doc->getRenditionLink(kind=>"thumbnail");
my $iconUrl = $doc->getRenditionLink(kind=>"icon", width=>16);
getLatestVersion(%params) -> $document

returns a cmis Document representing the latest version in the version series.

See CMIS specification document 2.2.7.4 getObjectOfLatestVersion

The following optional arguments are supported:

  • major

  • filter

  • includeRelationships

  • includePolicyIds

  • renditionFilter

  • includeACL

  • includeAllowableActions

$latestDoc = $doc->getLatestVersion;
$latestDoc = $doc->getLatestVersion(major=>1);

print $latestDoc->getProperty("cmis:versionLabel")."\n";
copy($targetFolder, $propertyList, $versionState) -> $cmisDocument

TODO: This is not yet implemented.

Creates a document object as a copy of the given source document in the (optionally) specified location.

The $targetFolder specifies the folder that becomes the parent of the new document. This parameter must be specified if the repository does not have the "unfiling" capability.

The $propertyList is a list of WebService::Cmis::Property objects optionally specifieds the propeties about to change in the newly created Document object.

Valid values for $versionState are:

  • none: the document is created as a non-versionable object

  • checkedout: the document is created in checked-out state

  • major (default): the document is created as a new major version

  • minor: the document is created as a minor version

The following optional arguments are not yet supported:

  • policies

  • addACEs

  • removeACEs

See CMIS specification document 2.2.4.2 (createDocumentFromSource)

getPropertiesOfLatestVersion

TODO: This is not yet implemented.

setContentStream(%params) -> $this

This sets the content stream of a document.

The following parameters are supported:

  • contentFile: the absolute path to the file to be used.

  • contentData: the data to be posted to the documents content stream link. use either contentFile or contentData.

  • contentType: the mime type of the data. will be guessed automatically if not specified manually.

  • overwriteFlag: if 'true' (default), replace the existing content stream. if 'false', set the input contentStream if the object currently does not have a content-stream.

  • changeToken

See CMIS specification document 2.2.4.18 setContentStream

deleteContentStream

TODO: This is not yet implemented.

See CMIS specification document 2.2.4.17 deleteContentStream

COPYRIGHT AND LICENSE

Copyright 2012-2013 Michael Daum

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/artistic.html.