1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.wiki.asset;
16  
17  import com.liferay.portal.kernel.exception.PortalException;
18  import com.liferay.portal.kernel.exception.SystemException;
19  import com.liferay.portal.kernel.portlet.LiferayPortletRequest;
20  import com.liferay.portal.kernel.portlet.LiferayPortletResponse;
21  import com.liferay.portal.theme.ThemeDisplay;
22  import com.liferay.portlet.asset.model.AssetRenderer;
23  import com.liferay.portlet.asset.model.BaseAssetRendererFactory;
24  import com.liferay.portlet.wiki.model.WikiPage;
25  import com.liferay.portlet.wiki.service.WikiPageLocalServiceUtil;
26  
27  import javax.portlet.PortletURL;
28  
29  /**
30   * <a href="WikiPageAssetRendererFactory.java.html"><b><i>View Source</i></b>
31   * </a>
32   *
33   * @author Julio Camarero
34   * @author Juan Fernández
35   */
36  public class WikiPageAssetRendererFactory extends BaseAssetRendererFactory {
37  
38      public static final String CLASS_NAME = WikiPage.class.getName();
39  
40      public static final String TYPE = "wiki";
41  
42      public AssetRenderer getAssetRenderer(long classPK)
43          throws PortalException, SystemException {
44  
45          WikiPage page = WikiPageLocalServiceUtil.getPage(classPK);
46  
47          return new WikiPageAssetRenderer(page);
48      }
49  
50      public String getClassName() {
51          return CLASS_NAME;
52      }
53  
54      public String getType() {
55          return TYPE;
56      }
57  
58      public PortletURL getURLAdd(
59          LiferayPortletRequest liferayPortletRequest,
60          LiferayPortletResponse liferayPortletResponse) {
61  
62          return null;
63      }
64  
65      protected String getIconPath(ThemeDisplay themeDisplay) {
66          return themeDisplay.getPathThemeImages() + "/common/pages.png";
67      }
68  
69  }