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.portal.model.impl;
16  
17  import com.liferay.portal.kernel.exception.SystemException;
18  import com.liferay.portal.kernel.log.Log;
19  import com.liferay.portal.kernel.log.LogFactoryUtil;
20  import com.liferay.portal.model.ColorScheme;
21  import com.liferay.portal.model.Group;
22  import com.liferay.portal.model.LayoutSet;
23  import com.liferay.portal.model.Theme;
24  import com.liferay.portal.service.GroupLocalServiceUtil;
25  import com.liferay.portal.service.ThemeLocalServiceUtil;
26  
27  /**
28   * <a href="LayoutSetImpl.java.html"><b><i>View Source</i></b></a>
29   *
30   * @author Brian Wing Shun Chan
31   * @author Jorge Ferrer
32   */
33  public class LayoutSetImpl extends LayoutSetModelImpl implements LayoutSet {
34  
35      public LayoutSetImpl() {
36      }
37  
38      public Theme getTheme() throws SystemException {
39          return ThemeLocalServiceUtil.getTheme(
40              getCompanyId(), getThemeId(), false);
41      }
42  
43      public ColorScheme getColorScheme() throws SystemException {
44          return ThemeLocalServiceUtil.getColorScheme(
45              getCompanyId(), getTheme().getThemeId(), getColorSchemeId(), false);
46      }
47  
48      public Group getGroup() {
49          Group group = null;
50  
51          try {
52              group = GroupLocalServiceUtil.getGroup(getGroupId());
53          }
54          catch (Exception e) {
55              group = new GroupImpl();
56  
57              _log.error(e, e);
58          }
59  
60          return group;
61      }
62  
63      public Theme getWapTheme() throws SystemException {
64          return ThemeLocalServiceUtil.getTheme(
65              getCompanyId(), getWapThemeId(), true);
66      }
67  
68      public ColorScheme getWapColorScheme() throws SystemException {
69          return ThemeLocalServiceUtil.getColorScheme(
70              getCompanyId(), getWapTheme().getThemeId(), getWapColorSchemeId(),
71              true);
72      }
73  
74      private static Log _log = LogFactoryUtil.getLog(LayoutSetImpl.class);
75  
76  }