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.portlet.expando.service.base;
16  
17  import com.liferay.counter.service.CounterLocalService;
18  
19  import com.liferay.portal.kernel.annotation.BeanReference;
20  import com.liferay.portal.kernel.dao.db.DB;
21  import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
22  import com.liferay.portal.kernel.dao.orm.DynamicQuery;
23  import com.liferay.portal.kernel.exception.PortalException;
24  import com.liferay.portal.kernel.exception.SystemException;
25  import com.liferay.portal.kernel.util.OrderByComparator;
26  import com.liferay.portal.service.ResourceLocalService;
27  import com.liferay.portal.service.ResourceService;
28  import com.liferay.portal.service.UserLocalService;
29  import com.liferay.portal.service.UserService;
30  import com.liferay.portal.service.persistence.ResourceFinder;
31  import com.liferay.portal.service.persistence.ResourcePersistence;
32  import com.liferay.portal.service.persistence.UserFinder;
33  import com.liferay.portal.service.persistence.UserPersistence;
34  
35  import com.liferay.portlet.expando.model.ExpandoRow;
36  import com.liferay.portlet.expando.service.ExpandoColumnLocalService;
37  import com.liferay.portlet.expando.service.ExpandoColumnService;
38  import com.liferay.portlet.expando.service.ExpandoRowLocalService;
39  import com.liferay.portlet.expando.service.ExpandoTableLocalService;
40  import com.liferay.portlet.expando.service.ExpandoValueLocalService;
41  import com.liferay.portlet.expando.service.ExpandoValueService;
42  import com.liferay.portlet.expando.service.persistence.ExpandoColumnPersistence;
43  import com.liferay.portlet.expando.service.persistence.ExpandoRowPersistence;
44  import com.liferay.portlet.expando.service.persistence.ExpandoTablePersistence;
45  import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
46  
47  import java.util.List;
48  
49  /**
50   * <a href="ExpandoRowLocalServiceBaseImpl.java.html"><b><i>View Source</i></b>
51   * </a>
52   *
53   * @author Brian Wing Shun Chan
54   */
55  public abstract class ExpandoRowLocalServiceBaseImpl
56      implements ExpandoRowLocalService {
57      public ExpandoRow addExpandoRow(ExpandoRow expandoRow)
58          throws SystemException {
59          expandoRow.setNew(true);
60  
61          return expandoRowPersistence.update(expandoRow, false);
62      }
63  
64      public ExpandoRow createExpandoRow(long rowId) {
65          return expandoRowPersistence.create(rowId);
66      }
67  
68      public void deleteExpandoRow(long rowId)
69          throws PortalException, SystemException {
70          expandoRowPersistence.remove(rowId);
71      }
72  
73      public void deleteExpandoRow(ExpandoRow expandoRow)
74          throws SystemException {
75          expandoRowPersistence.remove(expandoRow);
76      }
77  
78      public List<Object> dynamicQuery(DynamicQuery dynamicQuery)
79          throws SystemException {
80          return expandoRowPersistence.findWithDynamicQuery(dynamicQuery);
81      }
82  
83      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
84          int end) throws SystemException {
85          return expandoRowPersistence.findWithDynamicQuery(dynamicQuery, start,
86              end);
87      }
88  
89      public List<Object> dynamicQuery(DynamicQuery dynamicQuery, int start,
90          int end, OrderByComparator orderByComparator) throws SystemException {
91          return expandoRowPersistence.findWithDynamicQuery(dynamicQuery, start,
92              end, orderByComparator);
93      }
94  
95      public int dynamicQueryCount(DynamicQuery dynamicQuery)
96          throws SystemException {
97          return expandoRowPersistence.countWithDynamicQuery(dynamicQuery);
98      }
99  
100     public ExpandoRow getExpandoRow(long rowId)
101         throws PortalException, SystemException {
102         return expandoRowPersistence.findByPrimaryKey(rowId);
103     }
104 
105     public List<ExpandoRow> getExpandoRows(int start, int end)
106         throws SystemException {
107         return expandoRowPersistence.findAll(start, end);
108     }
109 
110     public int getExpandoRowsCount() throws SystemException {
111         return expandoRowPersistence.countAll();
112     }
113 
114     public ExpandoRow updateExpandoRow(ExpandoRow expandoRow)
115         throws SystemException {
116         expandoRow.setNew(false);
117 
118         return expandoRowPersistence.update(expandoRow, true);
119     }
120 
121     public ExpandoRow updateExpandoRow(ExpandoRow expandoRow, boolean merge)
122         throws SystemException {
123         expandoRow.setNew(false);
124 
125         return expandoRowPersistence.update(expandoRow, merge);
126     }
127 
128     public ExpandoColumnLocalService getExpandoColumnLocalService() {
129         return expandoColumnLocalService;
130     }
131 
132     public void setExpandoColumnLocalService(
133         ExpandoColumnLocalService expandoColumnLocalService) {
134         this.expandoColumnLocalService = expandoColumnLocalService;
135     }
136 
137     public ExpandoColumnService getExpandoColumnService() {
138         return expandoColumnService;
139     }
140 
141     public void setExpandoColumnService(
142         ExpandoColumnService expandoColumnService) {
143         this.expandoColumnService = expandoColumnService;
144     }
145 
146     public ExpandoColumnPersistence getExpandoColumnPersistence() {
147         return expandoColumnPersistence;
148     }
149 
150     public void setExpandoColumnPersistence(
151         ExpandoColumnPersistence expandoColumnPersistence) {
152         this.expandoColumnPersistence = expandoColumnPersistence;
153     }
154 
155     public ExpandoRowLocalService getExpandoRowLocalService() {
156         return expandoRowLocalService;
157     }
158 
159     public void setExpandoRowLocalService(
160         ExpandoRowLocalService expandoRowLocalService) {
161         this.expandoRowLocalService = expandoRowLocalService;
162     }
163 
164     public ExpandoRowPersistence getExpandoRowPersistence() {
165         return expandoRowPersistence;
166     }
167 
168     public void setExpandoRowPersistence(
169         ExpandoRowPersistence expandoRowPersistence) {
170         this.expandoRowPersistence = expandoRowPersistence;
171     }
172 
173     public ExpandoTableLocalService getExpandoTableLocalService() {
174         return expandoTableLocalService;
175     }
176 
177     public void setExpandoTableLocalService(
178         ExpandoTableLocalService expandoTableLocalService) {
179         this.expandoTableLocalService = expandoTableLocalService;
180     }
181 
182     public ExpandoTablePersistence getExpandoTablePersistence() {
183         return expandoTablePersistence;
184     }
185 
186     public void setExpandoTablePersistence(
187         ExpandoTablePersistence expandoTablePersistence) {
188         this.expandoTablePersistence = expandoTablePersistence;
189     }
190 
191     public ExpandoValueLocalService getExpandoValueLocalService() {
192         return expandoValueLocalService;
193     }
194 
195     public void setExpandoValueLocalService(
196         ExpandoValueLocalService expandoValueLocalService) {
197         this.expandoValueLocalService = expandoValueLocalService;
198     }
199 
200     public ExpandoValueService getExpandoValueService() {
201         return expandoValueService;
202     }
203 
204     public void setExpandoValueService(ExpandoValueService expandoValueService) {
205         this.expandoValueService = expandoValueService;
206     }
207 
208     public ExpandoValuePersistence getExpandoValuePersistence() {
209         return expandoValuePersistence;
210     }
211 
212     public void setExpandoValuePersistence(
213         ExpandoValuePersistence expandoValuePersistence) {
214         this.expandoValuePersistence = expandoValuePersistence;
215     }
216 
217     public CounterLocalService getCounterLocalService() {
218         return counterLocalService;
219     }
220 
221     public void setCounterLocalService(CounterLocalService counterLocalService) {
222         this.counterLocalService = counterLocalService;
223     }
224 
225     public ResourceLocalService getResourceLocalService() {
226         return resourceLocalService;
227     }
228 
229     public void setResourceLocalService(
230         ResourceLocalService resourceLocalService) {
231         this.resourceLocalService = resourceLocalService;
232     }
233 
234     public ResourceService getResourceService() {
235         return resourceService;
236     }
237 
238     public void setResourceService(ResourceService resourceService) {
239         this.resourceService = resourceService;
240     }
241 
242     public ResourcePersistence getResourcePersistence() {
243         return resourcePersistence;
244     }
245 
246     public void setResourcePersistence(ResourcePersistence resourcePersistence) {
247         this.resourcePersistence = resourcePersistence;
248     }
249 
250     public ResourceFinder getResourceFinder() {
251         return resourceFinder;
252     }
253 
254     public void setResourceFinder(ResourceFinder resourceFinder) {
255         this.resourceFinder = resourceFinder;
256     }
257 
258     public UserLocalService getUserLocalService() {
259         return userLocalService;
260     }
261 
262     public void setUserLocalService(UserLocalService userLocalService) {
263         this.userLocalService = userLocalService;
264     }
265 
266     public UserService getUserService() {
267         return userService;
268     }
269 
270     public void setUserService(UserService userService) {
271         this.userService = userService;
272     }
273 
274     public UserPersistence getUserPersistence() {
275         return userPersistence;
276     }
277 
278     public void setUserPersistence(UserPersistence userPersistence) {
279         this.userPersistence = userPersistence;
280     }
281 
282     public UserFinder getUserFinder() {
283         return userFinder;
284     }
285 
286     public void setUserFinder(UserFinder userFinder) {
287         this.userFinder = userFinder;
288     }
289 
290     protected void runSQL(String sql) throws SystemException {
291         try {
292             DB db = DBFactoryUtil.getDB();
293 
294             db.runSQL(sql);
295         }
296         catch (Exception e) {
297             throw new SystemException(e);
298         }
299     }
300 
301     @BeanReference(type = ExpandoColumnLocalService.class)
302     protected ExpandoColumnLocalService expandoColumnLocalService;
303     @BeanReference(type = ExpandoColumnService.class)
304     protected ExpandoColumnService expandoColumnService;
305     @BeanReference(type = ExpandoColumnPersistence.class)
306     protected ExpandoColumnPersistence expandoColumnPersistence;
307     @BeanReference(type = ExpandoRowLocalService.class)
308     protected ExpandoRowLocalService expandoRowLocalService;
309     @BeanReference(type = ExpandoRowPersistence.class)
310     protected ExpandoRowPersistence expandoRowPersistence;
311     @BeanReference(type = ExpandoTableLocalService.class)
312     protected ExpandoTableLocalService expandoTableLocalService;
313     @BeanReference(type = ExpandoTablePersistence.class)
314     protected ExpandoTablePersistence expandoTablePersistence;
315     @BeanReference(type = ExpandoValueLocalService.class)
316     protected ExpandoValueLocalService expandoValueLocalService;
317     @BeanReference(type = ExpandoValueService.class)
318     protected ExpandoValueService expandoValueService;
319     @BeanReference(type = ExpandoValuePersistence.class)
320     protected ExpandoValuePersistence expandoValuePersistence;
321     @BeanReference(type = CounterLocalService.class)
322     protected CounterLocalService counterLocalService;
323     @BeanReference(type = ResourceLocalService.class)
324     protected ResourceLocalService resourceLocalService;
325     @BeanReference(type = ResourceService.class)
326     protected ResourceService resourceService;
327     @BeanReference(type = ResourcePersistence.class)
328     protected ResourcePersistence resourcePersistence;
329     @BeanReference(type = ResourceFinder.class)
330     protected ResourceFinder resourceFinder;
331     @BeanReference(type = UserLocalService.class)
332     protected UserLocalService userLocalService;
333     @BeanReference(type = UserService.class)
334     protected UserService userService;
335     @BeanReference(type = UserPersistence.class)
336     protected UserPersistence userPersistence;
337     @BeanReference(type = UserFinder.class)
338     protected UserFinder userFinder;
339 }