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 */
019
020package org.nuxeo.ecm.core.management.statuses;
021
022import java.io.Serializable;
023
024import org.nuxeo.common.xmap.annotation.XNode;
025import org.nuxeo.common.xmap.annotation.XObject;
026import org.nuxeo.ecm.core.management.api.AdministrativeStatus;
027
028@XObject("administrableService")
029public class AdministrableServiceDescriptor implements Serializable {
030
031    private static final long serialVersionUID = 1L;
032
033    @XNode("@id")
034    private String id;
035
036    @XNode("@name")
037    private String name;
038
039    @XNode("description")
040    private String description;
041
042    @XNode("label")
043    private String label;
044
045    @XNode("initialState")
046    private String initialState = AdministrativeStatus.ACTIVE;
047
048    public String getInitialState() {
049        return initialState;
050    }
051
052    public String getLabel() {
053        if (label == null) {
054            return "label." + getName();
055        }
056        return label;
057    }
058
059    public String getId() {
060        return id;
061    }
062
063    public String getDescription() {
064        if (description == null) {
065            return getName() + ".description";
066        }
067        return description;
068    }
069
070    public String getName() {
071        if (name == null) {
072            return id;
073        }
074        return name;
075    }
076}