Package org.nuxeo.ecm.core.versioning
Class VersioningComponent
java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.ecm.core.versioning.VersioningComponent
- All Implemented Interfaces:
VersioningService
,Adaptable
,Component
,Extensible
,TimestampedService
Versioning service component and implementation.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
protected static class
protected static class
-
Field Summary
Modifier and TypeFieldDescriptionprotected ComponentContext
protected static final StandardVersioningService
static final String
static final String
static final String
static final String
protected Map<VersioningServiceDescriptor,
VersioningService> Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
Fields inherited from interface org.nuxeo.ecm.core.api.versioning.VersioningService
CHECKIN_COMMENT, DISABLE_AUTO_CHECKOUT, DISABLE_AUTOMATIC_VERSIONING, MAJOR_VERSION_PROP, MINOR_VERSION_PROP, SKIP_VERSIONING, VERSIONING_OPTION
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
activate
(ComponentContext context) Activates the component.void
deactivate
(ComponentContext context) Deactivates the component.void
doAutomaticVersioning
(DocumentModel previousDocument, DocumentModel currentDocument, boolean before) Does automatic versioning if a policy exists for the current input context.doCheckIn
(Document doc, VersioningOption option, String checkinComment) Applies version increment option and does a checkin.void
doCheckOut
(Document doc) Apply modifications after doing a checkout.void
doPostCreate
(Document doc, Map<String, Serializable> options) Applies versioning after document creation.doPostSave
(CoreSession session, Document doc, VersioningOption option, String checkinComment, Map<String, Serializable> options) Applies versioning options after document save.doPreSave
(CoreSession session, Document doc, boolean isDirty, VersioningOption option, String checkinComment, Map<String, Serializable> options) Applies versioning options before document save.getSaveOptions
(DocumentModel docModel) Checks what options are available on a document at save time.protected Map<String,
VersioningFilterDescriptor> protected Map<String,
VersioningPolicyDescriptor> protected Map<String,
VersioningRestrictionDescriptor> Gets the version label to display for a given document.boolean
isPostSaveDoingCheckIn
(Document doc, VersioningOption option, Map<String, Serializable> options) Checks ifVersioningService.doPostSave(org.nuxeo.ecm.core.api.CoreSession, org.nuxeo.ecm.core.model.Document, org.nuxeo.ecm.core.api.VersioningOption, java.lang.String, java.util.Map<java.lang.String, java.io.Serializable>)
will do a checkin when called with the same arguments.boolean
isPreSaveDoingCheckOut
(Document doc, boolean isDirty, VersioningOption option, Map<String, Serializable> options) Checks ifVersioningService.doPreSave(org.nuxeo.ecm.core.api.CoreSession, org.nuxeo.ecm.core.model.Document, boolean, org.nuxeo.ecm.core.api.VersioningOption, java.lang.String, java.util.Map<java.lang.String, java.io.Serializable>)
will do a checkout when called with the same arguments.protected void
void
registerContribution
(Object contrib, String point, ComponentInstance contributor) protected void
protected void
protected void
protected void
void
unregisterContribution
(Object contrib, String point, ComponentInstance contributor) protected void
protected void
protected void
protected void
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
addRuntimeMessage, addRuntimeMessage, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterExtension
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrder
-
Field Details
-
VERSIONING_SERVICE_XP
- See Also:
-
VERSIONING_POLICY_XP
- See Also:
-
VERSIONING_FILTER_XP
- See Also:
-
VERSIONING_RESTRICTION_XP
- See Also:
-
STANDARD_VERSIONING_SERVICE
-
versioningServices
-
versioningPoliciesRegistry
-
versioningFiltersRegistry
-
versioningRestrictionsRegistry
-
service
-
context
-
-
Constructor Details
-
VersioningComponent
public VersioningComponent()
-
-
Method Details
-
activate
Description copied from interface:Component
Activates the component.This method is called by the runtime when a component is activated.
- Specified by:
activate
in interfaceComponent
- Overrides:
activate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
deactivate
Description copied from interface:Component
Deactivates the component.This method is called by the runtime when a component is deactivated.
- Specified by:
deactivate
in interfaceComponent
- Overrides:
deactivate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
registerContribution
- Overrides:
registerContribution
in classDefaultComponent
-
unregisterContribution
- Overrides:
unregisterContribution
in classDefaultComponent
-
registerVersioningService
-
unregisterVersioningService
-
registerVersioningPolicy
-
unregisterVersioningPolicy
-
registerVersioningFilter
-
unregisterVersioningFilter
-
registerVersioningRestriction
-
unregisterVersioningRestriction
-
recompute
protected void recompute() -
getVersioningPolicies
-
getVersioningFilters
-
getVersioningRestrictions
-
getVersionLabel
Description copied from interface:VersioningService
Gets the version label to display for a given document.- Specified by:
getVersionLabel
in interfaceVersioningService
- Parameters:
doc
- the document- Returns:
- the version label, like
"2.1"
-
doPostCreate
Description copied from interface:VersioningService
Applies versioning after document creation.- Specified by:
doPostCreate
in interfaceVersioningService
- Parameters:
doc
- the documentoptions
- map event info
-
getSaveOptions
Description copied from interface:VersioningService
Checks what options are available on a document at save time.- Specified by:
getSaveOptions
in interfaceVersioningService
- Parameters:
docModel
- the document- Returns:
- the options, the first being the default
-
isPreSaveDoingCheckOut
public boolean isPreSaveDoingCheckOut(Document doc, boolean isDirty, VersioningOption option, Map<String, Serializable> options) Description copied from interface:VersioningService
Checks ifVersioningService.doPreSave(org.nuxeo.ecm.core.api.CoreSession, org.nuxeo.ecm.core.model.Document, boolean, org.nuxeo.ecm.core.api.VersioningOption, java.lang.String, java.util.Map<java.lang.String, java.io.Serializable>)
will do a checkout when called with the same arguments.Needed to be able to send "about to checkin" events.
- Specified by:
isPreSaveDoingCheckOut
in interfaceVersioningService
- Parameters:
doc
- the documentisDirty
-true
if there is actual data to saveoption
- an option chosen by the user or frameworkoptions
- map event info and options- Returns:
true
ifVersioningService.doPreSave(org.nuxeo.ecm.core.api.CoreSession, org.nuxeo.ecm.core.model.Document, boolean, org.nuxeo.ecm.core.api.VersioningOption, java.lang.String, java.util.Map<java.lang.String, java.io.Serializable>)
will do a checkout
-
doPreSave
public VersioningOption doPreSave(CoreSession session, Document doc, boolean isDirty, VersioningOption option, String checkinComment, Map<String, Serializable> options) Description copied from interface:VersioningService
Applies versioning options before document save.- Specified by:
doPreSave
in interfaceVersioningService
- Parameters:
session
- the core sessiondoc
- the documentisDirty
-true
if there is actual data to saveoption
- an option chosen by the user or frameworkcheckinComment
- a checkin commentoptions
- map event info- Returns:
- the validated option (to use in doPostSave)
-
isPostSaveDoingCheckIn
public boolean isPostSaveDoingCheckIn(Document doc, VersioningOption option, Map<String, Serializable> options) Description copied from interface:VersioningService
Checks ifVersioningService.doPostSave(org.nuxeo.ecm.core.api.CoreSession, org.nuxeo.ecm.core.model.Document, org.nuxeo.ecm.core.api.VersioningOption, java.lang.String, java.util.Map<java.lang.String, java.io.Serializable>)
will do a checkin when called with the same arguments.- Specified by:
isPostSaveDoingCheckIn
in interfaceVersioningService
- Parameters:
doc
- the documentoption
- an option chosen by the user or frameworkoptions
- map event info- Returns:
true
ifVersioningService.doPostSave(org.nuxeo.ecm.core.api.CoreSession, org.nuxeo.ecm.core.model.Document, org.nuxeo.ecm.core.api.VersioningOption, java.lang.String, java.util.Map<java.lang.String, java.io.Serializable>)
will do a checkin
-
doPostSave
public Document doPostSave(CoreSession session, Document doc, VersioningOption option, String checkinComment, Map<String, Serializable> options) Description copied from interface:VersioningService
Applies versioning options after document save. If a new version is checked in during the operation, the document for this version is returned to the caller.- Specified by:
doPostSave
in interfaceVersioningService
- Parameters:
session
- the core sessiondoc
- the documentoption
- an option chosen by the user or frameworkcheckinComment
- a checkin commentoptions
- map event info- Returns:
- checkedInDocument or null
-
doCheckIn
Description copied from interface:VersioningService
Applies version increment option and does a checkin.- Specified by:
doCheckIn
in interfaceVersioningService
- Parameters:
doc
- the documentoption
- an option chosen by the user or frameworkcheckinComment
- a checkin comment- Returns:
- the version
-
doCheckOut
Description copied from interface:VersioningService
Apply modifications after doing a checkout.- Specified by:
doCheckOut
in interfaceVersioningService
- Parameters:
doc
- the document
-
doAutomaticVersioning
public void doAutomaticVersioning(DocumentModel previousDocument, DocumentModel currentDocument, boolean before) Description copied from interface:VersioningService
Does automatic versioning if a policy exists for the current input context. Currently automatic versioning is either before or after document update, never both.- Specified by:
doAutomaticVersioning
in interfaceVersioningService
before
- the flag to trigger a before or after automatic versioning (used to retrieve the right policy)
-