001/*
002 * (C) Copyright 2006 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 *     Bogdan Stefanescu
018 */
019package org.nuxeo.ecm.webengine.samples;
020
021import javax.ws.rs.GET;
022import javax.ws.rs.Produces;
023
024import org.nuxeo.ecm.webengine.model.WebAdapter;
025import org.nuxeo.ecm.webengine.model.impl.DefaultAdapter;
026
027/**
028 * UserBuddies object. You can see the @WebAdapter annotation that is defining a WebAdapter of type "UserBuddies" that
029 * applies to any User WebObject. The name used to access this adapter is the adapter name prefixed with a '@'
030 * character: {@code @buddies}
031 *
032 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
033 */
034@WebAdapter(name = "buddies", type = "UserBuddies", targetType = "User")
035@Produces("text/html;charset=UTF-8")
036public class UserBuddiesObject extends DefaultAdapter {
037
038    /**
039     * Get the index view. The view file name is computed as follows: index[-media_type_id].ftl First the
040     * skin/views/UserBuddies is searched for that file then the current directory. (The type of a module is the same as
041     * its name)
042     */
043    @GET
044    public Object doGet() {
045        return getView("index");
046    }
047
048}