public class VersioningComponent extends DefaultComponent implements VersioningService
Modifier and Type | Field and Description |
---|---|
VersioningService |
service |
static String |
VERSIONING_RULE_XP |
static String |
XP |
CHECKIN_COMMENT, MAJOR_VERSION_PROP, MINOR_VERSION_PROP, SKIP_VERSIONING, VERSIONING_OPTION
Constructor and Description |
---|
VersioningComponent() |
Modifier and Type | Method and Description |
---|---|
void |
activate(ComponentContext context)
Activates the component.
|
void |
deactivate(ComponentContext context)
Deactivates the component.
|
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.
|
List<VersioningOption> |
getSaveOptions(DocumentModel docModel)
Checks what options are available on a document at save time.
|
VersioningService |
getService() |
String |
getVersionLabel(DocumentModel doc)
Gets the version label to display for a given document.
|
void |
registerContribution(Object contrib,
String xp,
ComponentInstance contributor) |
void |
unregisterContribution(Object contrib,
String xp,
ComponentInstance contributor) |
applicationStarted, getAdapter, registerExtension, unregisterExtension
public static final String XP
public static final String VERSIONING_RULE_XP
public VersioningService service
public void activate(ComponentContext context) throws Exception
Component
This method is called by the runtime when a component is activated.
activate
in interface Component
activate
in class DefaultComponent
context
- the runtime contextException
- if an error occurs during activationpublic void deactivate(ComponentContext context) throws Exception
Component
This method is called by the runtime when a component is deactivated.
deactivate
in interface Component
deactivate
in class DefaultComponent
context
- the runtime contextException
- if an error occurs during activationpublic void registerContribution(Object contrib, String xp, ComponentInstance contributor) throws Exception
registerContribution
in class DefaultComponent
Exception
public void unregisterContribution(Object contrib, String xp, ComponentInstance contributor) throws Exception
unregisterContribution
in class DefaultComponent
Exception
public VersioningService getService()
public String getVersionLabel(DocumentModel doc)
VersioningService
getVersionLabel
in interface VersioningService
doc
- the document"2.1"
public void doPostCreate(Document doc, Map<String,Serializable> options) throws DocumentException
VersioningService
doPostCreate
in interface VersioningService
doc
- the documentDocumentException
public List<VersioningOption> getSaveOptions(DocumentModel docModel) throws ClientException
VersioningService
getSaveOptions
in interface VersioningService
docModel
- the documentClientException
public VersioningOption doPreSave(Document doc, boolean isDirty, VersioningOption option, String checkinComment, Map<String,Serializable> options) throws DocumentException
VersioningService
doPreSave
in interface VersioningService
doc
- the documentisDirty
- true
if there is actual data to saveoption
- an option chosen by the user or frameworkcheckinComment
- a checkin commentDocumentException
public Document doPostSave(Document doc, VersioningOption option, String checkinComment, Map<String,Serializable> options) throws DocumentException
VersioningService
doPostSave
in interface VersioningService
doc
- the documentoption
- an option chosen by the user or frameworkcheckinComment
- a checkin commentDocumentException
public Document doCheckIn(Document doc, VersioningOption option, String checkinComment) throws DocumentException
VersioningService
doCheckIn
in interface VersioningService
doc
- the documentoption
- an option chosen by the user or frameworkcheckinComment
- a checkin commentDocumentException
public void doCheckOut(Document doc) throws DocumentException
VersioningService
doCheckOut
in interface VersioningService
doc
- the documentDocumentException
Copyright © 2011 Nuxeo SA. All Rights Reserved.