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
,VersioningService
,Adaptable
,Component
,Extensible
,TimestampedService
public class VersioningComponent extends DefaultComponent implements VersioningService
Versioning service component and implementation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
VersioningComponent.VersioningFilterRegistry
protected static class
VersioningComponent.VersioningPolicyRegistry
protected static class
VersioningComponent.VersioningRestrictionRegistry
protected static class
VersioningComponent.VersioningRuleRegistry
Deprecated.since 9.1 use 'policy', 'filter' and 'restriction' contributions instead
-
Field Summary
-
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
Constructors Constructor Description VersioningComponent()
-
Method Summary
-
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
applicationStarted, getApplicationStartedOrder
-
-
-
-
Field Detail
-
VERSIONING_SERVICE_XP
public static final String VERSIONING_SERVICE_XP
- See Also:
- Constant Field Values
-
VERSIONING_RULE_XP
public static final String VERSIONING_RULE_XP
- See Also:
- Constant Field Values
-
VERSIONING_POLICY_XP
public static final String VERSIONING_POLICY_XP
- See Also:
- Constant Field Values
-
VERSIONING_FILTER_XP
public static final String VERSIONING_FILTER_XP
- See Also:
- Constant Field Values
-
VERSIONING_RESTRICTION_XP
public static final String VERSIONING_RESTRICTION_XP
- See Also:
- Constant Field Values
-
STANDARD_VERSIONING_SERVICE
protected static final StandardVersioningService STANDARD_VERSIONING_SERVICE
-
versioningServices
protected Map<VersioningServiceDescriptor,VersioningService> versioningServices
-
versioningRulesRegistry
@Deprecated protected VersioningComponent.VersioningRuleRegistry versioningRulesRegistry
Deprecated.since 9.1 use 'policy', 'filter' and 'restriction' contributions instead
-
versioningPoliciesRegistry
protected VersioningComponent.VersioningPolicyRegistry versioningPoliciesRegistry
-
versioningFiltersRegistry
protected VersioningComponent.VersioningFilterRegistry versioningFiltersRegistry
-
versioningRestrictionsRegistry
protected VersioningComponent.VersioningRestrictionRegistry versioningRestrictionsRegistry
-
defaultVersioningRuleList
@Deprecated protected Deque<DefaultVersioningRuleDescriptor> defaultVersioningRuleList
Deprecated.since 9.1 use 'policy', 'filter' and 'restriction' contributions instead
-
service
public VersioningService service
-
context
protected ComponentContext context
-
-
Method Detail
-
activate
public void activate(ComponentContext context)
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
public void deactivate(ComponentContext context)
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
public void registerContribution(Object contrib, String point, ComponentInstance contributor)
- Overrides:
registerContribution
in classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contrib, String point, ComponentInstance contributor)
- Overrides:
unregisterContribution
in classDefaultComponent
-
registerVersioningService
protected void registerVersioningService(VersioningServiceDescriptor contrib)
-
unregisterVersioningService
protected void unregisterVersioningService(VersioningServiceDescriptor contrib)
-
registerVersioningRule
@Deprecated protected void registerVersioningRule(VersioningRuleDescriptor contrib)
Deprecated.since 9.1, use policy and filter contributions instead
-
unregisterVersioningRule
@Deprecated protected void unregisterVersioningRule(VersioningRuleDescriptor contrib)
Deprecated.since 9.1, use policy and filter contributions instead
-
registerDefaultVersioningRule
@Deprecated protected void registerDefaultVersioningRule(DefaultVersioningRuleDescriptor contrib)
Deprecated.since 9.1, use policy and filter contributions instead
-
unregisterDefaultVersioningRule
@Deprecated protected void unregisterDefaultVersioningRule(DefaultVersioningRuleDescriptor contrib)
Deprecated.since 9.1, use policy and filter contributions instead
-
registerVersioningPolicy
protected void registerVersioningPolicy(VersioningPolicyDescriptor contrib)
-
unregisterVersioningPolicy
protected void unregisterVersioningPolicy(VersioningPolicyDescriptor contrib)
-
registerVersioningFilter
protected void registerVersioningFilter(VersioningFilterDescriptor contrib)
-
unregisterVersioningFilter
protected void unregisterVersioningFilter(VersioningFilterDescriptor contrib)
-
registerVersioningRestriction
protected void registerVersioningRestriction(VersioningRestrictionDescriptor contrib)
-
unregisterVersioningRestriction
protected void unregisterVersioningRestriction(VersioningRestrictionDescriptor contrib)
-
recompute
protected void recompute()
-
getVersioningRules
@Deprecated protected Map<String,VersioningRuleDescriptor> getVersioningRules()
Deprecated.since 9.1, use policy and filter contributions instead
-
getDefaultVersioningRule
@Deprecated protected DefaultVersioningRuleDescriptor getDefaultVersioningRule()
Deprecated.since 9.1, use policy and filter contributions instead
-
getVersioningPolicies
protected Map<String,VersioningPolicyDescriptor> getVersioningPolicies()
-
getVersioningFilters
protected Map<String,VersioningFilterDescriptor> getVersioningFilters()
-
getVersioningRestrictions
protected Map<String,VersioningRestrictionDescriptor> getVersioningRestrictions()
-
getVersionLabel
public String getVersionLabel(DocumentModel doc)
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
public void doPostCreate(Document doc, Map<String,Serializable> options)
Description copied from interface:VersioningService
Applies versioning after document creation.- Specified by:
doPostCreate
in interfaceVersioningService
- Parameters:
doc
- the documentoptions
- map event info
-
getSaveOptions
public List<VersioningOption> getSaveOptions(DocumentModel docModel)
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
public Document doCheckIn(Document doc, VersioningOption option, String checkinComment)
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
public void doCheckOut(Document doc)
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)
-
-