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.browse; 018 019import javax.ws.rs.GET; 020import javax.ws.rs.Path; 021import javax.ws.rs.Produces; 022 023import org.nuxeo.apidoc.api.AssociatedDocuments; 024import org.nuxeo.apidoc.api.ExtensionPointInfo; 025import org.nuxeo.apidoc.api.NuxeoArtifact; 026import org.nuxeo.ecm.webengine.model.WebObject; 027 028@WebObject(type = "extensionPoint") 029public class ExtensionPointWO extends NuxeoArtifactWebObject { 030 031 @Override 032 @GET 033 @Produces("text/html") 034 @Path("introspection") 035 public Object doGet() { 036 ExtensionPointInfo epi = getTargetExtensionPointInfo(); 037 return getView("view").arg("extensionPoint", epi); 038 } 039 040 public ExtensionPointInfo getTargetExtensionPointInfo() { 041 return getSnapshotManager().getSnapshot(getDistributionId(), ctx.getCoreSession()).getExtensionPoint( 042 nxArtifactId); 043 } 044 045 @Override 046 public NuxeoArtifact getNxArtifact() { 047 return getTargetExtensionPointInfo(); 048 } 049 050 @GET 051 @Produces("text/html") 052 @Path("simple") 053 public Object simpleView() { 054 NuxeoArtifact nxItem = getNxArtifact(); 055 getTargetExtensionPointInfo().getExtensions(); 056 AssociatedDocuments docs = nxItem.getAssociatedDocuments(ctx.getCoreSession()); 057 return getView("simple").arg("nxItem", nxItem).arg("docs", docs); 058 } 059 060}