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
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected static classprotected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ComponentContextprotected static final StandardVersioningServicestatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected Map<VersioningServiceDescriptor,VersioningService> Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, nameFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(ComponentContext context) Activates the component.voiddeactivate(ComponentContext context) Deactivates the component.voiddoAutomaticVersioning(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.voiddoCheckOut(Document doc) Apply modifications after doing a checkout.voiddoPostCreate(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.booleanisPostSaveDoingCheckIn(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.booleanisPreSaveDoingCheckOut(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 voidvoidregisterContribution(Object contrib, String point, ComponentInstance contributor) protected voidprotected voidprotected voidprotected voidvoidunregisterContribution(Object contrib, String point, ComponentInstance contributor) protected voidprotected voidprotected voidprotected voidMethods inherited from class org.nuxeo.runtime.model.DefaultComponent
addRuntimeMessage, addRuntimeMessage, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterExtensionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:ComponentActivates the component.This method is called by the runtime when a component is activated.
- Specified by:
activatein interfaceComponent- Overrides:
activatein classDefaultComponent- Parameters:
context- the runtime context
-
deactivate
Description copied from interface:ComponentDeactivates the component.This method is called by the runtime when a component is deactivated.
- Specified by:
deactivatein interfaceComponent- Overrides:
deactivatein classDefaultComponent- Parameters:
context- the runtime context
-
registerContribution
- Overrides:
registerContributionin classDefaultComponent
-
unregisterContribution
- Overrides:
unregisterContributionin classDefaultComponent
-
registerVersioningService
-
unregisterVersioningService
-
registerVersioningPolicy
-
unregisterVersioningPolicy
-
registerVersioningFilter
-
unregisterVersioningFilter
-
registerVersioningRestriction
-
unregisterVersioningRestriction
-
recompute
protected void recompute() -
getVersioningPolicies
-
getVersioningFilters
-
getVersioningRestrictions
-
getVersionLabel
Description copied from interface:VersioningServiceGets the version label to display for a given document.- Specified by:
getVersionLabelin interfaceVersioningService- Parameters:
doc- the document- Returns:
- the version label, like
"2.1"
-
doPostCreate
Description copied from interface:VersioningServiceApplies versioning after document creation.- Specified by:
doPostCreatein interfaceVersioningService- Parameters:
doc- the documentoptions- map event info
-
getSaveOptions
Description copied from interface:VersioningServiceChecks what options are available on a document at save time.- Specified by:
getSaveOptionsin 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:VersioningServiceChecks 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:
isPreSaveDoingCheckOutin interfaceVersioningService- Parameters:
doc- the documentisDirty-trueif there is actual data to saveoption- an option chosen by the user or frameworkoptions- map event info and options- Returns:
trueifVersioningService.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:VersioningServiceApplies versioning options before document save.- Specified by:
doPreSavein interfaceVersioningService- Parameters:
session- the core sessiondoc- the documentisDirty-trueif 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:VersioningServiceChecks 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:
isPostSaveDoingCheckInin interfaceVersioningService- Parameters:
doc- the documentoption- an option chosen by the user or frameworkoptions- map event info- Returns:
trueifVersioningService.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:VersioningServiceApplies 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:
doPostSavein 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:VersioningServiceApplies version increment option and does a checkin.- Specified by:
doCheckInin interfaceVersioningService- Parameters:
doc- the documentoption- an option chosen by the user or frameworkcheckinComment- a checkin comment- Returns:
- the version
-
doCheckOut
Description copied from interface:VersioningServiceApply modifications after doing a checkout.- Specified by:
doCheckOutin interfaceVersioningService- Parameters:
doc- the document
-
doAutomaticVersioning
public void doAutomaticVersioning(DocumentModel previousDocument, DocumentModel currentDocument, boolean before) Description copied from interface:VersioningServiceDoes 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:
doAutomaticVersioningin interfaceVersioningServicebefore- the flag to trigger a before or after automatic versioning (used to retrieve the right policy)
-