Interface DocumentModel
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
DeletedDocumentModel,DocumentModelImpl,ShallowDocumentModel,SimpleDocumentModel
public interface DocumentModel extends Serializable
The document model is a serializable representation of a core document.The document model is made from several data models, each data model is bound to a schema. All the information about a document (like security) is expressed using schemas (and implicitly data models).
Data models are lazily loaded as they are needed. At document model creation only data models corresponding to the default schemas are loaded. The default schemas are configured in the type manager through extension points.
- See Also:
CoreSession
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classDocumentModel.DocumentModelRefreshInfo fetched internally during a refresh.
-
Field Summary
Fields Modifier and Type Field Description static intREFRESH_ACPstatic intREFRESH_ACP_IF_LOADEDstatic intREFRESH_ACP_LAZYstatic intREFRESH_ALLstatic intREFRESH_CONTENTstatic intREFRESH_CONTENT_IF_LOADEDstatic intREFRESH_CONTENT_LAZYstatic intREFRESH_DEFAULTstatic intREFRESH_IF_LOADEDstatic intREFRESH_LAZYstatic intREFRESH_PREFETCHDeprecated.since 10.1, has no effect.static intREFRESH_STATE
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description voidaccept(PropertyVisitor visitor, Object arg)Method that implement the visitor pattern.booleanaddFacet(String facet)Adds a facet to the document instance.voidattach(CoreSession coreSession)Reattaches a document to an existing session.DocumentRefcheckIn(VersioningOption option, String checkinComment)Checks in a document and returns the created version.voidcheckOut()Checks out a document.DocumentModelclone()Clone operation.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.booleanfollowTransition(String transition)Follows a given life cycle transition.ACPgetACP()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.Collection<String>getAllowedStateTransitions()Gets the allowed state transitions for this document.Map<String,String>getBinaryFulltext()Gets the fulltext extracted from the binary fields.StringgetCacheKey()Returns a cache key.StringgetChangeToken()Gets the current change token for this document.StringgetCheckinComment()Returns the checkin comment if the document model is a version.Map<String,Serializable>getContextData()Gets the context data associated to this document.SerializablegetContextData(String key)Gets the context data using the default scope.CoreSessiongetCoreSession()Gets the core session to which this document is tied.StringgetCurrentLifeCycleState()Returns the life cycle of the document.DataModelgetDataModel(String schema)Deprecated.since 8.4, use directPropertygetters insteadMap<String,DataModel>getDataModels()Deprecated.since 8.4, use directPropertygetters insteadCollection<DataModel>getDataModelsCollection()Deprecated.since 8.4, internal methodDocumentTypegetDocumentType()Gets the document type object.Set<String>getFacets()Gets the facets available on this document (from the type and the instance facets).StringgetId()Gets the document UUID.StringgetLifeCyclePolicy()Returns the life cycle policy of the document.LockgetLockInfo()Gets the lock info on the document.StringgetName()Gets the document name.PropertyObjectResolvergetObjectResolver(String xpath)DocumentRefgetParentRef()Retrieves the parent reference of the current document.DocumentPartgetPart(String schema)Deprecated.since 8.4, use directPropertygetters insteadDocumentPart[]getParts()Deprecated.since 8.4, use directPropertygetters insteadPathgetPath()Gets the document path.StringgetPathAsString()Gets the document path as a string.LonggetPos()Gets the document's position in its containing folder (if ordered).NuxeoPrincipalgetPrincipal()Gets the principal attached to this document's session.Map<String,Object>getProperties(String schemaName)Gets the values from the given data model as a map.PropertygetProperty(String xpath)Gets a property given a xpath.ObjectgetProperty(String schemaName, String name)Gets a property from the given schema.PropertygetPropertyObject(String schema, String name)Gets a property object from the given schema.Collection<Property>getPropertyObjects(String schema)Gets thePropertyobjects for the given schema.SerializablegetPropertyValue(String xpath)Gets a property value given a xpath.DocumentRefgetRef()Gets a reference to the core document that can be used either remotely or locally (opens the core JVM).StringgetRepositoryName()Returns the name of the repository in which the document is stored.default CalendargetRetainUntil()Gets the retention date for the document.String[]getSchemas()Gets the schemas available on this document (from the type and the facets).StringgetSessionId()Deprecated.since 11.1StringgetSourceId()Returns the source document identifier.<T extends Serializable>
TgetSystemProp(String systemProperty, Class<T> type)Gets system property of the specified type.StringgetTitle()Get a text suitable to be shown in a UI for this document.StringgetType()Gets the document type name.StringgetVersionLabel()Returns the version label.StringgetVersionSeriesId()Gets the version series id for this document.booleanhasFacet(String facet)Checks if the document has a facet, either from its type or added on the instance.default booleanhasLegalHold()Checks if the document has a legal hold set.booleanhasSchema(String schema)Checks if the document has the given schema, either from its type or added on the instance through a facet.booleanisAttached()Checks whether this document is attached to a session.booleanisCheckedOut()Tests if the document is checked out.booleanisDirty()Checks if the document has actual data to write (dirty parts).booleanisDownloadable()Checks if this document can be downloaded.booleanisFolder()Checks if this document is a folder.booleanisImmutable()Checks if this document is immutable.booleanisLatestMajorVersion()Checks if a document is the latest major version in the version series.booleanisLatestVersion()Checks if a document is the latest version in the version series.booleanisLifeCycleLoaded()booleanisLocked()Tests if the document is locked.booleanisMajorVersion()Checks if a document is a major version.booleanisPrefetched(String xpath)Deprecated.since 10.1, will always returnfalsebooleanisPrefetched(String schemaName, String name)Deprecated.since 10.1, will always returnfalsebooleanisProxy()Checks if this document is a proxy.default booleanisRecord()Checks if the document is a record.booleanisTrashed()Checks if this document is in the trash.default booleanisUnderRetentionOrLegalHold()Checks if the document has a retention date in the future or has a legal hold.booleanisVersion()Checks if this document is a version.booleanisVersionable()Checks if this document can have versions.booleanisVersionSeriesCheckedOut()Checks if there is a checked out working copy for the version series of this document.voidprefetchCurrentLifecycleState(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(int refreshFlags, String[] schemas)Refresh document data from server.booleanremoveFacet(String facet)Removes a facet from the document instance.LockremoveLock()Removes the lock on the document.voidreset()Clears any prefetched or cached document data.voidsetACP(ACP acp, boolean overwrite)Sets the ACP for this document model.LocksetLock()Sets a lock on the document.voidsetPathInfo(String parentPath, String name)Sets path info.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.voidsetPropertyValue(String xpath, Serializable value)Sets a property value given a xpath.
-
-
-
Field Detail
-
REFRESH_STATE
static final int REFRESH_STATE
- See Also:
- Constant Field Values
-
REFRESH_PREFETCH
@Deprecated static final int REFRESH_PREFETCH
Deprecated.since 10.1, has no effect.- See Also:
- Constant Field Values
-
REFRESH_ACP_IF_LOADED
static final int REFRESH_ACP_IF_LOADED
- See Also:
- Constant Field Values
-
REFRESH_ACP_LAZY
static final int REFRESH_ACP_LAZY
- See Also:
- Constant Field Values
-
REFRESH_ACP
static final int REFRESH_ACP
- See Also:
- Constant Field Values
-
REFRESH_CONTENT_IF_LOADED
static final int REFRESH_CONTENT_IF_LOADED
- See Also:
- Constant Field Values
-
REFRESH_CONTENT_LAZY
static final int REFRESH_CONTENT_LAZY
- See Also:
- Constant Field Values
-
REFRESH_CONTENT
static final int REFRESH_CONTENT
- See Also:
- Constant Field Values
-
REFRESH_IF_LOADED
static final int REFRESH_IF_LOADED
- See Also:
- Constant Field Values
-
REFRESH_LAZY
static final int REFRESH_LAZY
- See Also:
- Constant Field Values
-
REFRESH_ALL
static final int REFRESH_ALL
- See Also:
- Constant Field Values
-
REFRESH_DEFAULT
static final int REFRESH_DEFAULT
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDocumentType
DocumentType getDocumentType()
Gets the document type object.- Returns:
- the document type object
-
getSessionId
@Deprecated String getSessionId()
Deprecated.since 11.1Returns the repository name and principal when the document is attached.
-
getPrincipal
NuxeoPrincipal getPrincipal()
Gets the principal attached to this document's session.- Returns:
- the principal
- Since:
- 11.1
-
getCoreSession
CoreSession getCoreSession()
Gets the core session to which this document is tied.This may be null if the document has been detached from a session.
- Returns:
- the core session
- Since:
- 5.2.GA
-
detach
void detach(boolean loadAll)
Detaches the documentImpl from its existing session, so that it can survive beyond the session's closing.- Parameters:
loadAll- iftrue, load all data and ACP from the session before detaching- Since:
- 5.6
-
attach
void attach(CoreSession coreSession)
Reattaches a document to an existing session.- Parameters:
coreSession- the session to attach to- Since:
- 11.1
-
isAttached
boolean isAttached()
Checks whether this document is attached to a session.- Returns:
trueif the document is attached to a session- Since:
- 11.1
-
getRef
DocumentRef getRef()
Gets a reference to the core document that can be used either remotely or locally (opens the core JVM).- Returns:
- the document reference
-
getParentRef
DocumentRef getParentRef()
Retrieves the parent reference of the current document.- Returns:
- the parent reference or null if no parent
-
getPos
Long getPos()
Gets the document's position in its containing folder (if ordered).- Returns:
- the position, or
nullif the containing folder is not ordered - Since:
- 6.0
-
getTitle
String getTitle()
Get a text suitable to be shown in a UI for this document.- Returns:
- the title or the internal name if no title could be found
-
getPathAsString
String getPathAsString()
Gets the document path as a string.- Returns:
- the document path as string
-
getSchemas
String[] getSchemas()
Gets the schemas available on this document (from the type and the facets).- Returns:
- the schemas
- Since:
- 5.4.2
-
hasSchema
boolean hasSchema(String schema)
Checks if the document has the given schema, either from its type or added on the instance through a facet.- Parameters:
schema- the schema name- Returns:
trueif the document has the schema
-
getFacets
Set<String> getFacets()
Gets the facets available on this document (from the type and the instance facets).- Returns:
- the facets
- Since:
- 5.4.2
-
hasFacet
boolean hasFacet(String facet)
Checks if the document has a facet, either from its type or added on the instance.- Parameters:
facet- the facet name- Returns:
trueif the document has the facet
-
addFacet
boolean addFacet(String facet)
Adds a facet to the document instance.Does nothing if the facet was already present on the document.
- Parameters:
facet- the facet name- Returns:
trueif the facet was added, orfalseif it is already present- Throws:
IllegalArgumentException- if the facet does not exist- Since:
- 5.4.2
-
removeFacet
boolean removeFacet(String facet)
Removes a facet from the document instance.It's not possible to remove a facet coming from the document type.
- 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- Since:
- 5.4.2
-
getDataModelsCollection
@Deprecated Collection<DataModel> getDataModelsCollection()
Deprecated.since 8.4, internal methodINTERNAL, not for public use.Gets a list with the currently fetched data models.
- Returns:
- the data models that are already fetched as a collection
- See Also:
getSchemas(),getProperties(java.lang.String),getPropertyObject(java.lang.String, java.lang.String),getPropertyObjects(java.lang.String)
-
getDataModels
@Deprecated Map<String,DataModel> getDataModels()
Deprecated.since 8.4, use directPropertygetters insteadGets the data models.- Returns:
- the data models that are already fetched.
- See Also:
getSchemas(),getProperties(java.lang.String),getPropertyObject(java.lang.String, java.lang.String),getPropertyObjects(java.lang.String)
-
getDataModel
@Deprecated DataModel getDataModel(String schema)
Deprecated.since 8.4, use directPropertygetters insteadGets the data model corresponding to the given schema.Null is returned if the document type has no such schema.
- Parameters:
schema- the schema name- Returns:
- the data model or null if no such schema is supported
- See Also:
getSchemas(),getProperties(java.lang.String),getPropertyObject(java.lang.String, java.lang.String),getPropertyObjects(java.lang.String)
-
setPathInfo
void setPathInfo(String parentPath, String name)
Sets path info.path and ref attributes will be set according to info
-
isLocked
boolean isLocked()
Tests 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.- Returns:
- the lock key if the document is locked or null otherwise
-
setLock
Lock setLock() throws LockException
Sets a lock on the document.- Returns:
- the lock info that was set
- Throws:
LockException- if the document is already locked- Since:
- 5.4.2
-
getLockInfo
Lock getLockInfo()
Gets 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.- Returns:
- the lock info if the document is locked, or
nullotherwise - Since:
- 5.4.2
-
removeLock
Lock removeLock() throws LockException
Removes 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.
- Returns:
- the removed lock info, or
nullif there was no lock - Throws:
LockException- if the document is locked by someone else- Since:
- 5.4.2
-
isCheckedOut
boolean isCheckedOut()
Tests 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).
- Returns:
trueif the document is checked out,falseif it is checked in- Since:
- 5.4
-
checkOut
void checkOut()
Checks out a document.A checked out document can be modified normally.
Only applicable to documents that are live (not versions and not proxies).
- Since:
- 5.4
-
checkIn
DocumentRef checkIn(VersioningOption option, String checkinComment)
Checks 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).
- Parameters:
option- whether to do create a newVersioningOption.MINORorVersioningOption.MAJORversion during check incheckinComment- the checkin comment- Returns:
- the version just created
- Since:
- 5.4
-
getVersionLabel
String getVersionLabel()
Returns the version label.The label returned is computed by the VersioningService.
- Returns:
- the version label, or
null
-
getCheckinComment
String getCheckinComment()
Returns the checkin comment if the document model is a version.- Returns:
- the checkin comment, or
null - Since:
- 5.4
-
getVersionSeriesId
String getVersionSeriesId()
Gets 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.
- Returns:
- the version series id
- Since:
- 5.4
-
isLatestVersion
boolean isLatestVersion()
Checks if a document is the latest version in the version series.- Since:
- 5.4
-
isMajorVersion
boolean isMajorVersion()
Checks if a document is a major version.- Since:
- 5.4
-
isLatestMajorVersion
boolean isLatestMajorVersion()
Checks if a document is the latest major version in the version series.- Since:
- 5.4
-
isVersionSeriesCheckedOut
boolean isVersionSeriesCheckedOut()
Checks if there is a checked out working copy for the version series of this document.- Since:
- 5.4
-
isRecord
default boolean isRecord()
Checks if the document is a record.- Returns:
trueif the document is a record,falseotherwise- Since:
- 11.1
-
getRetainUntil
default Calendar getRetainUntil()
Gets the retention date for the document.- Returns:
- the retention date, or "SetRetention" for a
retention in the indeterminate future, or
nullif there is no retention date - Since:
- 11.1
- See Also:
CoreSession.RETAIN_UNTIL_INDETERMINATE,isUnderRetentionOrLegalHold()
-
hasLegalHold
default boolean hasLegalHold()
Checks if the document has a legal hold set.- Returns:
trueif a legal hold has been set on the document,falseotherwise- Since:
- 11.1
- See Also:
isUnderRetentionOrLegalHold()
-
isUnderRetentionOrLegalHold
default boolean isUnderRetentionOrLegalHold()
Checks if the document has a retention date in the future or has a legal hold.- Returns:
trueif the document has a retention date in the future or if it has a legal hold,falseotherwise- Since:
- 11.1
- See Also:
getRetainUntil(),hasLegalHold()
-
getACP
ACP getACP()
Gets 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.- Returns:
- the security data model or null if none
-
setACP
void setACP(ACP acp, boolean overwrite)
Sets the ACP for this document model.This is a wrapper for
CoreSession.setACP(DocumentRef, ACP, boolean)- Parameters:
acp- the ACP to setoverwrite- whether to overwrite the old ACP or not- See Also:
CoreSession.setACP(DocumentRef, ACP, boolean)
-
getProperty
Object getProperty(String schemaName, String name)
Gets a property from the given schema.The data model owning the property will be fetched from the server if not already fetched.
- Parameters:
schemaName- the schema namename- the property name- Returns:
- the property value or null if no such property exists
-
getPropertyObject
Property getPropertyObject(String schema, String name)
Gets a property object from the given schema.- Parameters:
schema- the schema namename- the property name- Returns:
- the property, or
nullif no such property exists - Since:
- 8.4
-
setProperty
void setProperty(String schemaName, String name, Object value)
Sets the property value from the given schema.This operation will not fetch the data model if not already fetched
- Parameters:
schemaName- the schema namename- the property namevalue- the property value
-
getProperties
Map<String,Object> getProperties(String schemaName)
Gets the values from the given data model as a map.The operation will fetch the data model from the server if not already fetched.
- Parameters:
schemaName- the data model schema name- Returns:
- the values map
-
setProperties
void setProperties(String schemaName, Map<String,Object> data)
Sets values for the given data model.This will not fetch the data model if not already fetched.
- Parameters:
schemaName- the schema namedata- the values to set
-
isTrashed
boolean isTrashed()
Checks if this document is in the trash.- Returns:
- true if the document is in the trash, false otherwise.
- Since:
- 10.1
-
isFolder
boolean isFolder()
Checks if this document is a folder.- Returns:
- true if the document is a folder, false otherwise
-
isVersionable
boolean isVersionable()
Checks if this document can have versions.- Returns:
- true if the document can have versions, false otherwise
-
isDownloadable
boolean isDownloadable()
Checks if this document can be downloaded.- Returns:
- true if the document has downloadable content, false otherwise
-
isVersion
boolean isVersion()
Checks if this document is a version.- Returns:
- true if the document is an older version of another document, false otherwise
-
isProxy
boolean isProxy()
Checks if this document is a proxy.- Returns:
- true if the document is a proxy false otherwise
-
isImmutable
boolean isImmutable()
Checks if this document is immutable.- Returns:
trueif the document is a version or a proxy to a version,falseotherwise- Since:
- 1.6.1 (5.3.1)
-
isDirty
boolean isDirty()
Checks if the document has actual data to write (dirty parts).- Since:
- 5.5
-
accept
void accept(PropertyVisitor visitor, Object arg)
Method 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
- 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.- Since:
- 5.5
-
getAdapter
<T> T getAdapter(Class<T> itf)
Adapts the document to the given interface.Attention, the first computation will cache the adaptation result for later calls.
- Type Parameters:
T- the interface type to adapt to- Parameters:
itf- the interface class- Returns:
- the adapted document
-
getAdapter
<T> T getAdapter(Class<T> itf, boolean refreshCache)
Adapts the document to the given interface.- 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
-
getCurrentLifeCycleState
String getCurrentLifeCycleState()
Returns the life cycle of the document.- Returns:
- the life cycle as a string
- Implementation Note:
- See org.nuxeo.ecm.core.lifecycle package
-
getLifeCyclePolicy
String getLifeCyclePolicy()
Returns the life cycle policy of the document.- Returns:
- the life cycle policy
- Implementation Note:
- See org.nuxeo.ecm.core.lifecycle package
-
followTransition
boolean followTransition(String transition)
Follows a given life cycle transition.This will update the current life cycle of the document.
- Parameters:
transition- the name of the transition to follow- Returns:
- a boolean representing the status if the operation
-
getAllowedStateTransitions
Collection<String> getAllowedStateTransitions()
Gets the allowed state transitions for this document.- Returns:
- a collection of state transitions as string
-
getContextData
Map<String,Serializable> getContextData()
Gets the context data associated to this document.- Returns:
- a map of context data
-
getContextData
Serializable getContextData(String key)
Gets the context data using the default scope.- Parameters:
key- the context data key- Returns:
- the value
-
putContextData
void putContextData(String key, Serializable value)
Sets a context data in the default scope.- Parameters:
key- the context data keyvalue- the value
-
copyContextData
void copyContextData(DocumentModel otherDocument)
Copies the context data from given document to this document.
-
copyContent
void copyContent(DocumentModel sourceDoc)
Copies all the data from a source document.
-
getRepositoryName
String getRepositoryName()
Returns the name of the repository in which the document is stored.- Returns:
- the repository name as a string.
-
getCacheKey
String getCacheKey()
Returns 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.
- Returns:
- the cache key as a string
-
getSourceId
String getSourceId()
Returns the source document identifier.This is useful when not interested about the repository UUID itself. Technically, this is the current version UUID.
- Returns:
- the source id as a string.
-
isPrefetched
@Deprecated boolean isPrefetched(String xpath)
Deprecated.since 10.1, will always returnfalseChecks if a property is prefetched.- Parameters:
xpath- the property xpath- Returns:
trueif it is prefetched- Since:
- 5.5
-
isPrefetched
@Deprecated boolean isPrefetched(String schemaName, String name)
Deprecated.since 10.1, will always returnfalseChecks if a property is prefetched.- Parameters:
schemaName- the schema namename- the property name- Returns:
trueif it is prefetched- Since:
- 5.5
-
prefetchCurrentLifecycleState
void prefetchCurrentLifecycleState(String lifecycle)
Used to set lifecycle state along with prefetching other properties.
-
prefetchLifeCyclePolicy
void prefetchLifeCyclePolicy(String lifeCyclePolicy)
Used to set lifecycle policy along with prefetching other properties.
-
isLifeCycleLoaded
boolean isLifeCycleLoaded()
-
getSystemProp
<T extends Serializable> T getSystemProp(String systemProperty, Class<T> type)
Gets 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.
-
getPart
@Deprecated DocumentPart getPart(String schema)
Deprecated.since 8.4, use directPropertygetters insteadGet a document part given its schema name- Parameters:
schema- the schema- Returns:
- the document aprt or null if none exists for that schema
- See Also:
getPropertyObject(java.lang.String, java.lang.String),getPropertyObjects(java.lang.String)
-
getParts
@Deprecated DocumentPart[] getParts()
Deprecated.since 8.4, use directPropertygetters insteadGets this document's parts.
-
getPropertyObjects
Collection<Property> getPropertyObjects(String schema)
Gets thePropertyobjects for the given schema.An empty list is returned if the document doesn't have the schema.
- Parameters:
schema- the schema- Returns:
- the properties
- Since:
- 8.4
-
getProperty
Property getProperty(String xpath) throws PropertyException
Gets 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
- Throws:
PropertyException
-
getPropertyValue
Serializable getPropertyValue(String xpath) throws PropertyException
Gets 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
- Throws:
PropertyException
-
setPropertyValue
void setPropertyValue(String xpath, Serializable value) throws PropertyException
Sets a property value given a xpath.- Throws:
PropertyException
-
reset
void reset()
Clears any prefetched or cached document data.This will force the document to lazily update its data when required.
-
refresh
void refresh(int refreshFlags, String[] schemas)
Refresh 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
REFRESH_STATEREFRESH_ACP_IF_LOADEDREFRESH_ACP_LAZYREFRESH_ACPREFRESH_CONTENT_IF_LOADEDREFRESH_CONTENT_LAZYREFRESH_CONTENTREFRESH_DEFAULTsame as REFRESH_STATE | REFRESH_DEFAULT | REFRESH_ACP_IF_LOADED | REFRESH_CONTENT_IF_LOADEDREFRESH_ALLsame as REFRESH_STATE | REFRESH_PREFTECH | REFRESH_ACP | REFRESH_CONTENT
- Parameters:
refreshFlags- the refresh flagsschemas- the document parts (schemas) that should be refreshed now
-
refresh
void refresh()
Same asDocumentModel.refresh(REFRESH_DEFAULT).
-
clone
DocumentModel clone() throws CloneNotSupportedException
Clone operation. Must be made public instead of just protected as in Object.- Throws:
CloneNotSupportedException
-
getChangeToken
String getChangeToken()
Gets 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.- Returns:
- the change token
- Since:
- 5.5
- See Also:
putContextData(java.lang.String, java.io.Serializable),CoreSession.CHANGE_TOKEN,CoreSession.getChangeToken(org.nuxeo.ecm.core.api.DocumentRef)
-
getBinaryFulltext
Map<String,String> getBinaryFulltext()
Gets the fulltext extracted from the binary fields.- Since:
- 5.9.3
-
getObjectResolver
PropertyObjectResolver getObjectResolver(String xpath)
- Parameters:
xpath- the property xpath- Returns:
- A
PropertyObjectResolverto manage the property reference to external entities, null if this property's type has no resolver. - Since:
- 7.1
-
-