Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.core.lifecycle.impl
Class LifeCycleServiceImpl

java.lang.Object
  extended by org.nuxeo.runtime.model.DefaultComponent
      extended by org.nuxeo.ecm.core.lifecycle.impl.LifeCycleServiceImpl
All Implemented Interfaces:
LifeCycleService, Adaptable, Component, Extensible

public class LifeCycleServiceImpl
extends DefaultComponent
implements LifeCycleService

Life cycle service implementation.

Author:
Julien Anguenot, Florent Guillaume
See Also:
LifeCycleService

Field Summary
static ComponentName NAME
           
 
Constructor Summary
LifeCycleServiceImpl()
           
 
Method Summary
 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, applicationStarted, deactivate, getAdapter, registerContribution, unregisterContribution
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final ComponentName NAME
Constructor Detail

LifeCycleServiceImpl

public LifeCycleServiceImpl()
Method Detail

getLifeCycleByName

public LifeCycle getLifeCycleByName(String name)
Description copied from interface: LifeCycleService
Returns a life cycle given its name.

Specified by:
getLifeCycleByName in interface LifeCycleService
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 interface LifeCycleService
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 interface LifeCycleService
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 interface LifeCycleService
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 interface LifeCycleService
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 interface LifeCycleService
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 interface LifeCycleService
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 interface LifeCycleService
Parameters:
doc - the document instance
initialStateName - 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 interface LifeCycleService
Parameters:
doc - the Document instance
transitionName - 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 interface LifeCycleService
Throws:
LifeCycleException

registerExtension

public void registerExtension(Extension extension)
                       throws Exception
Register extensions.

Specified by:
registerExtension in interface Extensible
Overrides:
registerExtension in class DefaultComponent
Parameters:
extension - the extension to register
Throws:
Exception - if any error occurs

unregisterExtension

public void unregisterExtension(Extension extension)
                         throws Exception
Unregisters an extension.

Specified by:
unregisterExtension in interface Extensible
Overrides:
unregisterExtension in class DefaultComponent
Parameters:
extension - the extension to unregister
Throws:
Exception - if any error occurs

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. The 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.

Specified by:
getNonRecursiveTransitionForDocType in interface LifeCycleService
Parameters:
docTypeName - The doc type
Returns:
a list of transition name
See Also:
BulkLifeCycleChangeListener

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.