public class StandardVersioningService extends Object implements ExtendableVersioningService
| Modifier and Type | Field and Description |
|---|---|
static String |
APPROVED_STATE |
protected static String |
AUTO_CHECKED_OUT |
static String |
BACK_TO_PROJECT_TRANSITION |
static String |
FILE_TYPE |
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 |
static String |
OBSOLETE_STATE |
static String |
PROJECT_STATE |
CHECKIN_COMMENT, DISABLE_AUTO_CHECKOUT, MAJOR_VERSION_PROP, MINOR_VERSION_PROP, SKIP_VERSIONING, VERSIONING_OPTION| Constructor and Description |
|---|
StandardVersioningService() |
| Modifier and Type | Method and Description |
|---|---|
Document |
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.
|
Document |
doPostSave(Document doc,
VersioningOption option,
String checkinComment,
Map<String,Serializable> options)
Applies versioning options after document save.
|
VersioningOption |
doPreSave(Document doc,
boolean isDirty,
VersioningOption option,
String checkinComment,
Map<String,Serializable> options)
Applies versioning options before document save.
|
protected void |
followTransitionByOption(Document doc,
VersioningOption option) |
protected long |
getMajor(Document doc) |
protected long |
getMajor(DocumentModel docModel) |
protected long |
getMinor(Document doc) |
protected long |
getMinor(DocumentModel docModel) |
protected List<VersioningOption> |
getSaveOptions(boolean versionable,
String lifecycleState,
String type) |
protected List<VersioningOption> |
getSaveOptions(Document doc) |
List<VersioningOption> |
getSaveOptions(DocumentModel docModel)
Checks what options are available on a document at save time.
|
protected long |
getVersion(DocumentModel docModel,
String prop) |
protected long |
getVersion(Document doc,
String prop) |
Map<String,VersioningRuleDescriptor> |
getVersioningRules() |
String |
getVersionLabel(DocumentModel docModel)
Gets the version label to display for a given document.
|
protected void |
incrementByOption(Document doc,
VersioningOption option) |
protected void |
incrementMajor(Document doc) |
protected void |
incrementMinor(Document doc) |
boolean |
isPostSaveDoingCheckIn(Document doc,
VersioningOption option,
Map<String,Serializable> options)
Checks if
VersioningService.doPostSave(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 if
VersioningService.doPreSave(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. |
void |
setDefaultVersioningRule(DefaultVersioningRuleDescriptor defaultVersioningRule)
Set the default versioning rule for all document type.
|
protected void |
setInitialVersion(Document doc)
Sets the initial version on a document.
|
protected void |
setVersion(Document doc,
long major,
long minor) |
void |
setVersioningRules(Map<String,VersioningRuleDescriptor> versioningRules)
Add versioning rules for specific types.
|
protected VersioningOption |
validateOption(Document doc,
VersioningOption option) |
public static final String FILE_TYPE
public static final String NOTE_TYPE
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
protected static final String AUTO_CHECKED_OUT
protected static final String MAJOR_VERSION
protected static final String MINOR_VERSION
public StandardVersioningService()
public String getVersionLabel(DocumentModel docModel)
VersioningServicegetVersionLabel in interface VersioningServicedocModel - 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)
VersioningServicedoPostCreate in interface VersioningServicedoc - the documentprotected void setInitialVersion(Document doc)
public List<VersioningOption> getSaveOptions(DocumentModel docModel)
VersioningServicegetSaveOptions in interface VersioningServicedocModel - the documentprotected List<VersioningOption> getSaveOptions(Document doc)
protected List<VersioningOption> getSaveOptions(boolean versionable, String lifecycleState, String type)
protected VersioningOption validateOption(Document doc, VersioningOption option)
public boolean isPreSaveDoingCheckOut(Document doc, boolean isDirty, VersioningOption option, Map<String,Serializable> options)
VersioningServiceVersioningService.doPreSave(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 VersioningServicedoc - 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.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(Document doc, boolean isDirty, VersioningOption option, String checkinComment, Map<String,Serializable> options)
VersioningServicedoPreSave in interface VersioningServicedoc - the documentisDirty - true if there is actual data to saveoption - an option chosen by the user or frameworkcheckinComment - a checkin commentprotected void followTransitionByOption(Document doc, VersioningOption option)
public boolean isPostSaveDoingCheckIn(Document doc, VersioningOption option, Map<String,Serializable> options)
VersioningServiceVersioningService.doPostSave(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 VersioningServicedoc - the documentoption - an option chosen by the user or frameworkoptions - map event infotrue if VersioningService.doPostSave(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(Document doc, VersioningOption option, String checkinComment, Map<String,Serializable> options)
VersioningServicedoPostSave in interface VersioningServicedoc - the documentoption - an option chosen by the user or frameworkcheckinComment - a checkin commentpublic Document doCheckIn(Document doc, VersioningOption option, String checkinComment)
VersioningServicedoCheckIn in interface VersioningServicedoc - the documentoption - an option chosen by the user or frameworkcheckinComment - a checkin commentpublic void doCheckOut(Document doc)
VersioningServicedoCheckOut in interface VersioningServicedoc - the documentpublic Map<String,VersioningRuleDescriptor> getVersioningRules()
getVersioningRules in interface ExtendableVersioningServicepublic void setVersioningRules(Map<String,VersioningRuleDescriptor> versioningRules)
ExtendableVersioningServicesetVersioningRules in interface ExtendableVersioningServicepublic void setDefaultVersioningRule(DefaultVersioningRuleDescriptor defaultVersioningRule)
ExtendableVersioningServicesetDefaultVersioningRule in interface ExtendableVersioningServiceCopyright © 2016 Nuxeo SA. All rights reserved.