Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.core.versioning
Class VersioningComponent

java.lang.Object
  extended by org.nuxeo.runtime.model.DefaultComponent
      extended by org.nuxeo.ecm.core.versioning.VersioningComponent
All Implemented Interfaces:
VersioningService, Adaptable, Component, Extensible

public class VersioningComponent
extends DefaultComponent
implements VersioningService

Versioning service component and implementation.


Field Summary
 VersioningService service
           
static String VERSIONING_RULE_XP
           
static String XP
           
 
Fields inherited from interface org.nuxeo.ecm.core.versioning.VersioningService
CHECKIN_COMMENT, MAJOR_VERSION_PROP, MINOR_VERSION_PROP, SKIP_VERSIONING, VERSIONING_OPTION
 
Constructor Summary
VersioningComponent()
           
 
Method Summary
 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)
           
 
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
applicationStarted, getAdapter, registerExtension, unregisterExtension
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XP

public static final String XP
See Also:
Constant Field Values

VERSIONING_RULE_XP

public static final String VERSIONING_RULE_XP
See Also:
Constant Field Values

service

public VersioningService service
Constructor Detail

VersioningComponent

public VersioningComponent()
Method Detail

activate

public void activate(ComponentContext context)
              throws Exception
Description copied from interface: Component
Activates the component.

This method is called by the runtime when a component is activated.

Specified by:
activate in interface Component
Overrides:
activate in class DefaultComponent
Parameters:
context - the runtime context
Throws:
Exception - if an error occurs during activation

deactivate

public void deactivate(ComponentContext context)
                throws Exception
Description copied from interface: Component
Deactivates the component.

This method is called by the runtime when a component is deactivated.

Specified by:
deactivate in interface Component
Overrides:
deactivate in class DefaultComponent
Parameters:
context - the runtime context
Throws:
Exception - if an error occurs during activation

registerContribution

public void registerContribution(Object contrib,
                                 String xp,
                                 ComponentInstance contributor)
                          throws Exception
Overrides:
registerContribution in class DefaultComponent
Throws:
Exception

unregisterContribution

public void unregisterContribution(Object contrib,
                                   String xp,
                                   ComponentInstance contributor)
                            throws Exception
Overrides:
unregisterContribution in class DefaultComponent
Throws:
Exception

getService

public VersioningService getService()

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 interface VersioningService
Parameters:
doc - the document
Returns:
the version label, like "2.1"

doPostCreate

public void doPostCreate(Document doc,
                         Map<String,Serializable> options)
                  throws DocumentException
Description copied from interface: VersioningService
Applies versioning after document creation.

Specified by:
doPostCreate in interface VersioningService
Parameters:
doc - the document
Throws:
DocumentException

getSaveOptions

public List<VersioningOption> getSaveOptions(DocumentModel docModel)
                                      throws ClientException
Description copied from interface: VersioningService
Checks what options are available on a document at save time.

Specified by:
getSaveOptions in interface VersioningService
Parameters:
docModel - the document
Returns:
the options, the first being the default
Throws:
ClientException

doPreSave

public VersioningOption doPreSave(Document doc,
                                  boolean isDirty,
                                  VersioningOption option,
                                  String checkinComment,
                                  Map<String,Serializable> options)
                           throws DocumentException
Description copied from interface: VersioningService
Applies versioning options before document save.

Specified by:
doPreSave in interface VersioningService
Parameters:
doc - the document
isDirty - true if there is actual data to save
option - an option chosen by the user or framework
checkinComment - a checkin comment
Returns:
the validated option (to use in doPostSave)
Throws:
DocumentException

doPostSave

public Document doPostSave(Document doc,
                           VersioningOption option,
                           String checkinComment,
                           Map<String,Serializable> options)
                    throws DocumentException
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 interface VersioningService
Parameters:
doc - the document
option - an option chosen by the user or framework
checkinComment - a checkin comment
Returns:
checkedInDocument or null
Throws:
DocumentException

doCheckIn

public Document doCheckIn(Document doc,
                          VersioningOption option,
                          String checkinComment)
                   throws DocumentException
Description copied from interface: VersioningService
Applies version increment option and does a checkin.

Specified by:
doCheckIn in interface VersioningService
Parameters:
doc - the document
option - an option chosen by the user or framework
checkinComment - a checkin comment
Returns:
the version
Throws:
DocumentException

doCheckOut

public void doCheckOut(Document doc)
                throws DocumentException
Description copied from interface: VersioningService
Apply modifications after doing a checkout.

Specified by:
doCheckOut in interface VersioningService
Parameters:
doc - the document
Throws:
DocumentException

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.