public class LifeCycleServiceImpl extends DefaultComponent implements LifeCycleService
LifeCycleService
Modifier and Type | Field and Description |
---|---|
protected LifeCycleRegistry |
lifeCycles |
protected LifeCycleTypeRegistry |
lifeCycleTypes |
static ComponentName |
NAME |
lastModified
Constructor and Description |
---|
LifeCycleServiceImpl() |
Modifier and Type | Method and 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.
|
activate, deactivate, getAdapter, getLastModified, registerContribution, setLastModified, setModifiedNow, start, stop, unregisterContribution
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applicationStarted, getApplicationStartedOrder
public static final ComponentName NAME
protected LifeCycleRegistry lifeCycles
protected LifeCycleTypeRegistry lifeCycleTypes
public LifeCycleServiceImpl()
public LifeCycle getLifeCycleByName(String name)
LifeCycleService
getLifeCycleByName
in interface LifeCycleService
name
- the life cycle's namepublic LifeCycle getLifeCycleFor(Document doc)
LifeCycleService
getLifeCycleFor
in interface LifeCycleService
doc
- the document instancepublic String getLifeCycleNameFor(String typeName)
LifeCycleService
getLifeCycleNameFor
in interface LifeCycleService
typeName
- the type's namepublic Collection<LifeCycle> getLifeCycles()
LifeCycleService
getLifeCycles
in interface LifeCycleService
public Collection<String> getTypesFor(String lifeCycleName)
LifeCycleService
getTypesFor
in interface LifeCycleService
lifeCycleName
- a string holding the name of the life cyclepublic Map<String,String> getTypesMapping()
LifeCycleService
getTypesMapping
in interface LifeCycleService
public void initialize(Document doc) throws LifeCycleException
LifeCycleService
Document state will be set to the life cycle initial state.
initialize
in interface LifeCycleService
doc
- the document instanceLifeCycleException
LifeCycleException
public void initialize(Document doc, String initialStateName) throws LifeCycleException
LifeCycleService
Tries to set given state on document, if it's a valid initial state.
initialize
in interface LifeCycleService
doc
- the document instanceinitialStateName
- the initial state nameLifeCycleException
LifeCycleException
public void followTransition(Document doc, String transitionName) throws LifeCycleException
LifeCycleService
followTransition
in interface LifeCycleService
doc
- the Document instancetransitionName
- the transition nameLifeCycleException
LifeCycleException
public void reinitLifeCycle(Document doc) throws LifeCycleException
LifeCycleService
reinitLifeCycle
in interface LifeCycleService
LifeCycleException
LifeCycleException
public void registerExtension(Extension extension)
registerExtension
in interface Extensible
registerExtension
in class DefaultComponent
extension
- the extension to registerpublic void unregisterExtension(Extension extension)
unregisterExtension
in interface Extensible
unregisterExtension
in class DefaultComponent
extension
- the extension to unregisterpublic List<String> getNonRecursiveTransitionForDocType(String docTypeName)
LifeCycleService
BulkLifeCycleChangeListener
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.getNonRecursiveTransitionForDocType
in interface LifeCycleService
docTypeName
- The doc typeBulkLifeCycleChangeListener
Copyright © 2018 Nuxeo. All rights reserved.