Class DocumentModelImpl
- All Implemented Interfaces:
Serializable,Cloneable,DocumentModel
DocumentModel.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.nuxeo.ecm.core.api.DocumentModel
DocumentModel.DocumentModelRefresh -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ACPprotected Stringprotected Stringprotected Calendarprotected Map<String, Serializable> protected CoreSessionprotected Stringstatic final longstatic final longstatic final longFacets including those on instance.booleanprotected StringInstance facets.Instance facets when the document was read.protected booleanprotected booleanbooleanprotected booleanprotected booleanprotected booleanbooleanprotected booleanstate is lifecycle, version stuff.protected booleanprotected booleanprotected Stringprotected Lockprotected static final Lockprotected DocumentRefprotected Pathprotected Longprotected NuxeoPrincipalprotected DocumentRefprotected StringRetained properties.Schemas including those from instance facets.Schemas including those from instance facets when the doc was readprotected Stringprotected DocumentTypeprotected Stringprotected StringFields inherited from interface org.nuxeo.ecm.core.api.DocumentModel
REFRESH_ACP, REFRESH_ACP_IF_LOADED, REFRESH_ACP_LAZY, REFRESH_ALL, REFRESH_CONTENT, REFRESH_CONTENT_IF_LOADED, REFRESH_CONTENT_LAZY, REFRESH_DEFAULT, REFRESH_IF_LOADED, REFRESH_LAZY, REFRESH_STATE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDocumentModelImpl(String typeName) Constructor to use a document model client side without referencing a document.DocumentModelImpl(String parentPath, String name, String type) Constructor to be used by clients.DocumentModelImpl(String sid, String type, String id, Path path, DocumentRef docRef, DocumentRef parentRef, String[] schemas, Set<String> facets, String sourceId, String repositoryName, boolean isProxy) Deprecated.since 11.1, sid is unusedDocumentModelImpl(String sid, String type, String id, Path path, Lock lock, DocumentRef docRef, DocumentRef parentRef, String[] schemas, Set<String> facets, String sourceId, String repositoryName) Deprecated.since 11.1, sid and lock are unusedDocumentModelImpl(String type, String id, Path path, DocumentRef docRef, DocumentRef parentRef, String[] schemas, Set<String> facets, String sourceId, boolean isProxy, CoreSession coreSession, String repositoryName, NuxeoPrincipal principal) DocumentModelImpl(DocumentModel parent, String name, String type) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(PropertyVisitor visitor, Object arg) Method that implement the visitor pattern.voidaddDataModel(DataModel dataModel) booleanAdds a facet to the document instance.voidattach(CoreSession coreSession) Reattaches a document to an existing session.checkIn(VersioningOption option, String description) Checks in a document and returns the created version.voidcheckOut()Checks out a document.clone()Clone operation.cloneDataModel(DataModel data) static DataModelcloneDataModel(Schema schema, DataModel data) static ObjectcloneField(Field field, String key, Object value) protected voidcomputeFacetsAndSchemas(Set<String> instanceFacets, boolean setOrig) Recomputes all facets and schemas from the instance facets.computeSchemas(DocumentType type, Collection<String> instanceFacets, boolean isProxy) Recomputes effective schemas from a type + instance facets.voidcopyContent(DocumentModel sourceDoc) Copies all the data from a source document.voidcopyContextData(DocumentModel otherDocument) Copies the context data from given document to this document.voiddetach(boolean loadAll) Detaches the documentImpl from its existing session, so that it can survive beyond the session's closing.booleanbooleanfollowTransition(String transition) Follows a given life cycle transition.getACP()Gets the access control policy (ACP) for this document.<T> TgetAdapter(Class<T> itf) Adapts the document to the given interface.<T> TgetAdapter(Class<T> itf, boolean refreshCache) Adapts the document to the given interface.Gets the allowed state transitions for this document.Gets the fulltext extracted from the binary fields.Returns a cache key.Gets the current change token for this document.Returns the checkin comment if the document model is a version.Returns the checkin date (the date the version was created) if the document model is a version.Gets the context data associated to this document.getContextData(String key) Gets the context data using the default scope.Gets the core session to which this document is tied.Returns the life cycle of the document.getDataModel(String schema) Deprecated.Gets the data models.Deprecated.Gets the document type object.Gets the facets available on this document (from the type and the instance facets).getId()Gets the document UUID.Returns the life cycle policy of the document.Gets the lock info on the document.getName()Gets the document name.getObjectResolver(String xpath) Retrieves the parent reference of the current document.getParts()getPath()Gets the document path.Gets the document path as a string.getPos()Gets the document's position in its containing folder (if ordered).Gets the principal attached to this document's session.getProperties(String schemaName) Gets the values from the given data model as a map.getProperty(String xpath) Gets a property given a xpath.getProperty(String schemaName, String name) Gets a property from the given schema.getPropertyObject(String schema, String name) Gets a property object from the given schema.getPropertyObjects(String schema) Gets thePropertyobjects for the given schema.getPropertyValue(String xpath) Gets a property value given a xpath.getRef()Gets a reference to the core document that can be used either remotely or locally (opens the core JVM).Returns the name of the repository in which the document is stored.Gets the retained properties of this document at the time it became a record.Gets the retention date for the document.protected static SchemaManagerString[]Gets the schemas available on this document (from the type and the facets).protected CoreSessionGets the CoreSession, or fails if it's not available.Returns the repository name and principal when the document is attached.Returns the source document identifier.<T extends Serializable>
TgetSystemProp(String systemProperty, Class<T> type) Gets system property of the specified type.getTitle()Gets the title from the dublincore schema.getType()Gets the document type name.Returns the version label.Gets the version series id for this document.static StringgetXPathSchemaName(String xpath, Set<String> docSchemas, String[] returnName) Deprecated.since 2023, useSchemaManager.getXPathSchemaName(String, Set)instead.booleanChecks if the document has a facet, either from its type or added on the instance.inthashCode()booleanChecks if the document has a legal hold set.booleanChecks if the document has the given schema, either from its type or added on the instance through a facet.booleanChecks whether this document is attached to a session.booleanTests if the document is checked out.booleanisDirty()Checks if the document has actual data to write (dirty parts).booleanChecks if this document can be downloaded.booleanChecks if the document is an enforced record.booleanChecks if the document is a flexible record.booleanisFolder()Checks if this document is a folder.booleanChecks if this document is immutable.booleanChecks if a document is the latest major version in the version series.booleanChecks if a document is the latest version in the version series.booleanbooleanisLocked()Tests if the document is locked.booleanChecks if a document is a major version.booleanisProxy()Checks if this document is a proxy.booleanisRecord()Checks if the document is a record.booleanisSchemaLoaded(String name) booleanChecks if this document is in the trash.booleanChecks if the document has a retention date in the future or has a legal hold.booleanChecks if this document is a version.booleanChecks if this document can have versions.booleanChecks if there is a checked out working copy for the version series of this document.protected DataModelloadDataModel(String schema) Lazily loads the given data model.voidvoidvoidprefetchCurrentLifecycleState(String lifecycle) Used to set lifecycle state along with prefetching other properties.voidprefetchLifeCyclePolicy(String lifeCyclePolicy) Used to set lifecycle policy along with prefetching other properties.voidputContextData(String key, Serializable value) Sets a context data in the default scope.voidrefresh()Same asDocumentModel.refresh(REFRESH_DEFAULT).voidRefresh document data from server.booleanremoveFacet(String facet) Removes a facet from the document instance.Removes the lock on the document.voidreset()Clears any prefetched or cached document data.voidSets the ACP for this document model.voidSets the document id.voidsetIsImmutable(boolean isImmutable) voidsetIsProxy(boolean isProxy) voidsetIsVersion(boolean isVersion) voidsetLegalHold(boolean hold) setLock()Sets a lock on the document.voidsetPathInfo(String parentPath, String name) Sets path info.voidsetPosInternal(Long pos) Sets the document's position in its containing folder (if ordered).voidsetProperties(String schemaName, Map<String, Object> data) Sets values for the given data model.voidsetProperty(String schemaName, String name, Object value) Sets the property value from the given schema.voidsetPropertyObject(Property property) Sets a property object.voidsetPropertyValue(String xpath, Serializable value) Sets a property value given a xpath.voidsetRetainUntil(Calendar retainUntil) toString()
-
Field Details
-
F_VERSION
public static final long F_VERSION- See Also:
-
F_PROXY
public static final long F_PROXY- See Also:
-
F_IMMUTABLE
public static final long F_IMMUTABLE- See Also:
-
ref
-
type
-
typeName
-
schemas
Schemas including those from instance facets. -
schemasOrig
Schemas including those from instance facets when the doc was read -
facets
Facets including those on instance. -
retainedProperties
Retained properties. -
instanceFacets
Instance facets. -
instanceFacetsOrig
Instance facets when the document was read. -
id
-
path
-
pos
-
dataModels
-
parentRef
-
LOCK_UNKNOWN
-
lock
-
isStateLoaded
protected boolean isStateLoadedstate is lifecycle, version stuff. -
currentLifeCycleState
-
lifeCyclePolicy
-
isCheckedOut
protected boolean isCheckedOut -
versionSeriesId
-
isLatestVersion
protected boolean isLatestVersion -
isMajorVersion
protected boolean isMajorVersion -
isLatestMajorVersion
protected boolean isLatestMajorVersion -
isVersionSeriesCheckedOut
protected boolean isVersionSeriesCheckedOut -
checkinComment
-
checkinDate
-
acp
-
isACPLoaded
protected transient boolean isACPLoaded -
adapters
-
repositoryName
-
principal
-
coreSession
-
sourceId
-
contextData
-
changeToken
-
isTrashed
protected boolean isTrashed -
isRecord
public boolean isRecord -
isFlexibleRecord
public boolean isFlexibleRecord -
retainUntil
-
hasLegalHold
public boolean hasLegalHold
-
-
Constructor Details
-
DocumentModelImpl
protected DocumentModelImpl() -
DocumentModelImpl
Constructor to use a document model client side without referencing a document.It must at least contain the type.
-
DocumentModelImpl
Constructor to be used by clients.A client constructed data model must contain at least the path and the type.
-
DocumentModelImpl
@Deprecated public DocumentModelImpl(String sid, String type, String id, Path path, Lock lock, DocumentRef docRef, DocumentRef parentRef, String[] schemas, Set<String> facets, String sourceId, String repositoryName) Deprecated.since 11.1, sid and lock are unused -
DocumentModelImpl
@Deprecated public DocumentModelImpl(String sid, String type, String id, Path path, DocumentRef docRef, DocumentRef parentRef, String[] schemas, Set<String> facets, String sourceId, String repositoryName, boolean isProxy) Deprecated.since 11.1, sid is unused -
DocumentModelImpl
public DocumentModelImpl(String type, String id, Path path, DocumentRef docRef, DocumentRef parentRef, String[] schemas, Set<String> facets, String sourceId, boolean isProxy, CoreSession coreSession, String repositoryName, NuxeoPrincipal principal) - Since:
- 11.1
-
DocumentModelImpl
-
-
Method Details
-
computeSchemas
public static Set<String> computeSchemas(DocumentType type, Collection<String> instanceFacets, boolean isProxy) Recomputes effective schemas from a type + instance facets. -
getDocumentType
Description copied from interface:DocumentModelGets the document type object.- Specified by:
getDocumentTypein interfaceDocumentModel- Returns:
- the document type object
-
getTitle
Gets the title from the dublincore schema.- Specified by:
getTitlein interfaceDocumentModel- Returns:
- the title or the internal name if no title could be found
- See Also:
-
getSessionId
Description copied from interface:DocumentModelReturns the repository name and principal when the document is attached.- Specified by:
getSessionIdin interfaceDocumentModel
-
getPrincipal
Description copied from interface:DocumentModelGets the principal attached to this document's session.- Specified by:
getPrincipalin interfaceDocumentModel- Returns:
- the principal
-
getRef
Description copied from interface:DocumentModelGets a reference to the core document that can be used either remotely or locally (opens the core JVM).- Specified by:
getRefin interfaceDocumentModel- Returns:
- the document reference
-
getParentRef
Description copied from interface:DocumentModelRetrieves the parent reference of the current document.- Specified by:
getParentRefin interfaceDocumentModel- Returns:
- the parent reference or null if no parent
-
getCoreSession
Description copied from interface:DocumentModelGets the core session to which this document is tied.This may be null if the document has been detached from a session.
- Specified by:
getCoreSessionin interfaceDocumentModel- Returns:
- the core session
-
getSession
Gets the CoreSession, or fails if it's not available.- Since:
- 9.1
-
detach
public void detach(boolean loadAll) Description copied from interface:DocumentModelDetaches the documentImpl from its existing session, so that it can survive beyond the session's closing.- Specified by:
detachin interfaceDocumentModel- Parameters:
loadAll- iftrue, load all data and ACP from the session before detaching
-
attach
Description copied from interface:DocumentModelReattaches a document to an existing session.- Specified by:
attachin interfaceDocumentModel- Parameters:
coreSession- the session to attach to
-
isAttached
public boolean isAttached()Description copied from interface:DocumentModelChecks whether this document is attached to a session.- Specified by:
isAttachedin interfaceDocumentModel- Returns:
trueif the document is attached to a session
-
loadDataModel
Lazily loads the given data model. -
getDataModel
Deprecated.Description copied from interface:DocumentModelGets the data model corresponding to the given schema.Null is returned if the document type has no such schema.
- Specified by:
getDataModelin interfaceDocumentModel- Parameters:
schema- the schema name- Returns:
- the data model or null if no such schema is supported
- See Also:
-
getDataModelsCollection
Deprecated.Description copied from interface:DocumentModelINTERNAL, not for public use.Gets a list with the currently fetched data models.
- Specified by:
getDataModelsCollectionin interfaceDocumentModel- Returns:
- the data models that are already fetched as a collection
- See Also:
-
addDataModel
-
getSchemas
Description copied from interface:DocumentModelGets the schemas available on this document (from the type and the facets).- Specified by:
getSchemasin interfaceDocumentModel- Returns:
- the schemas
-
hasSchema
Description copied from interface:DocumentModelChecks if the document has the given schema, either from its type or added on the instance through a facet.- Specified by:
hasSchemain interfaceDocumentModel- Parameters:
schema- the schema name- Returns:
trueif the document has the schema
-
getFacets
Description copied from interface:DocumentModelGets the facets available on this document (from the type and the instance facets).- Specified by:
getFacetsin interfaceDocumentModel- Returns:
- the facets
-
getRetainedProperties
Description copied from interface:DocumentModelGets the retained properties of this document at the time it became a record.- Specified by:
getRetainedPropertiesin interfaceDocumentModel- Returns:
- the retained properties
-
hasFacet
Description copied from interface:DocumentModelChecks if the document has a facet, either from its type or added on the instance.- Specified by:
hasFacetin interfaceDocumentModel- Parameters:
facet- the facet name- Returns:
trueif the document has the facet
-
addFacet
Description copied from interface:DocumentModelAdds a facet to the document instance.Does nothing if the facet was already present on the document.
- Specified by:
addFacetin interfaceDocumentModel- Parameters:
facet- the facet name- Returns:
trueif the facet was added, orfalseif it is already present
-
removeFacet
Description copied from interface:DocumentModelRemoves a facet from the document instance.It's not possible to remove a facet coming from the document type.
- Specified by:
removeFacetin interfaceDocumentModel- Parameters:
facet- the facet name- Returns:
trueif the facet was removed, orfalseif it isn't present or is present on the type or does not exit
-
getId
Description copied from interface:DocumentModelGets the document UUID.- Specified by:
getIdin interfaceDocumentModel- Returns:
- the document UUID
-
getName
Description copied from interface:DocumentModelGets the document name.- Specified by:
getNamein interfaceDocumentModel- Returns:
- the document name
-
getPos
Description copied from interface:DocumentModelGets the document's position in its containing folder (if ordered).- Specified by:
getPosin interfaceDocumentModel- Returns:
- the position, or
nullif the containing folder is not ordered
-
setPosInternal
Sets the document's position in its containing folder (if ordered). Used internally during construction.- Parameters:
pos- the position- Since:
- 6.0
-
getPathAsString
Description copied from interface:DocumentModelGets the document path as a string.- Specified by:
getPathAsStringin interfaceDocumentModel- Returns:
- the document path as string
-
getProperties
Description copied from interface:DocumentModelGets the values from the given data model as a map.The operation will fetch the data model from the server if not already fetched.
- Specified by:
getPropertiesin interfaceDocumentModel- Parameters:
schemaName- the data model schema name- Returns:
- the values map
-
getProperty
Description copied from interface:DocumentModelGets a property from the given schema.The data model owning the property will be fetched from the server if not already fetched.
- Specified by:
getPropertyin interfaceDocumentModel- Parameters:
schemaName- the schema namename- the property name- Returns:
- the property value or null if no such property exists
-
getPropertyObject
Description copied from interface:DocumentModelGets a property object from the given schema.- Specified by:
getPropertyObjectin interfaceDocumentModel- Parameters:
schema- the schema namename- the property name- Returns:
- the property, or
nullif no such property exists
-
setPropertyObject
Description copied from interface:DocumentModelSets a property object.- Specified by:
setPropertyObjectin interfaceDocumentModel- Parameters:
property- the property object
-
setPathInfo
Description copied from interface:DocumentModelSets path info.path and ref attributes will be set according to info
- Specified by:
setPathInfoin interfaceDocumentModel
-
isLocked
public boolean isLocked()Description copied from interface:DocumentModelTests if the document is locked.Lock info is cached on the document for performance. Use
CoreSession.getLockInfo(org.nuxeo.ecm.core.api.DocumentRef)to get the non-cached status.- Specified by:
isLockedin interfaceDocumentModel- Returns:
- the lock key if the document is locked or null otherwise
-
setLock
Description copied from interface:DocumentModelSets a lock on the document.- Specified by:
setLockin interfaceDocumentModel- Returns:
- the lock info that was set
-
getLockInfo
Description copied from interface:DocumentModelGets the lock info on the document.Lock info is cached on the document for performance. Use
CoreSession.getLockInfo(org.nuxeo.ecm.core.api.DocumentRef)to get the non-cached status.- Specified by:
getLockInfoin interfaceDocumentModel- Returns:
- the lock info if the document is locked, or
nullotherwise
-
removeLock
Description copied from interface:DocumentModelRemoves the lock on the document.The caller principal should be the same as the one who set the lock or to belongs to the administrator group, otherwise an exception will be throw.
If the document was not locked, does nothing.
Returns the previous lock info.
- Specified by:
removeLockin interfaceDocumentModel- Returns:
- the removed lock info, or
nullif there was no lock
-
isCheckedOut
public boolean isCheckedOut()Description copied from interface:DocumentModelTests if the document is checked out.A checked out document can be modified normally. A checked in document is identical to the last version that it created, and not modifiable.
Only applicable to documents that are live (not versions and not proxies).
- Specified by:
isCheckedOutin interfaceDocumentModel- Returns:
trueif the document is checked out,falseif it is checked in
-
checkOut
public void checkOut()Description copied from interface:DocumentModelChecks out a document.A checked out document can be modified normally.
Only applicable to documents that are live (not versions and not proxies).
- Specified by:
checkOutin interfaceDocumentModel
-
checkIn
Description copied from interface:DocumentModelChecks in a document and returns the created version.A checked in document is identical to the last version that it created, and not modifiable.
Only applicable to documents that are live (not versions and not proxies).
- Specified by:
checkInin interfaceDocumentModel- Parameters:
option- whether to do create a newVersioningOption.MINORorVersioningOption.MAJORversion during check indescription- the checkin comment- Returns:
- the version just created
-
getVersionLabel
Description copied from interface:DocumentModelReturns the version label.The label returned is computed by the VersioningService.
- Specified by:
getVersionLabelin interfaceDocumentModel- Returns:
- the version label, or
null
-
getVersionSeriesId
Description copied from interface:DocumentModelGets the version series id for this document.All documents and versions derived by a check in or checkout from the same original document share the same version series id.
- Specified by:
getVersionSeriesIdin interfaceDocumentModel- Returns:
- the version series id
-
isLatestVersion
public boolean isLatestVersion()Description copied from interface:DocumentModelChecks if a document is the latest version in the version series.- Specified by:
isLatestVersionin interfaceDocumentModel
-
isMajorVersion
public boolean isMajorVersion()Description copied from interface:DocumentModelChecks if a document is a major version.- Specified by:
isMajorVersionin interfaceDocumentModel
-
isLatestMajorVersion
public boolean isLatestMajorVersion()Description copied from interface:DocumentModelChecks if a document is the latest major version in the version series.- Specified by:
isLatestMajorVersionin interfaceDocumentModel
-
isVersionSeriesCheckedOut
public boolean isVersionSeriesCheckedOut()Description copied from interface:DocumentModelChecks if there is a checked out working copy for the version series of this document.- Specified by:
isVersionSeriesCheckedOutin interfaceDocumentModel
-
getCheckinComment
Description copied from interface:DocumentModelReturns the checkin comment if the document model is a version.- Specified by:
getCheckinCommentin interfaceDocumentModel- Returns:
- the checkin comment, or
null
-
getCheckinDate
Description copied from interface:DocumentModelReturns the checkin date (the date the version was created) if the document model is a version.- Specified by:
getCheckinDatein interfaceDocumentModel- Returns:
- the checkin date, or
null
-
isRecord
public boolean isRecord()Description copied from interface:DocumentModelChecks if the document is a record.- Specified by:
isRecordin interfaceDocumentModel- Returns:
trueif the document is a record,falseotherwise
-
isEnforcedRecord
public boolean isEnforcedRecord()Description copied from interface:DocumentModelChecks if the document is an enforced record.- Specified by:
isEnforcedRecordin interfaceDocumentModel- Returns:
trueif the document is an enforced record,falseotherwise
-
isFlexibleRecord
public boolean isFlexibleRecord()Description copied from interface:DocumentModelChecks if the document is a flexible record.- Specified by:
isFlexibleRecordin interfaceDocumentModel- Returns:
trueif the document is a flexible record,falseotherwise
-
makeRecord
public void makeRecord() -
makeFlexibleRecord
public void makeFlexibleRecord() -
getRetainUntil
Description copied from interface:DocumentModelGets the retention date for the document.- Specified by:
getRetainUntilin interfaceDocumentModel- Returns:
- the retention date, or "SetRetention" for a
retention in the indeterminate future, or
nullif there is no retention date - See Also:
-
setRetainUntil
-
hasLegalHold
public boolean hasLegalHold()Description copied from interface:DocumentModelChecks if the document has a legal hold set.- Specified by:
hasLegalHoldin interfaceDocumentModel- Returns:
trueif a legal hold has been set on the document,falseotherwise- See Also:
-
setLegalHold
public void setLegalHold(boolean hold) -
isUnderRetentionOrLegalHold
public boolean isUnderRetentionOrLegalHold()Description copied from interface:DocumentModelChecks if the document has a retention date in the future or has a legal hold.- Specified by:
isUnderRetentionOrLegalHoldin interfaceDocumentModel- Returns:
trueif the document has a retention date in the future or if it has a legal hold,falseotherwise- See Also:
-
getACP
Description copied from interface:DocumentModelGets the access control policy (ACP) for this document.Returns null if no security was defined on this document.
The ACP can be used to introspect or to evaluate user privileges on this document.
This is a wrapper for
CoreSession.getACP(DocumentRef)but it is recommended since it caches the ACP for later usage.- Specified by:
getACPin interfaceDocumentModel- Returns:
- the security data model or null if none
-
setACP
Description copied from interface:DocumentModelSets the ACP for this document model.This is a wrapper for
CoreSession.setACP(DocumentRef, ACP, boolean)- Specified by:
setACPin interfaceDocumentModel- Parameters:
acp- the ACP to setoverwrite- whether to overwrite the old ACP or not- See Also:
-
getType
Description copied from interface:DocumentModelGets the document type name.- Specified by:
getTypein interfaceDocumentModel- Returns:
- the document type name
-
setProperties
Description copied from interface:DocumentModelSets values for the given data model.This will not fetch the data model if not already fetched.
- Specified by:
setPropertiesin interfaceDocumentModel- Parameters:
schemaName- the schema namedata- the values to set
-
setProperty
Description copied from interface:DocumentModelSets the property value from the given schema.This operation will not fetch the data model if not already fetched
- Specified by:
setPropertyin interfaceDocumentModel- Parameters:
schemaName- the schema namename- the property namevalue- the property value
-
getPath
Description copied from interface:DocumentModelGets the document path.- Specified by:
getPathin interfaceDocumentModel- Returns:
- the document path as string
-
getDataModels
Description copied from interface:DocumentModelGets the data models.- Specified by:
getDataModelsin interfaceDocumentModel- Returns:
- the data models that are already fetched.
- See Also:
-
isTrashed
public boolean isTrashed()Description copied from interface:DocumentModelChecks if this document is in the trash.- Specified by:
isTrashedin interfaceDocumentModel- Returns:
- true if the document is in the trash, false otherwise.
-
isFolder
public boolean isFolder()Description copied from interface:DocumentModelChecks if this document is a folder.- Specified by:
isFolderin interfaceDocumentModel- Returns:
- true if the document is a folder, false otherwise
-
isVersionable
public boolean isVersionable()Description copied from interface:DocumentModelChecks if this document can have versions.- Specified by:
isVersionablein interfaceDocumentModel- Returns:
- true if the document can have versions, false otherwise
-
isDownloadable
public boolean isDownloadable()Description copied from interface:DocumentModelChecks if this document can be downloaded.- Specified by:
isDownloadablein interfaceDocumentModel- Returns:
- true if the document has downloadable content, false otherwise
-
accept
Description copied from interface:DocumentModelMethod that implement the visitor pattern.The visitor must return null to stop visiting children otherwise a context object that will be passed as the arg argument to children
- Specified by:
acceptin interfaceDocumentModel- Parameters:
visitor- the visitor to acceptarg- an argument passed to the visitor. This should be used by the visitor to carry on the visiting context.
-
getAdapter
Description copied from interface:DocumentModelAdapts the document to the given interface.Attention, the first computation will cache the adaptation result for later calls.
- Specified by:
getAdapterin interfaceDocumentModel- Type Parameters:
T- the interface type to adapt to- Parameters:
itf- the interface class- Returns:
- the adapted document
-
getAdapter
Description copied from interface:DocumentModelAdapts the document to the given interface.- Specified by:
getAdapterin interfaceDocumentModel- Type Parameters:
T- the interface type to adapt to- Parameters:
itf- the interface classrefreshCache- : readapt and stores in cache if already exists.- Returns:
- the adapted document
-
followTransition
Description copied from interface:DocumentModelFollows a given life cycle transition.This will update the current life cycle of the document.
- Specified by:
followTransitionin interfaceDocumentModel- Parameters:
transition- the name of the transition to follow- Returns:
- a boolean representing the status if the operation
-
getAllowedStateTransitions
Description copied from interface:DocumentModelGets the allowed state transitions for this document.- Specified by:
getAllowedStateTransitionsin interfaceDocumentModel- Returns:
- a collection of state transitions as string
-
getCurrentLifeCycleState
Description copied from interface:DocumentModelReturns the life cycle of the document.- Specified by:
getCurrentLifeCycleStatein interfaceDocumentModel- Returns:
- the life cycle as a string
-
getLifeCyclePolicy
Description copied from interface:DocumentModelReturns the life cycle policy of the document.- Specified by:
getLifeCyclePolicyin interfaceDocumentModel- Returns:
- the life cycle policy
-
isVersion
public boolean isVersion()Description copied from interface:DocumentModelChecks if this document is a version.- Specified by:
isVersionin interfaceDocumentModel- Returns:
- true if the document is an older version of another document, false otherwise
-
isProxy
public boolean isProxy()Description copied from interface:DocumentModelChecks if this document is a proxy.- Specified by:
isProxyin interfaceDocumentModel- Returns:
- true if the document is a proxy false otherwise
-
isImmutable
public boolean isImmutable()Description copied from interface:DocumentModelChecks if this document is immutable.- Specified by:
isImmutablein interfaceDocumentModel- Returns:
trueif the document is a version or a proxy to a version,falseotherwise
-
setIsVersion
public void setIsVersion(boolean isVersion) -
setIsProxy
public void setIsProxy(boolean isProxy) -
setIsImmutable
public void setIsImmutable(boolean isImmutable) -
isDirty
public boolean isDirty()Description copied from interface:DocumentModelChecks if the document has actual data to write (dirty parts).- Specified by:
isDirtyin interfaceDocumentModel
-
getContextData
Description copied from interface:DocumentModelGets the context data associated to this document.- Specified by:
getContextDatain interfaceDocumentModel- Returns:
- a map of context data
-
getContextData
Description copied from interface:DocumentModelGets the context data using the default scope.- Specified by:
getContextDatain interfaceDocumentModel- Parameters:
key- the context data key- Returns:
- the value
-
putContextData
Description copied from interface:DocumentModelSets a context data in the default scope.- Specified by:
putContextDatain interfaceDocumentModel- Parameters:
key- the context data keyvalue- the value
-
copyContextData
Description copied from interface:DocumentModelCopies the context data from given document to this document.- Specified by:
copyContextDatain interfaceDocumentModel
-
copyContent
Description copied from interface:DocumentModelCopies all the data from a source document.- Specified by:
copyContentin interfaceDocumentModel
-
cloneField
-
cloneDataModel
-
cloneDataModel
-
getCacheKey
Description copied from interface:DocumentModelReturns a cache key.Cache key will be computed like this :
docUUID + "-" + sessionId + "-" + timestampWe will use the last modification time if present for the timestamp.
Since 5.6, the timestamp does not hold milliseconds anymore as some databases do not store them, which could interfere with cache key comparisons.
- Specified by:
getCacheKeyin interfaceDocumentModel- Returns:
- the cache key as a string
-
getRepositoryName
Description copied from interface:DocumentModelReturns the name of the repository in which the document is stored.- Specified by:
getRepositoryNamein interfaceDocumentModel- Returns:
- the repository name as a string.
-
getSourceId
Description copied from interface:DocumentModelReturns the source document identifier.This is useful when not interested about the repository UUID itself. Technically, this is the current version UUID.
- Specified by:
getSourceIdin interfaceDocumentModel- Returns:
- the source id as a string.
-
isSchemaLoaded
-
prefetchCurrentLifecycleState
Description copied from interface:DocumentModelUsed to set lifecycle state along with prefetching other properties.- Specified by:
prefetchCurrentLifecycleStatein interfaceDocumentModel
-
prefetchLifeCyclePolicy
Description copied from interface:DocumentModelUsed to set lifecycle policy along with prefetching other properties.- Specified by:
prefetchLifeCyclePolicyin interfaceDocumentModel
-
equals
-
hashCode
public int hashCode() -
toString
-
getSystemProp
Description copied from interface:DocumentModelGets system property of the specified type. This is not a lazy loaded property, thus the request is made directly to the server. This is needed as some critical system properties might be changed directly in the core.- Specified by:
getSystemPropin interfaceDocumentModel
-
isLifeCycleLoaded
public boolean isLifeCycleLoaded()- Specified by:
isLifeCycleLoadedin interfaceDocumentModel
-
getPart
-
getParts
-
getPropertyObjects
Description copied from interface:DocumentModelGets thePropertyobjects for the given schema.An empty list is returned if the document doesn't have the schema.
- Specified by:
getPropertyObjectsin interfaceDocumentModel- Parameters:
schema- the schema- Returns:
- the properties
-
getProperty
Description copied from interface:DocumentModelGets a property given a xpath.Note that what's called xpath in this context is not an actual XPath as specified by the w3c. Main differences are that in our xpath:
- Indexes start at 0 instead of 1
- You can express
foo/bar[i]/bazasfoo/i/baz
- Specified by:
getPropertyin interfaceDocumentModel
-
getXPathSchemaName
@Deprecated public static String getXPathSchemaName(String xpath, Set<String> docSchemas, String[] returnName) Deprecated.since 2023, useSchemaManager.getXPathSchemaName(String, Set)instead. -
getPropertyValue
Description copied from interface:DocumentModelGets a property value given a xpath.Note that what's called xpath in this context is not an actual XPath as specified by the w3c. Main differences are that in our xpath:
- Indexes start at 0 instead of 1
- You can express
foo/bar[i]/bazasfoo/i/baz
- Specified by:
getPropertyValuein interfaceDocumentModel- Throws:
PropertyException
-
setPropertyValue
Description copied from interface:DocumentModelSets a property value given a xpath.- Specified by:
setPropertyValuein interfaceDocumentModel- Throws:
PropertyException
-
clone
Description copied from interface:DocumentModelClone operation. Must be made public instead of just protected as in Object.- Specified by:
clonein interfaceDocumentModel- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
reset
public void reset()Description copied from interface:DocumentModelClears any prefetched or cached document data.This will force the document to lazily update its data when required.
- Specified by:
resetin interfaceDocumentModel
-
refresh
public void refresh()Description copied from interface:DocumentModelSame asDocumentModel.refresh(REFRESH_DEFAULT).- Specified by:
refreshin interfaceDocumentModel
-
refresh
Description copied from interface:DocumentModelRefresh document data from server.The data models will be removed and all prefetch and system data will be refreshed from the server
The refreshed data contains:
- document life cycle
- document lock state, acp if required
- acp if required - otherwise acp info will be cleared so that it will be refetched in lazy way
- document parts if required - otherwise parts data will be removed to be refreshed lazy
DocumentModel.REFRESH_STATEDocumentModel.REFRESH_ACP_IF_LOADEDDocumentModel.REFRESH_ACP_LAZYDocumentModel.REFRESH_ACPDocumentModel.REFRESH_CONTENT_IF_LOADEDDocumentModel.REFRESH_CONTENT_LAZYDocumentModel.REFRESH_CONTENTDocumentModel.REFRESH_DEFAULTsame as REFRESH_STATE | REFRESH_DEFAULT | REFRESH_ACP_IF_LOADED | REFRESH_CONTENT_IF_LOADEDDocumentModel.REFRESH_ALLsame as REFRESH_STATE | REFRESH_PREFTECH | REFRESH_ACP | REFRESH_CONTENT
- Specified by:
refreshin interfaceDocumentModel- Parameters:
refreshFlags- the refresh flagsschemas- the document parts (schemas) that should be refreshed now
-
computeFacetsAndSchemas
Recomputes all facets and schemas from the instance facets.- Since:
- 7.1
-
getChangeToken
Description copied from interface:DocumentModelGets the current change token for this document.The change token is an opaque string which is modified every time the document is changed.
Before saving a document through
CoreSession.saveDocument(org.nuxeo.ecm.core.api.DocumentModel)it's possible to pass an expected change token in the document context data throughdoc.putContextData(CoreSession.CHANGE_TOKEN, expectedChangeToken). If the change token does not match the stored one, it means that a concurrent update happened, and aConcurrentUpdateExceptionwill be thrown.- Specified by:
getChangeTokenin interfaceDocumentModel- Returns:
- the change token
- See Also:
-
setId
Sets the document id. May be useful when detaching from a repo and attaching to another one or when unmarshalling a documentModel from a XML or JSON representation- Since:
- 5.7.2
-
getBinaryFulltext
Description copied from interface:DocumentModelGets the fulltext extracted from the binary fields.- Specified by:
getBinaryFulltextin interfaceDocumentModel
-
getObjectResolver
- Specified by:
getObjectResolverin interfaceDocumentModel- Parameters:
xpath- the property xpath- Returns:
- A
PropertyObjectResolverto manage the property reference to external entities, null if this property's type has no resolver.
-
getSchemaManager
- Returns:
SchemaManagerservice or throws an exception if no one is available- Since:
- 9.3
-