001/*
002 * (C) Copyright 2006-2010 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 *     Thierry Delprat
018 */
019package org.nuxeo.apidoc.introspection;
020
021import org.nuxeo.apidoc.api.BaseNuxeoArtifact;
022import org.nuxeo.apidoc.api.ComponentInfo;
023import org.nuxeo.apidoc.api.ServiceInfo;
024import org.nuxeo.apidoc.api.VirtualNodesConsts;
025
026import com.fasterxml.jackson.annotation.JsonIgnoreType;
027
028@JsonIgnoreType
029public class ServiceInfoImpl extends BaseNuxeoArtifact implements ServiceInfo {
030
031    protected final String serviceClassName;
032
033    protected final ComponentInfo component;
034
035    protected final boolean overriden;
036
037    public ServiceInfoImpl(String serviceClassName, boolean overriden, ComponentInfo component) {
038        this.serviceClassName = serviceClassName;
039        this.overriden = overriden;
040        this.component = component;
041    }
042
043    @Override
044    public String getId() {
045        return serviceClassName;
046    }
047
048    @Override
049    public String getArtifactType() {
050        return TYPE_NAME;
051    }
052
053    @Override
054    public String getVersion() {
055        return component.getVersion();
056    }
057
058    @Override
059    public String getComponentId() {
060        return component.getId();
061    }
062
063    @Override
064    public String getHierarchyPath() {
065        return component.getHierarchyPath() + "/" + VirtualNodesConsts.Services_VNODE_NAME + "/" + getId();
066    }
067
068    @Override
069    public boolean isOverriden() {
070        return overriden;
071    }
072}