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="ShardUtil.java.html"><b><i>View Source</i></b></a>
24   *
25   * @author Brian Wing Shun Chan
26   *
27   */
28  public class ShardUtil {
29      public static void cacheResult(com.liferay.portal.model.Shard shard) {
30          getPersistence().cacheResult(shard);
31      }
32  
33      public static void cacheResult(
34          java.util.List<com.liferay.portal.model.Shard> shards) {
35          getPersistence().cacheResult(shards);
36      }
37  
38      public static void clearCache() {
39          getPersistence().clearCache();
40      }
41  
42      public static com.liferay.portal.model.Shard create(long shardId) {
43          return getPersistence().create(shardId);
44      }
45  
46      public static com.liferay.portal.model.Shard remove(long shardId)
47          throws com.liferay.portal.NoSuchShardException,
48              com.liferay.portal.SystemException {
49          return getPersistence().remove(shardId);
50      }
51  
52      public static com.liferay.portal.model.Shard remove(
53          com.liferay.portal.model.Shard shard)
54          throws com.liferay.portal.SystemException {
55          return getPersistence().remove(shard);
56      }
57  
58      /**
59       * @deprecated Use <code>update(Shard shard, boolean merge)</code>.
60       */
61      public static com.liferay.portal.model.Shard update(
62          com.liferay.portal.model.Shard shard)
63          throws com.liferay.portal.SystemException {
64          return getPersistence().update(shard);
65      }
66  
67      /**
68       * Add, update, or merge, the entity. This method also calls the model
69       * listeners to trigger the proper events associated with adding, deleting,
70       * or updating an entity.
71       *
72       * @param        shard the entity to add, update, or merge
73       * @param        merge boolean value for whether to merge the entity. The
74       *                default value is false. Setting merge to true is more
75       *                expensive and should only be true when shard is
76       *                transient. See LEP-5473 for a detailed discussion of this
77       *                method.
78       * @return        true if the portlet can be displayed via Ajax
79       */
80      public static com.liferay.portal.model.Shard update(
81          com.liferay.portal.model.Shard shard, boolean merge)
82          throws com.liferay.portal.SystemException {
83          return getPersistence().update(shard, merge);
84      }
85  
86      public static com.liferay.portal.model.Shard updateImpl(
87          com.liferay.portal.model.Shard shard, boolean merge)
88          throws com.liferay.portal.SystemException {
89          return getPersistence().updateImpl(shard, merge);
90      }
91  
92      public static com.liferay.portal.model.Shard findByPrimaryKey(long shardId)
93          throws com.liferay.portal.NoSuchShardException,
94              com.liferay.portal.SystemException {
95          return getPersistence().findByPrimaryKey(shardId);
96      }
97  
98      public static com.liferay.portal.model.Shard fetchByPrimaryKey(long shardId)
99          throws com.liferay.portal.SystemException {
100         return getPersistence().fetchByPrimaryKey(shardId);
101     }
102 
103     public static com.liferay.portal.model.Shard findByName(
104         java.lang.String name)
105         throws com.liferay.portal.NoSuchShardException,
106             com.liferay.portal.SystemException {
107         return getPersistence().findByName(name);
108     }
109 
110     public static com.liferay.portal.model.Shard fetchByName(
111         java.lang.String name) throws com.liferay.portal.SystemException {
112         return getPersistence().fetchByName(name);
113     }
114 
115     public static com.liferay.portal.model.Shard fetchByName(
116         java.lang.String name, boolean retrieveFromCache)
117         throws com.liferay.portal.SystemException {
118         return getPersistence().fetchByName(name, retrieveFromCache);
119     }
120 
121     public static com.liferay.portal.model.Shard findByC_C(long classNameId,
122         long classPK)
123         throws com.liferay.portal.NoSuchShardException,
124             com.liferay.portal.SystemException {
125         return getPersistence().findByC_C(classNameId, classPK);
126     }
127 
128     public static com.liferay.portal.model.Shard fetchByC_C(long classNameId,
129         long classPK) throws com.liferay.portal.SystemException {
130         return getPersistence().fetchByC_C(classNameId, classPK);
131     }
132 
133     public static com.liferay.portal.model.Shard fetchByC_C(long classNameId,
134         long classPK, boolean retrieveFromCache)
135         throws com.liferay.portal.SystemException {
136         return getPersistence()
137                    .fetchByC_C(classNameId, classPK, retrieveFromCache);
138     }
139 
140     public static java.util.List<Object> findWithDynamicQuery(
141         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
142         throws com.liferay.portal.SystemException {
143         return getPersistence().findWithDynamicQuery(dynamicQuery);
144     }
145 
146     public static java.util.List<Object> findWithDynamicQuery(
147         com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
148         int end) throws com.liferay.portal.SystemException {
149         return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
150     }
151 
152     public static java.util.List<com.liferay.portal.model.Shard> findAll()
153         throws com.liferay.portal.SystemException {
154         return getPersistence().findAll();
155     }
156 
157     public static java.util.List<com.liferay.portal.model.Shard> findAll(
158         int start, int end) throws com.liferay.portal.SystemException {
159         return getPersistence().findAll(start, end);
160     }
161 
162     public static java.util.List<com.liferay.portal.model.Shard> findAll(
163         int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
164         throws com.liferay.portal.SystemException {
165         return getPersistence().findAll(start, end, obc);
166     }
167 
168     public static void removeByName(java.lang.String name)
169         throws com.liferay.portal.NoSuchShardException,
170             com.liferay.portal.SystemException {
171         getPersistence().removeByName(name);
172     }
173 
174     public static void removeByC_C(long classNameId, long classPK)
175         throws com.liferay.portal.NoSuchShardException,
176             com.liferay.portal.SystemException {
177         getPersistence().removeByC_C(classNameId, classPK);
178     }
179 
180     public static void removeAll() throws com.liferay.portal.SystemException {
181         getPersistence().removeAll();
182     }
183 
184     public static int countByName(java.lang.String name)
185         throws com.liferay.portal.SystemException {
186         return getPersistence().countByName(name);
187     }
188 
189     public static int countByC_C(long classNameId, long classPK)
190         throws com.liferay.portal.SystemException {
191         return getPersistence().countByC_C(classNameId, classPK);
192     }
193 
194     public static int countAll() throws com.liferay.portal.SystemException {
195         return getPersistence().countAll();
196     }
197 
198     public static ShardPersistence getPersistence() {
199         return _persistence;
200     }
201 
202     public void setPersistence(ShardPersistence persistence) {
203         _persistence = persistence;
204     }
205 
206     private static ShardPersistence _persistence;
207 }