001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     Nuxeo - initial API and implementation
011 * $Id: LifeCycle.java 21744 2007-07-02 12:51:51Z sfermigier $
012 */
013
014package org.nuxeo.ecm.core.lifecycle;
015
016import java.util.Collection;
017
018/**
019 * Document life cycle.
020 *
021 * @see org.nuxeo.ecm.core.lifecycle.impl.LifeCycleImpl
022 * @author <a href="mailto:ja@nuxeo.com">Julien Anguenot</a>
023 */
024public interface LifeCycle {
025
026    /**
027     * Gets the allowed state transitions from a given state.
028     *
029     * @param stateName the current state name
030     * @return collection of allowed state transition names.
031     */
032    Collection<String> getAllowedStateTransitionsFrom(String stateName);
033
034    /**
035     * Returns the default initial state name.
036     */
037    String getDefaultInitialStateName();
038
039    /**
040     * Returns the list of allowed initial state names.
041     */
042    Collection<String> getInitialStateNames();
043
044    /**
045     * Gets the life cycle name.
046     *
047     * @return the life cycle name
048     */
049    String getName();
050
051    /**
052     * Returns a life cycle state instance given its name.
053     *
054     * @param stateName the state name
055     * @return the life cycle state instance
056     */
057    LifeCycleState getStateByName(String stateName);
058
059    /**
060     * Returns the list of life cycle state instances.
061     *
062     * @return the list of life cycle state instances
063     */
064    Collection<LifeCycleState> getStates();
065
066    /**
067     * Returns a life cycle transition instance given its name.
068     *
069     * @param transitionName the transition name
070     * @return the life cycle transition instance
071     */
072    LifeCycleTransition getTransitionByName(String transitionName);
073
074    /**
075     * Returns a list of life cycle transition instances.
076     *
077     * @return a list of life cycle transition instances.
078     */
079    Collection<LifeCycleTransition> getTransitions();
080
081}