1   /**
2    * Copyright (c) 2000-2008 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="ResourceUtil.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   *
30   */
31  public class ResourceUtil {
32      public static com.liferay.portal.model.Resource create(long resourceId) {
33          return getPersistence().create(resourceId);
34      }
35  
36      public static com.liferay.portal.model.Resource remove(long resourceId)
37          throws com.liferay.portal.SystemException, 
38              com.liferay.portal.NoSuchResourceException {
39          return getPersistence().remove(resourceId);
40      }
41  
42      public static com.liferay.portal.model.Resource remove(
43          com.liferay.portal.model.Resource resource)
44          throws com.liferay.portal.SystemException {
45          return getPersistence().remove(resource);
46      }
47  
48      public static com.liferay.portal.model.Resource update(
49          com.liferay.portal.model.Resource resource)
50          throws com.liferay.portal.SystemException {
51          return getPersistence().update(resource);
52      }
53  
54      public static com.liferay.portal.model.Resource update(
55          com.liferay.portal.model.Resource resource, boolean merge)
56          throws com.liferay.portal.SystemException {
57          return getPersistence().update(resource, merge);
58      }
59  
60      public static com.liferay.portal.model.Resource updateImpl(
61          com.liferay.portal.model.Resource resource, boolean merge)
62          throws com.liferay.portal.SystemException {
63          return getPersistence().updateImpl(resource, merge);
64      }
65  
66      public static com.liferay.portal.model.Resource findByPrimaryKey(
67          long resourceId)
68          throws com.liferay.portal.SystemException, 
69              com.liferay.portal.NoSuchResourceException {
70          return getPersistence().findByPrimaryKey(resourceId);
71      }
72  
73      public static com.liferay.portal.model.Resource fetchByPrimaryKey(
74          long resourceId) throws com.liferay.portal.SystemException {
75          return getPersistence().fetchByPrimaryKey(resourceId);
76      }
77  
78      public static java.util.List findByCodeId(long codeId)
79          throws com.liferay.portal.SystemException {
80          return getPersistence().findByCodeId(codeId);
81      }
82  
83      public static java.util.List findByCodeId(long codeId, int begin, int end)
84          throws com.liferay.portal.SystemException {
85          return getPersistence().findByCodeId(codeId, begin, end);
86      }
87  
88      public static java.util.List findByCodeId(long codeId, int begin, int end,
89          com.liferay.portal.kernel.util.OrderByComparator obc)
90          throws com.liferay.portal.SystemException {
91          return getPersistence().findByCodeId(codeId, begin, end, obc);
92      }
93  
94      public static com.liferay.portal.model.Resource findByCodeId_First(
95          long codeId, com.liferay.portal.kernel.util.OrderByComparator obc)
96          throws com.liferay.portal.SystemException, 
97              com.liferay.portal.NoSuchResourceException {
98          return getPersistence().findByCodeId_First(codeId, obc);
99      }
100 
101     public static com.liferay.portal.model.Resource findByCodeId_Last(
102         long codeId, com.liferay.portal.kernel.util.OrderByComparator obc)
103         throws com.liferay.portal.SystemException, 
104             com.liferay.portal.NoSuchResourceException {
105         return getPersistence().findByCodeId_Last(codeId, obc);
106     }
107 
108     public static com.liferay.portal.model.Resource[] findByCodeId_PrevAndNext(
109         long resourceId, long codeId,
110         com.liferay.portal.kernel.util.OrderByComparator obc)
111         throws com.liferay.portal.SystemException, 
112             com.liferay.portal.NoSuchResourceException {
113         return getPersistence().findByCodeId_PrevAndNext(resourceId, codeId, obc);
114     }
115 
116     public static com.liferay.portal.model.Resource findByC_P(long codeId,
117         java.lang.String primKey)
118         throws com.liferay.portal.SystemException, 
119             com.liferay.portal.NoSuchResourceException {
120         return getPersistence().findByC_P(codeId, primKey);
121     }
122 
123     public static com.liferay.portal.model.Resource fetchByC_P(long codeId,
124         java.lang.String primKey) throws com.liferay.portal.SystemException {
125         return getPersistence().fetchByC_P(codeId, primKey);
126     }
127 
128     public static java.util.List findWithDynamicQuery(
129         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer)
130         throws com.liferay.portal.SystemException {
131         return getPersistence().findWithDynamicQuery(queryInitializer);
132     }
133 
134     public static java.util.List findWithDynamicQuery(
135         com.liferay.portal.kernel.dao.DynamicQueryInitializer queryInitializer,
136         int begin, int end) throws com.liferay.portal.SystemException {
137         return getPersistence().findWithDynamicQuery(queryInitializer, begin,
138             end);
139     }
140 
141     public static java.util.List findAll()
142         throws com.liferay.portal.SystemException {
143         return getPersistence().findAll();
144     }
145 
146     public static java.util.List findAll(int begin, int end)
147         throws com.liferay.portal.SystemException {
148         return getPersistence().findAll(begin, end);
149     }
150 
151     public static java.util.List findAll(int begin, int end,
152         com.liferay.portal.kernel.util.OrderByComparator obc)
153         throws com.liferay.portal.SystemException {
154         return getPersistence().findAll(begin, end, obc);
155     }
156 
157     public static void removeByCodeId(long codeId)
158         throws com.liferay.portal.SystemException {
159         getPersistence().removeByCodeId(codeId);
160     }
161 
162     public static void removeByC_P(long codeId, java.lang.String primKey)
163         throws com.liferay.portal.SystemException, 
164             com.liferay.portal.NoSuchResourceException {
165         getPersistence().removeByC_P(codeId, primKey);
166     }
167 
168     public static void removeAll() throws com.liferay.portal.SystemException {
169         getPersistence().removeAll();
170     }
171 
172     public static int countByCodeId(long codeId)
173         throws com.liferay.portal.SystemException {
174         return getPersistence().countByCodeId(codeId);
175     }
176 
177     public static int countByC_P(long codeId, java.lang.String primKey)
178         throws com.liferay.portal.SystemException {
179         return getPersistence().countByC_P(codeId, primKey);
180     }
181 
182     public static int countAll() throws com.liferay.portal.SystemException {
183         return getPersistence().countAll();
184     }
185 
186     public static ResourcePersistence getPersistence() {
187         return _getUtil()._persistence;
188     }
189 
190     public void setPersistence(ResourcePersistence persistence) {
191         _persistence = persistence;
192     }
193 
194     private static ResourceUtil _getUtil() {
195         if (_util == null) {
196             _util = (ResourceUtil)com.liferay.portal.kernel.bean.BeanLocatorUtil.locate(_UTIL);
197         }
198 
199         return _util;
200     }
201 
202     private static final String _UTIL = ResourceUtil.class.getName();
203     private static ResourceUtil _util;
204     private ResourcePersistence _persistence;
205 }