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