public class StandardVersioningService extends Object implements ExtendableVersioningService
Modifier and Type | Field and Description |
---|---|
static String |
APPROVED_STATE |
protected static String |
AUTO_CHECKED_OUT
Deprecated.
since 9.1 seems unused
|
static String |
BACK_TO_PROJECT_TRANSITION |
static String |
CATEGORY |
static String |
COMMENT |
protected static String |
COMPAT_DEFAULT_ID |
protected static String |
COMPAT_ID_PREFIX |
protected static int |
DEFAULT_FORMER_RULE_ORDER |
static String |
FILE_TYPE
Deprecated.
since 9.1 seems unused
|
protected static String |
MAJOR_VERSION
Key for major version in Document API.
|
protected static String |
MINOR_VERSION
Key for minor version in Document API.
|
static String |
NOTE_TYPE
Deprecated.
since 9.1 seems unused
|
static String |
OBSOLETE_STATE |
static String |
PROJECT_STATE
Deprecated.
since 9.1 seems unused
|
CHECKIN_COMMENT, DISABLE_AUTO_CHECKOUT, MAJOR_VERSION_PROP, MINOR_VERSION_PROP, SKIP_VERSIONING, VERSIONING_OPTION
Constructor and Description |
---|
StandardVersioningService() |
protected static final int DEFAULT_FORMER_RULE_ORDER
protected static final String COMPAT_ID_PREFIX
protected static final String COMPAT_DEFAULT_ID
@Deprecated public static final String FILE_TYPE
@Deprecated public static final String NOTE_TYPE
@Deprecated public static final String PROJECT_STATE
public static final String APPROVED_STATE
public static final String OBSOLETE_STATE
public static final String BACK_TO_PROJECT_TRANSITION
@Deprecated protected static final String AUTO_CHECKED_OUT
protected static final String MAJOR_VERSION
protected static final String MINOR_VERSION
public static final String CATEGORY
public static final String COMMENT
public StandardVersioningService()
public String getVersionLabel(DocumentModel docModel)
VersioningService
getVersionLabel
in interface VersioningService
docModel
- the document"2.1"
protected long getMajor(DocumentModel docModel)
protected long getMinor(DocumentModel docModel)
protected long getVersion(DocumentModel docModel, String prop)
protected long getVersion(Document doc, String prop)
protected void setVersion(Document doc, long major, long minor)
protected void incrementMajor(Document doc)
protected void incrementMinor(Document doc)
protected void incrementByOption(Document doc, VersioningOption option)
public void doPostCreate(Document doc, Map<String,Serializable> options)
VersioningService
doPostCreate
in interface VersioningService
doc
- the documentoptions
- map event infoprotected void setInitialVersion(Document doc)
public List<VersioningOption> getSaveOptions(DocumentModel docModel)
VersioningService
getSaveOptions
in interface VersioningService
docModel
- the documentprotected List<VersioningOption> getSaveOptions(Document doc)
protected List<VersioningOption> getSaveOptions(boolean versionable, String lifeCycleState, String type)
protected List<VersioningOption> computeRestrictionOptions(String lifeCycleState, String type)
protected VersioningOption validateOption(Document doc, VersioningOption option)
public boolean isPreSaveDoingCheckOut(Document doc, boolean isDirty, VersioningOption option, Map<String,Serializable> options)
VersioningService
VersioningService.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.
isPreSaveDoingCheckOut
in interface VersioningService
doc
- the documentisDirty
- true
if there is actual data to saveoption
- an option chosen by the user or frameworkoptions
- map event info and optionstrue
if VersioningService.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 checkoutpublic VersioningOption doPreSave(CoreSession session, Document doc, boolean isDirty, VersioningOption option, String checkinComment, Map<String,Serializable> options)
VersioningService
doPreSave
in interface VersioningService
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 infoprotected void followTransitionByOption(CoreSession session, Document doc, Map<String,Serializable> options)
public boolean isPostSaveDoingCheckIn(Document doc, VersioningOption option, Map<String,Serializable> options)
VersioningService
VersioningService.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.isPostSaveDoingCheckIn
in interface VersioningService
doc
- the documentoption
- an option chosen by the user or frameworkoptions
- map event infotrue
if VersioningService.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 checkinpublic Document doPostSave(CoreSession session, Document doc, VersioningOption option, String checkinComment, Map<String,Serializable> options)
VersioningService
doPostSave
in interface VersioningService
session
- the core sessiondoc
- the documentoption
- an option chosen by the user or frameworkcheckinComment
- a checkin commentoptions
- map event infopublic Document doCheckIn(Document doc, VersioningOption option, String checkinComment)
VersioningService
doCheckIn
in interface VersioningService
doc
- the documentoption
- an option chosen by the user or frameworkcheckinComment
- a checkin commentpublic void doCheckOut(Document doc)
VersioningService
doCheckOut
in interface VersioningService
doc
- the document@Deprecated public Map<String,VersioningRuleDescriptor> getVersioningRules()
getVersioningRules
in interface ExtendableVersioningService
@Deprecated public void setVersioningRules(Map<String,VersioningRuleDescriptor> versioningRules)
ExtendableVersioningService
setVersioningRules
in interface ExtendableVersioningService
@Deprecated public void setDefaultVersioningRule(DefaultVersioningRuleDescriptor defaultVersioningRule)
ExtendableVersioningService
setDefaultVersioningRule
in interface ExtendableVersioningService
public void setVersioningPolicies(Map<String,VersioningPolicyDescriptor> versioningPolicies)
ExtendableVersioningService
setVersioningPolicies
in interface ExtendableVersioningService
public void setVersioningFilters(Map<String,VersioningFilterDescriptor> versioningFilters)
ExtendableVersioningService
setVersioningFilters
in interface ExtendableVersioningService
public void setVersioningRestrictions(Map<String,VersioningRestrictionDescriptor> versioningRestrictions)
ExtendableVersioningService
setVersioningRestrictions
in interface ExtendableVersioningService
versioningRestrictions
- the restrictions to apply in versioning systempublic void doAutomaticVersioning(DocumentModel previousDocument, DocumentModel currentDocument, boolean before)
VersioningService
doAutomaticVersioning
in interface VersioningService
before
- the flag to trigger a before or after automatic versioning (used to retrieve the right policy)protected VersioningPolicyDescriptor retrieveMatchingVersioningPolicy(DocumentModel previousDocument, DocumentModel currentDocument, boolean before)
protected boolean isPolicyMatch(VersioningPolicyDescriptor policyDescriptor, DocumentModel previousDocument, DocumentModel currentDocument)
protected void sendEvent(CoreSession session, Document doc, String previousLifecycleState, Map<String,Serializable> options)
Copyright © 2018 Nuxeo. All rights reserved.