001/*
002 * (C) Copyright 2006-2010 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Thierry Delprat
016 */
017package org.nuxeo.apidoc.introspection;
018
019import java.util.ArrayList;
020import java.util.List;
021
022import org.nuxeo.apidoc.api.BaseNuxeoArtifact;
023import org.nuxeo.apidoc.api.SeamComponentInfo;
024
025public class SeamComponentInfoImpl extends BaseNuxeoArtifact implements SeamComponentInfo {
026
027    protected String name;
028
029    protected String scope;
030
031    protected String precedence;
032
033    protected String className;
034
035    protected final List<String> interfaceNames = new ArrayList<String>();
036
037    protected String version;
038
039    @Override
040    public String getName() {
041        return name;
042    }
043
044    @Override
045    public String getScope() {
046        return scope;
047    }
048
049    @Override
050    public String getPrecedence() {
051        return precedence;
052    }
053
054    @Override
055    public String getClassName() {
056        return className;
057    }
058
059    public void addInterfaceName(String name) {
060        if (!interfaceNames.contains(name)) {
061            interfaceNames.add(name);
062        }
063    }
064
065    @Override
066    public List<String> getInterfaceNames() {
067        return interfaceNames;
068    }
069
070    @Override
071    public String getArtifactType() {
072        return SeamComponentInfo.TYPE_NAME;
073    }
074
075    @Override
076    public String getId() {
077        return "seam:" + getName();
078    }
079
080    @Override
081    public String getHierarchyPath() {
082        return "/";
083    }
084
085    @Override
086    public String getVersion() {
087        return version;
088    }
089
090    public void setVersion(String version) {
091        this.version = version;
092    }
093
094    @Override
095    public int compareTo(SeamComponentInfo o) {
096        int c = getName().compareToIgnoreCase(o.getName());
097        if (c != 0) {
098            return c;
099        }
100        return getClassName().compareTo(o.getClassName());
101    }
102
103    public void setName(String name) {
104        this.name = name;
105    }
106
107    public void setScope(String scope) {
108        this.scope = scope;
109    }
110
111    public void setPrecedence(String precedence) {
112        this.precedence = precedence;
113    }
114
115    public void setClassName(String className) {
116        this.className = className;
117    }
118
119}