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 classVersioningComponent.VersioningFilterRegistryprotected static classVersioningComponent.VersioningPolicyRegistryprotected static classVersioningComponent.VersioningRestrictionRegistryprotected static classVersioningComponent.VersioningRuleRegistryDeprecated.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, 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
-
-
Constructor Detail
-
VersioningComponent
public VersioningComponent()
-
-
Method Detail
-
activate
public void activate(ComponentContext context)
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
public void deactivate(ComponentContext context)
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
public void registerContribution(Object contrib, String point, ComponentInstance contributor)
- Overrides:
registerContributionin classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contrib, String point, ComponentInstance contributor)
- Overrides:
unregisterContributionin 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: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
public void doPostCreate(Document doc, Map<String,Serializable> options)
Description copied from interface:VersioningServiceApplies versioning after document creation.- Specified by:
doPostCreatein interfaceVersioningService- Parameters:
doc- the documentoptions- map event info
-
getSaveOptions
public List<VersioningOption> getSaveOptions(DocumentModel docModel)
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
public Document doCheckIn(Document doc, VersioningOption option, String checkinComment)
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
public void doCheckOut(Document doc)
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)
-
-