Constructor
new Document(doc, opts)
Creates a Document.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
doc |
object | The initial document object. This Document object will be extended with doc properties. |
|||||||||
opts |
object | The configuration options. Properties
|
- Source:
Methods
addPermission(params, optsopt) → {Promise}
Adds a new permission.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
object | The params needed to add a new permission. Properties
|
|||||||||||||||||||||||||||||||||||||||||
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A promise object resolved with the updated document.
- Type
- Promise
convert(convertOpts, optsopt) → {Promise}
Converts a Blob from this document.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
convertOpts |
object | Configuration options for the conversion. Properties
|
||||||||||||||||||||||||||
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A promise object resolved with the response.
- Type
- Promise
fetchACLs(optsopt) → {Promise}
Fetches the ACLs list of this document.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A promise object resolved with the ACLs.
- Type
- Promise
fetchAudit(queryOptsopt, optsopt) → {Promise}
Fetches the audit of the document.
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
queryOpts |
object |
<optional> |
Parameters for the audit query. Properties
|
|||||||||||||||||||||
queryParams.endEventDate |
object |
<optional> |
End date |
|||||||||||||||||||||
queryOpts.pageSize |
number |
<optional> |
0 | The number of results per page. |
||||||||||||||||||||
queryOpts.currentPageIndex |
number |
<optional> |
0 | The current page index. |
||||||||||||||||||||
queryOpts.maxResults |
number |
<optional> |
The expected max results. |
|||||||||||||||||||||
queryOpts.sortBy |
string |
<optional> |
The sort by info. |
|||||||||||||||||||||
queryOpts.sortOrder |
string |
<optional> |
The sort order info. |
|||||||||||||||||||||
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A promise object resolved with audit entries.
- Type
- Promise
fetchBlob(xpathopt, optsopt) → {Promise}
Fetch a Blob from this document.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
xpath |
string |
<optional> |
blobholder:0 | The Blob xpath. Default to the main blob 'blobholder:0'. |
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A promise object resolved with the response.
- Type
- Promise
fetchLockStatus(optsopt) → {Promise}
Fetches the lock status of the document.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A promise object resolved with true or false.
- Type
- Promise
Examples
// if the doc is locked
doc.fetchLockStatus()
.then(function(status) {
// status.lockOwner === 'Administrator'
// status.lockCreated === '2011-10-23T12:00:00.00Z'
});
// if the doc is not locked
doc.fetchLockStatus()
.then(function(status) {
// status.lockOwner === undefined
// status.lockCreated === undefined
});
fetchRendition(name, optsopt) → {Promise}
Fetch a rendition from this document.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | The rendition name. |
|
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A promise object resolved with the response.
- Type
- Promise
fetchRenditions(optsopt) → {Promise}
Fetches the renditions list of this document.
Only available on Nuxeo version LTS 2016 or later.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A promise object resolved with the rendition definitions.
- Type
- Promise
fetchWorkflows(optsopt) → {Promise}
Fetches the started workflows on this document.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A promise object resolved with the started workflows.
- Type
- Promise
followTransition(transitionName, optsopt) → {Promise}
Follows a given life cycle transition.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transitionName |
string | The life cycle transition to follow. |
|
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A promise object resolved with the updated document.
- Type
- Promise
get(propertyName) → {Document}
Gets a document property.
Parameters:
Name | Type | Description |
---|---|---|
propertyName |
string | The property name, such as 'dc:title', 'file:filename', ... |
- Source:
Returns:
- Type
- Document
hasFacet() → {Boolean}
Returns whether this document has the input facet or not.
- Source:
Returns:
true if this document has the facet, false otherwise.
- Type
- Boolean
hasPermission(optsopt) → {Promise}
Checks if the user has a given permission. It only works for now for 'Write', 'Read' and 'Everything' permission.
This method may call the server to compute the available permissions (using the 'permissions' enricher)
if not already present.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A promise object resolved with true or false.
- Type
- Promise
isCollectable() → {Boolean}
Returns whether this document can be added to a collection or not.
- Source:
Returns:
true if this document can be added to a collection, false otherwise.
- Type
- Boolean
isCollection() → {Boolean}
Returns whether this document is a collection or not.
- Source:
Returns:
true if this document is a collection, false otherwise.
- Type
- Boolean
isFolder() → {Boolean}
Returns whether this document is folderish or not.
- Source:
Returns:
true if this document is folderish, false otherwise.
- Type
- Boolean
lock(optsopt) → {Promise}
Locks the document.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A promise object resolved with the updated document.
- Type
- Promise
move(dst, nameopt, optsopt) → {Promise}
Moves this document.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
dst |
string | The destination folder. |
||
name |
string |
<optional> |
null | The destination name, can be null. |
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A promise object resolved with the moved document.
- Type
- Promise
removePermission(params, optsopt) → {Promise}
Removes a permission given its id, or all permissions for a given user.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
object | The params needed to remove a permission. Properties
|
|||||||||||||||||
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A promise object resolved with the updated document.
- Type
- Promise
save(optsopt) → {Promise}
Saves the document. It updates only the 'dirty properties' set through the Document#set method.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A promise object resolved with the updated document.
- Type
- Promise
scheduleConversion(convertOpts, optsopt) → {Promise}
Schedule a conversion of the Blob from this document.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
convertOpts |
object | Configuration options for the conversion. Properties
|
||||||||||||||||||||||||||
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A promise object resolved with the response.
- Type
- Promise
set(properties) → {Document}
Sets document properties.
Parameters:
Name | Type | Description |
---|---|---|
properties |
object | The properties to set. |
- Source:
Returns:
- Type
- Document
Example
doc.set({
'dc:title': 'new title',
'dc:description': 'new description',
});
startWorkflow(workflowModelName, optsopt) → {Promise}
Starts a workflow on this document given a workflow model name.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
workflowModelName |
string | The workflow model name. |
|
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A promise object resolved with the started Workflow
object.
- Type
- Promise
unlock(optsopt) → {Promise}
Unlocks the document.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
object |
<optional> |
Options overriding the ones from this object. |
- Source:
Returns:
A promise object resolved with the updated document.
- Type
- Promise