# com.bea.content.virtual.lifecycle
LifeCycle Class

public class LifeCycle
extends `Object`
implements `Serializable`

Represents the Life Cycle for a Node and defines the valid status transitions. Below are valid transitions available with the current status:
From New (no status yet) to DRAFT to READY to PUBLISHED if user is in a publisher role to RETIRED if user is in a publisher role From DRAFT to READY to PUBLISHED if user is in a publisher role to RETIRED if user is in a publisher role From READY to REJECTED if user is in a publisher role to PUBLISHED if user is in a publisher role to RETIRED if user is in a publisher role From REJECTED to DRAFT to READY From PUBLISHED - there are no valid transitions from PUBLISHED. When a PUBLISHED Node is checked out it automatically goes to DRAFT so it can never transition from a PUBLISHED status. From RETIRED to DRAFT to READY to PUBLISHED if user is in a publisher role Upon status transition the following occurs: --> Status transition to READY : Assigned to user will be null. Assigned To Roles will be set to the roles that can publish this node --> Status transition to PUBLISHED : Assigned to user will be null. Assigned To Roles will be null --> Status transition to REJECTED : Assigned to roles will be null. Assigned to user will be the last user (who is not in the publishers role for that node) that was editing the node. This is an invalid status for a new content item/node. --> Status transition to RETIRED : Assigned to user will be set to null. --> Status transition to DRAFT : Assigned to user will remain as it is.

Hierarchy
  `Object`
  `LifeCycle`

All Implemented Interfaces
  `Serializable`

## Field Summary

`public static final int` | `DRAFT` int
`public static final `String`` | `LIFECYCLE_STATUS_FIELD` String
`public static final int` | `PUBLISHED` int
`public static final int` | `READY` int
`public static final int` | `REJECTED` int
`protected `RepositoryManager`` | `repositoryManager` RepositoryManager
`public static final int` | `RETIRED` int

## Constructor Summary

LifeCycle(`RepositoryManager` repositoryManager)

## Method Summary

`public `String`` | `buildTaxonomy`(`ID` nodeId) Build a taxonomy for the node id
`public `String`` | `debugGetStatusText`(int status) Debug method to return a string equivalent of the status
`public `String`` | `getId`(`ID` id)
`public `Set`` | `getPublishRolesForNode`(`ID` nodeId) Return all the published roles for the node represented by the node id.
`public `List`` | `getStatusTransitions`(`ContentContext` context, `ID` nodeId, int currentStatus) Returns a list of valid status transitions for the user.
`public boolean` | `isUserInRole`(`ContentContext` context, `Set` set) Checks to see if the current user is in any one of the passed in roles for that particular node

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Detail

### DRAFT

    public static final int DRAFT

### LIFECYCLE_STATUS_FIELD

    public static final String LIFECYCLE_STATUS_FIELD

### PUBLISHED

    public static final int PUBLISHED

### READY

    public static final int READY

### REJECTED

    public static final int REJECTED

### repositoryManager

    protected RepositoryManager repositoryManager

### RETIRED

    public static final int RETIRED

## Constructor Detail

### LifeCycle

    public LifeCycle(RepositoryManager repositoryManager)

## Method Detail

### buildTaxonomy(ID) Method

    public String buildTaxonomy(ID nodeId)
         throws AuthenticationException, AuthorizationException, NoSuchNodeException, RepositoryException

Build a taxonomy for the node id

#### Exceptions

``AuthenticationException``
``AuthorizationException``
``NoSuchNodeException``
``RepositoryException``

### debugGetStatusText(int) Method

    public String debugGetStatusText(int status)

Debug method to return a string equivalent of the status

#### Parameters

status
  The status integer

#### Returns

A string indicating the type of status

### getId(ID) Method

    public String getId(ID id)

### getPublishRolesForNode(ID) Method

    public Set getPublishRolesForNode(ID nodeId)
         throws AuthenticationException, AuthorizationException, NoSuchNodeException, RepositoryException

Return all the published roles for the node represented by the node id. This will not only find the published role on that node id, but will also try to find published roles which are inherited by the node id. Finally, it will append the "Admin" role to the publish roles list.

#### Returns

A Set of string roles for the given node id.

#### Exceptions

``AuthenticationException``
``AuthorizationException``
``NoSuchNodeException``
``RepositoryException``

### getStatusTransitions(ContentContext, ID, int) Method

    public List getStatusTransitions(ContentContext context,
                                     ID nodeId,
                                     int currentStatus)

Returns a list of valid status transitions for the user. The list contains Integer values of Status Transitions.

### isUserInRole(ContentContext, Set) Method

    public boolean isUserInRole(ContentContext context,
                                Set set)

Checks to see if the current user is in any one of the passed in roles for that particular node

#### Parameters

context
  The object which represents the user profile.

set
  A set of passed in string roles.

#### Returns

true or false indicating whether the user is in that role or not