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