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.calendar.asset;
16  
17  import com.liferay.portal.util.WebKeys;
18  import com.liferay.portlet.asset.model.BaseAssetRenderer;
19  import com.liferay.portlet.calendar.model.CalEvent;
20  
21  import javax.portlet.RenderRequest;
22  import javax.portlet.RenderResponse;
23  
24  /**
25   * <a href="CalEventAssetRenderer.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Juan Fernández
28   */
29  public class CalEventAssetRenderer extends BaseAssetRenderer {
30  
31      public CalEventAssetRenderer(CalEvent event){
32          _event = event;
33      }
34  
35      public long getClassPK() {
36          return _event.getEventId();
37      }
38  
39      public long getGroupId() {
40          return _event.getGroupId();
41      }
42  
43      public String getSummary() {
44          return _event.getTitle();
45      }
46  
47      public String getTitle() {
48          return _event.getTitle();
49      }
50  
51      public long getUserId() {
52          return _event.getUserId();
53      }
54  
55      public String render(
56              RenderRequest renderRequest, RenderResponse renderResponse,
57              String template)
58          throws Exception {
59  
60          if (template.equals(TEMPLATE_FULL_CONTENT)) {
61              renderRequest.setAttribute(WebKeys.CALENDAR_EVENT, _event);
62  
63              return "/html/portlet/calendar/asset/" + template + ".jsp";
64          }
65          else {
66              return null;
67          }
68      }
69  
70      private CalEvent _event;
71  
72  }