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: LifeCycleStateImpl.java 19002 2007-05-20 15:37:19Z sfermigier $
012 */
013
014package org.nuxeo.ecm.core.lifecycle.impl;
015
016import java.util.Collection;
017import java.util.Collections;
018
019import org.nuxeo.ecm.core.lifecycle.LifeCycleState;
020
021/**
022 * Life cycle state implementation.
023 *
024 * @see org.nuxeo.ecm.core.lifecycle.LifeCycleState
025 * @author <a href="mailto:ja@nuxeo.com">Julien Anguenot</a>
026 */
027public class LifeCycleStateImpl implements LifeCycleState {
028
029    /** Name of the life cycle state. */
030    private final String name;
031
032    /** State description. */
033    private final String description;
034
035    /** Collection of allowed state transitions. */
036    private final Collection<String> allowedStateTransitions;
037
038    private final boolean initial;
039
040    public LifeCycleStateImpl(String name, String description, Collection<String> allowedStateTransitions,
041            boolean initial) {
042        this.name = name;
043        this.description = description;
044        this.allowedStateTransitions = Collections.unmodifiableCollection(allowedStateTransitions);
045        this.initial = initial;
046    }
047
048    @Override
049    public Collection<String> getAllowedStateTransitions() {
050        return allowedStateTransitions;
051    }
052
053    @Override
054    public String getDescription() {
055        return description;
056    }
057
058    @Override
059    public String getName() {
060        return name;
061    }
062
063    @Override
064    public boolean isInitial() {
065        return initial;
066    }
067
068}