001/*
002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nuxeo - initial API and implementation
018 * $Id: LifeCycle.java 21744 2007-07-02 12:51:51Z sfermigier $
019 */
020
021package org.nuxeo.ecm.core.lifecycle;
022
023import java.util.Collection;
024
025/**
026 * Document life cycle.
027 *
028 * @see org.nuxeo.ecm.core.lifecycle.impl.LifeCycleImpl
029 * @author <a href="mailto:ja@nuxeo.com">Julien Anguenot</a>
030 */
031public interface LifeCycle {
032
033    /**
034     * Gets the allowed state transitions from a given state.
035     *
036     * @param stateName the current state name
037     * @return collection of allowed state transition names.
038     */
039    Collection<String> getAllowedStateTransitionsFrom(String stateName);
040
041    /**
042     * Returns the default initial state name.
043     */
044    String getDefaultInitialStateName();
045
046    /**
047     * Returns the list of allowed initial state names.
048     */
049    Collection<String> getInitialStateNames();
050
051    /**
052     * Gets the life cycle name.
053     *
054     * @return the life cycle name
055     */
056    String getName();
057
058    /**
059     * Returns a life cycle state instance given its name.
060     *
061     * @param stateName the state name
062     * @return the life cycle state instance
063     */
064    LifeCycleState getStateByName(String stateName);
065
066    /**
067     * Returns the list of life cycle state instances.
068     *
069     * @return the list of life cycle state instances
070     */
071    Collection<LifeCycleState> getStates();
072
073    /**
074     * Returns a life cycle transition instance given its name.
075     *
076     * @param transitionName the transition name
077     * @return the life cycle transition instance
078     */
079    LifeCycleTransition getTransitionByName(String transitionName);
080
081    /**
082     * Returns a list of life cycle transition instances.
083     *
084     * @return a list of life cycle transition instances.
085     */
086    Collection<LifeCycleTransition> getTransitions();
087
088}