Class LifeCycleServiceImpl
- java.lang.Object
-
- org.nuxeo.runtime.model.DefaultComponent
-
- org.nuxeo.ecm.core.lifecycle.impl.LifeCycleServiceImpl
-
- All Implemented Interfaces:
LifeCycleService
,Adaptable
,Component
,Extensible
,TimestampedService
public class LifeCycleServiceImpl extends DefaultComponent implements LifeCycleService
Life cycle service implementation.- Author:
- Julien Anguenot, Florent Guillaume
- See Also:
LifeCycleService
-
-
Field Summary
Fields Modifier and Type Field Description protected LifeCycleRegistry
lifeCycles
protected LifeCycleTypeRegistry
lifeCycleTypes
static ComponentName
NAME
-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
-
Constructor Summary
Constructors Constructor Description LifeCycleServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
followTransition(Document doc, String transitionName)
Follows a given transition.LifeCycle
getLifeCycleByName(String name)
Returns a life cycle given its name.LifeCycle
getLifeCycleFor(Document doc)
Returns the life cycle a given document follows.String
getLifeCycleNameFor(String typeName)
Returns the lifecycle name that the given type follows.Collection<LifeCycle>
getLifeCycles()
Returns all the registered life cycles.List<String>
getNonRecursiveTransitionForDocType(String docTypeName)
Returns a list of transition for which, when a it is followed, it should no recurse in its children.Collection<String>
getTypesFor(String lifeCycleName)
Returns the types which follow a given life cycle.Map<String,String>
getTypesMapping()
Returns the mapping from types to life cycle names.void
initialize(Document doc)
Initializes the life cycle for the given document.void
initialize(Document doc, String initialStateName)
Initializes the life cycle for the given document.void
registerExtension(Extension extension)
Register extensions.void
reinitLifeCycle(Document doc)
Sets the current state to the initial state as defined by the associated lifecycle.void
unregisterExtension(Extension extension)
Unregisters an extension.-
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterContribution
-
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
-
NAME
public static final ComponentName NAME
-
lifeCycles
protected LifeCycleRegistry lifeCycles
-
lifeCycleTypes
protected LifeCycleTypeRegistry lifeCycleTypes
-
-
Method Detail
-
getLifeCycleByName
public LifeCycle getLifeCycleByName(String name)
Description copied from interface:LifeCycleService
Returns a life cycle given its name.- Specified by:
getLifeCycleByName
in interfaceLifeCycleService
- Parameters:
name
- the life cycle's name- Returns:
- a life cycle descriptor instance or null if not found.
-
getLifeCycleFor
public LifeCycle getLifeCycleFor(Document doc)
Description copied from interface:LifeCycleService
Returns the life cycle a given document follows.- Specified by:
getLifeCycleFor
in interfaceLifeCycleService
- Parameters:
doc
- the document instance- Returns:
- the life cycle instance
-
getLifeCycleNameFor
public String getLifeCycleNameFor(String typeName)
Description copied from interface:LifeCycleService
Returns the lifecycle name that the given type follows.- Specified by:
getLifeCycleNameFor
in interfaceLifeCycleService
- Parameters:
typeName
- the type's name- Returns:
- the life cycle name
-
getLifeCycles
public Collection<LifeCycle> getLifeCycles()
Description copied from interface:LifeCycleService
Returns all the registered life cycles.- Specified by:
getLifeCycles
in interfaceLifeCycleService
- Returns:
- a collection of lifecycle descriptors
-
getTypesFor
public Collection<String> getTypesFor(String lifeCycleName)
Description copied from interface:LifeCycleService
Returns the types which follow a given life cycle.- Specified by:
getTypesFor
in interfaceLifeCycleService
- Parameters:
lifeCycleName
- a string holding the name of the life cycle- Returns:
- a collection of type names as strings
-
getTypesMapping
public Map<String,String> getTypesMapping()
Description copied from interface:LifeCycleService
Returns the mapping from types to life cycle names.- Specified by:
getTypesMapping
in interfaceLifeCycleService
- Returns:
- a mapping from types to life cycle names
-
initialize
public void initialize(Document doc) throws LifeCycleException
Description copied from interface:LifeCycleService
Initializes the life cycle for the given document.Document state will be set to the life cycle initial state.
- Specified by:
initialize
in interfaceLifeCycleService
- Parameters:
doc
- the document instance- Throws:
LifeCycleException
-
initialize
public void initialize(Document doc, String initialStateName) throws LifeCycleException
Description copied from interface:LifeCycleService
Initializes the life cycle for the given document.Tries to set given state on document, if it's a valid initial state.
- Specified by:
initialize
in interfaceLifeCycleService
- Parameters:
doc
- the document instanceinitialStateName
- the initial state name- Throws:
LifeCycleException
-
followTransition
public void followTransition(Document doc, String transitionName) throws LifeCycleException
Description copied from interface:LifeCycleService
Follows a given transition.- Specified by:
followTransition
in interfaceLifeCycleService
- Parameters:
doc
- the Document instancetransitionName
- the transition name- Throws:
LifeCycleException
-
reinitLifeCycle
public void reinitLifeCycle(Document doc) throws LifeCycleException
Description copied from interface:LifeCycleService
Sets the current state to the initial state as defined by the associated lifecycle.- Specified by:
reinitLifeCycle
in interfaceLifeCycleService
- Throws:
LifeCycleException
-
registerExtension
public void registerExtension(Extension extension)
Register extensions.- Specified by:
registerExtension
in interfaceExtensible
- Overrides:
registerExtension
in classDefaultComponent
- Parameters:
extension
- the extension to register
-
unregisterExtension
public void unregisterExtension(Extension extension)
Unregisters an extension.- Specified by:
unregisterExtension
in interfaceExtensible
- Overrides:
unregisterExtension
in classDefaultComponent
- Parameters:
extension
- the extension to unregister
-
getNonRecursiveTransitionForDocType
public List<String> getNonRecursiveTransitionForDocType(String docTypeName)
Description copied from interface:LifeCycleService
Returns a list of transition for which, when a it is followed, it should no recurse in its children. TheBulkLifeCycleChangeListener
will listen to the transition taken event and call a follow transition on the children of the document if the document is folderish. It check this list of transition to find out if it should recurse.- Specified by:
getNonRecursiveTransitionForDocType
in interfaceLifeCycleService
- Parameters:
docTypeName
- The doc type- Returns:
- a list of transition name
- See Also:
BulkLifeCycleChangeListener
-
-