public class LifeCycleServiceImpl extends DefaultComponent implements LifeCycleService
LifeCycleService
Modifier and Type | Field and Description |
---|---|
static ComponentName |
NAME |
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, applicationStarted, deactivate, getAdapter, getApplicationStartedOrder, getLastModified, registerContribution, setLastModified, unregisterContribution
public static final ComponentName NAME
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
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
public void followTransition(Document doc, String transitionName) throws LifeCycleException
LifeCycleService
followTransition
in interface LifeCycleService
doc
- the Document instancetransitionName
- the transition nameLifeCycleException
public void reinitLifeCycle(Document doc) throws LifeCycleException
LifeCycleService
reinitLifeCycle
in interface LifeCycleService
LifeCycleException
public void registerExtension(Extension extension) throws Exception
registerExtension
in interface Extensible
registerExtension
in class DefaultComponent
extension
- the extension to registerException
- if any error occurspublic void unregisterExtension(Extension extension) throws Exception
unregisterExtension
in interface Extensible
unregisterExtension
in class DefaultComponent
extension
- the extension to unregisterException
- if any error occurspublic 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 © 2013 Nuxeo SA. All Rights Reserved.