1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.service.persistence;
24  
25  /**
26   * <a href="PortletUtil.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   *
30   */
31  public class PortletUtil {
32      public static void cacheResult(com.liferay.portal.model.Portlet portlet) {
33          getPersistence().cacheResult(portlet);
34      }
35  
36      public static void cacheResult(
37          java.util.List<com.liferay.portal.model.Portlet> portlets) {
38          getPersistence().cacheResult(portlets);
39      }
40  
41      public static void clearCache() {
42          getPersistence().clearCache();
43      }
44  
45      public static com.liferay.portal.model.Portlet create(long id) {
46          return getPersistence().create(id);
47      }
48  
49      public static com.liferay.portal.model.Portlet remove(long id)
50          throws com.liferay.portal.NoSuchPortletException,
51              com.liferay.portal.SystemException {
52          return getPersistence().remove(id);
53      }
54  
55      public static com.liferay.portal.model.Portlet remove(
56          com.liferay.portal.model.Portlet portlet)
57          throws com.liferay.portal.SystemException {
58          return getPersistence().remove(portlet);
59      }
60  
61      /**
62       * @deprecated Use <code>update(Portlet portlet, boolean merge)</code>.
63       */
64      public static com.liferay.portal.model.Portlet update(
65          com.liferay.portal.model.Portlet portlet)
66          throws com.liferay.portal.SystemException {
67          return getPersistence().update(portlet);
68      }
69  
70      /**
71       * Add, update, or merge, the entity. This method also calls the model
72       * listeners to trigger the proper events associated with adding, deleting,
73       * or updating an entity.
74       *
75       * @param        portlet the entity to add, update, or merge
76       * @param        merge boolean value for whether to merge the entity. The
77       *                default value is false. Setting merge to true is more
78       *                expensive and should only be true when portlet is
79       *                transient. See LEP-5473 for a detailed discussion of this
80       *                method.
81       * @return        true if the portlet can be displayed via Ajax
82       */
83      public static com.liferay.portal.model.Portlet update(
84          com.liferay.portal.model.Portlet portlet, boolean merge)
85          throws com.liferay.portal.SystemException {
86          return getPersistence().update(portlet, merge);
87      }
88  
89      public static com.liferay.portal.model.Portlet updateImpl(
90          com.liferay.portal.model.Portlet portlet, boolean merge)
91          throws com.liferay.portal.SystemException {
92          return getPersistence().updateImpl(portlet, merge);
93      }
94  
95      public static com.liferay.portal.model.Portlet findByPrimaryKey(long id)
96          throws com.liferay.portal.NoSuchPortletException,
97              com.liferay.portal.SystemException {
98          return getPersistence().findByPrimaryKey(id);
99      }
100 
101     public static com.liferay.portal.model.Portlet fetchByPrimaryKey(long id)
102         throws com.liferay.portal.SystemException {
103         return getPersistence().fetchByPrimaryKey(id);
104     }
105 
106     public static java.util.List<com.liferay.portal.model.Portlet> findByCompanyId(
107         long companyId) throws com.liferay.portal.SystemException {
108         return getPersistence().findByCompanyId(companyId);
109     }
110 
111     public static java.util.List<com.liferay.portal.model.Portlet> findByCompanyId(
112         long companyId, int start, int end)
113         throws com.liferay.portal.SystemException {
114         return getPersistence().findByCompanyId(companyId, start, end);
115     }
116 
117     public static java.util.List<com.liferay.portal.model.Portlet> findByCompanyId(
118         long companyId, int start, int end,
119         com.liferay.portal.kernel.util.OrderByComparator obc)
120         throws com.liferay.portal.SystemException {
121         return getPersistence().findByCompanyId(companyId, start, end, obc);
122     }
123 
124     public static com.liferay.portal.model.Portlet findByCompanyId_First(
125         long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
126         throws com.liferay.portal.NoSuchPortletException,
127             com.liferay.portal.SystemException {
128         return getPersistence().findByCompanyId_First(companyId, obc);
129     }
130 
131     public static com.liferay.portal.model.Portlet findByCompanyId_Last(
132         long companyId, com.liferay.portal.kernel.util.OrderByComparator obc)
133         throws com.liferay.portal.NoSuchPortletException,
134             com.liferay.portal.SystemException {
135         return getPersistence().findByCompanyId_Last(companyId, obc);
136     }
137 
138     public static com.liferay.portal.model.Portlet[] findByCompanyId_PrevAndNext(
139         long id, long companyId,
140         com.liferay.portal.kernel.util.OrderByComparator obc)
141         throws com.liferay.portal.NoSuchPortletException,
142             com.liferay.portal.SystemException {
143         return getPersistence().findByCompanyId_PrevAndNext(id, companyId, obc);
144     }
145 
146     public static com.liferay.portal.model.Portlet findByC_P(long companyId,
147         java.lang.String portletId)
148         throws com.liferay.portal.NoSuchPortletException,
149             com.liferay.portal.SystemException {
150         return getPersistence().findByC_P(companyId, portletId);
151     }
152 
153     public static com.liferay.portal.model.Portlet fetchByC_P(long companyId,
154         java.lang.String portletId) throws com.liferay.portal.SystemException {
155         return getPersistence().fetchByC_P(companyId, portletId);
156     }
157 
158     public static com.liferay.portal.model.Portlet fetchByC_P(long companyId,
159         java.lang.String portletId, boolean retrieveFromCache)
160         throws com.liferay.portal.SystemException {
161         return getPersistence()
162                    .fetchByC_P(companyId, portletId, retrieveFromCache);
163     }
164 
165     public static java.util.List<Object> findWithDynamicQuery(
166         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
167         throws com.liferay.portal.SystemException {
168         return getPersistence().findWithDynamicQuery(dynamicQuery);
169     }
170 
171     public static java.util.List<Object> findWithDynamicQuery(
172         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
173         int end) throws com.liferay.portal.SystemException {
174         return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
175     }
176 
177     public static java.util.List<com.liferay.portal.model.Portlet> findAll()
178         throws com.liferay.portal.SystemException {
179         return getPersistence().findAll();
180     }
181 
182     public static java.util.List<com.liferay.portal.model.Portlet> findAll(
183         int start, int end) throws com.liferay.portal.SystemException {
184         return getPersistence().findAll(start, end);
185     }
186 
187     public static java.util.List<com.liferay.portal.model.Portlet> findAll(
188         int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
189         throws com.liferay.portal.SystemException {
190         return getPersistence().findAll(start, end, obc);
191     }
192 
193     public static void removeByCompanyId(long companyId)
194         throws com.liferay.portal.SystemException {
195         getPersistence().removeByCompanyId(companyId);
196     }
197 
198     public static void removeByC_P(long companyId, java.lang.String portletId)
199         throws com.liferay.portal.NoSuchPortletException,
200             com.liferay.portal.SystemException {
201         getPersistence().removeByC_P(companyId, portletId);
202     }
203 
204     public static void removeAll() throws com.liferay.portal.SystemException {
205         getPersistence().removeAll();
206     }
207 
208     public static int countByCompanyId(long companyId)
209         throws com.liferay.portal.SystemException {
210         return getPersistence().countByCompanyId(companyId);
211     }
212 
213     public static int countByC_P(long companyId, java.lang.String portletId)
214         throws com.liferay.portal.SystemException {
215         return getPersistence().countByC_P(companyId, portletId);
216     }
217 
218     public static int countAll() throws com.liferay.portal.SystemException {
219         return getPersistence().countAll();
220     }
221 
222     public static PortletPersistence getPersistence() {
223         return _persistence;
224     }
225 
226     public void setPersistence(PortletPersistence persistence) {
227         _persistence = persistence;
228     }
229 
230     private static PortletPersistence _persistence;
231 }