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