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