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.bookmarks.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.asset.service.AssetEntryLocalService;
36  import com.liferay.portlet.asset.service.AssetEntryService;
37  import com.liferay.portlet.asset.service.AssetTagLocalService;
38  import com.liferay.portlet.asset.service.AssetTagService;
39  import com.liferay.portlet.asset.service.persistence.AssetEntryFinder;
40  import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
41  import com.liferay.portlet.asset.service.persistence.AssetTagFinder;
42  import com.liferay.portlet.asset.service.persistence.AssetTagPersistence;
43  import com.liferay.portlet.bookmarks.model.BookmarksEntry;
44  import com.liferay.portlet.bookmarks.service.BookmarksEntryLocalService;
45  import com.liferay.portlet.bookmarks.service.BookmarksEntryService;
46  import com.liferay.portlet.bookmarks.service.BookmarksFolderLocalService;
47  import com.liferay.portlet.bookmarks.service.BookmarksFolderService;
48  import com.liferay.portlet.bookmarks.service.persistence.BookmarksEntryFinder;
49  import com.liferay.portlet.bookmarks.service.persistence.BookmarksEntryPersistence;
50  import com.liferay.portlet.bookmarks.service.persistence.BookmarksFolderPersistence;
51  import com.liferay.portlet.expando.service.ExpandoValueLocalService;
52  import com.liferay.portlet.expando.service.ExpandoValueService;
53  import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
54  
55  import java.util.List;
56  
57  import javax.sql.DataSource;
58  
59  /**
60   * <a href="BookmarksEntryLocalServiceBaseImpl.java.html"><b><i>View Source</i>
61   * </b></a>
62   *
63   * @author Brian Wing Shun Chan
64   */
65  public abstract class BookmarksEntryLocalServiceBaseImpl
66      implements BookmarksEntryLocalService {
67      public BookmarksEntry addBookmarksEntry(BookmarksEntry bookmarksEntry)
68          throws SystemException {
69          bookmarksEntry.setNew(true);
70  
71          return bookmarksEntryPersistence.update(bookmarksEntry, false);
72      }
73  
74      public BookmarksEntry createBookmarksEntry(long entryId) {
75          return bookmarksEntryPersistence.create(entryId);
76      }
77  
78      public void deleteBookmarksEntry(long entryId)
79          throws PortalException, SystemException {
80          bookmarksEntryPersistence.remove(entryId);
81      }
82  
83      public void deleteBookmarksEntry(BookmarksEntry bookmarksEntry)
84          throws SystemException {
85          bookmarksEntryPersistence.remove(bookmarksEntry);
86      }
87  
88      @SuppressWarnings("unchecked")
89      public List dynamicQuery(DynamicQuery dynamicQuery)
90          throws SystemException {
91          return bookmarksEntryPersistence.findWithDynamicQuery(dynamicQuery);
92      }
93  
94      @SuppressWarnings("unchecked")
95      public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
96          throws SystemException {
97          return bookmarksEntryPersistence.findWithDynamicQuery(dynamicQuery,
98              start, end);
99      }
100 
101     @SuppressWarnings("unchecked")
102     public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
103         OrderByComparator orderByComparator) throws SystemException {
104         return bookmarksEntryPersistence.findWithDynamicQuery(dynamicQuery,
105             start, end, orderByComparator);
106     }
107 
108     public long dynamicQueryCount(DynamicQuery dynamicQuery)
109         throws SystemException {
110         return bookmarksEntryPersistence.countWithDynamicQuery(dynamicQuery);
111     }
112 
113     public BookmarksEntry getBookmarksEntry(long entryId)
114         throws PortalException, SystemException {
115         return bookmarksEntryPersistence.findByPrimaryKey(entryId);
116     }
117 
118     public BookmarksEntry getBookmarksEntryByUuidAndGroupId(String uuid,
119         long groupId) throws PortalException, SystemException {
120         return bookmarksEntryPersistence.findByUUID_G(uuid, groupId);
121     }
122 
123     public List<BookmarksEntry> getBookmarksEntries(int start, int end)
124         throws SystemException {
125         return bookmarksEntryPersistence.findAll(start, end);
126     }
127 
128     public int getBookmarksEntriesCount() throws SystemException {
129         return bookmarksEntryPersistence.countAll();
130     }
131 
132     public BookmarksEntry updateBookmarksEntry(BookmarksEntry bookmarksEntry)
133         throws SystemException {
134         bookmarksEntry.setNew(false);
135 
136         return bookmarksEntryPersistence.update(bookmarksEntry, true);
137     }
138 
139     public BookmarksEntry updateBookmarksEntry(BookmarksEntry bookmarksEntry,
140         boolean merge) throws SystemException {
141         bookmarksEntry.setNew(false);
142 
143         return bookmarksEntryPersistence.update(bookmarksEntry, merge);
144     }
145 
146     public BookmarksEntryLocalService getBookmarksEntryLocalService() {
147         return bookmarksEntryLocalService;
148     }
149 
150     public void setBookmarksEntryLocalService(
151         BookmarksEntryLocalService bookmarksEntryLocalService) {
152         this.bookmarksEntryLocalService = bookmarksEntryLocalService;
153     }
154 
155     public BookmarksEntryService getBookmarksEntryService() {
156         return bookmarksEntryService;
157     }
158 
159     public void setBookmarksEntryService(
160         BookmarksEntryService bookmarksEntryService) {
161         this.bookmarksEntryService = bookmarksEntryService;
162     }
163 
164     public BookmarksEntryPersistence getBookmarksEntryPersistence() {
165         return bookmarksEntryPersistence;
166     }
167 
168     public void setBookmarksEntryPersistence(
169         BookmarksEntryPersistence bookmarksEntryPersistence) {
170         this.bookmarksEntryPersistence = bookmarksEntryPersistence;
171     }
172 
173     public BookmarksEntryFinder getBookmarksEntryFinder() {
174         return bookmarksEntryFinder;
175     }
176 
177     public void setBookmarksEntryFinder(
178         BookmarksEntryFinder bookmarksEntryFinder) {
179         this.bookmarksEntryFinder = bookmarksEntryFinder;
180     }
181 
182     public BookmarksFolderLocalService getBookmarksFolderLocalService() {
183         return bookmarksFolderLocalService;
184     }
185 
186     public void setBookmarksFolderLocalService(
187         BookmarksFolderLocalService bookmarksFolderLocalService) {
188         this.bookmarksFolderLocalService = bookmarksFolderLocalService;
189     }
190 
191     public BookmarksFolderService getBookmarksFolderService() {
192         return bookmarksFolderService;
193     }
194 
195     public void setBookmarksFolderService(
196         BookmarksFolderService bookmarksFolderService) {
197         this.bookmarksFolderService = bookmarksFolderService;
198     }
199 
200     public BookmarksFolderPersistence getBookmarksFolderPersistence() {
201         return bookmarksFolderPersistence;
202     }
203 
204     public void setBookmarksFolderPersistence(
205         BookmarksFolderPersistence bookmarksFolderPersistence) {
206         this.bookmarksFolderPersistence = bookmarksFolderPersistence;
207     }
208 
209     public CounterLocalService getCounterLocalService() {
210         return counterLocalService;
211     }
212 
213     public void setCounterLocalService(CounterLocalService counterLocalService) {
214         this.counterLocalService = counterLocalService;
215     }
216 
217     public ResourceLocalService getResourceLocalService() {
218         return resourceLocalService;
219     }
220 
221     public void setResourceLocalService(
222         ResourceLocalService resourceLocalService) {
223         this.resourceLocalService = resourceLocalService;
224     }
225 
226     public ResourceService getResourceService() {
227         return resourceService;
228     }
229 
230     public void setResourceService(ResourceService resourceService) {
231         this.resourceService = resourceService;
232     }
233 
234     public ResourcePersistence getResourcePersistence() {
235         return resourcePersistence;
236     }
237 
238     public void setResourcePersistence(ResourcePersistence resourcePersistence) {
239         this.resourcePersistence = resourcePersistence;
240     }
241 
242     public ResourceFinder getResourceFinder() {
243         return resourceFinder;
244     }
245 
246     public void setResourceFinder(ResourceFinder resourceFinder) {
247         this.resourceFinder = resourceFinder;
248     }
249 
250     public UserLocalService getUserLocalService() {
251         return userLocalService;
252     }
253 
254     public void setUserLocalService(UserLocalService userLocalService) {
255         this.userLocalService = userLocalService;
256     }
257 
258     public UserService getUserService() {
259         return userService;
260     }
261 
262     public void setUserService(UserService userService) {
263         this.userService = userService;
264     }
265 
266     public UserPersistence getUserPersistence() {
267         return userPersistence;
268     }
269 
270     public void setUserPersistence(UserPersistence userPersistence) {
271         this.userPersistence = userPersistence;
272     }
273 
274     public UserFinder getUserFinder() {
275         return userFinder;
276     }
277 
278     public void setUserFinder(UserFinder userFinder) {
279         this.userFinder = userFinder;
280     }
281 
282     public AssetEntryLocalService getAssetEntryLocalService() {
283         return assetEntryLocalService;
284     }
285 
286     public void setAssetEntryLocalService(
287         AssetEntryLocalService assetEntryLocalService) {
288         this.assetEntryLocalService = assetEntryLocalService;
289     }
290 
291     public AssetEntryService getAssetEntryService() {
292         return assetEntryService;
293     }
294 
295     public void setAssetEntryService(AssetEntryService assetEntryService) {
296         this.assetEntryService = assetEntryService;
297     }
298 
299     public AssetEntryPersistence getAssetEntryPersistence() {
300         return assetEntryPersistence;
301     }
302 
303     public void setAssetEntryPersistence(
304         AssetEntryPersistence assetEntryPersistence) {
305         this.assetEntryPersistence = assetEntryPersistence;
306     }
307 
308     public AssetEntryFinder getAssetEntryFinder() {
309         return assetEntryFinder;
310     }
311 
312     public void setAssetEntryFinder(AssetEntryFinder assetEntryFinder) {
313         this.assetEntryFinder = assetEntryFinder;
314     }
315 
316     public AssetTagLocalService getAssetTagLocalService() {
317         return assetTagLocalService;
318     }
319 
320     public void setAssetTagLocalService(
321         AssetTagLocalService assetTagLocalService) {
322         this.assetTagLocalService = assetTagLocalService;
323     }
324 
325     public AssetTagService getAssetTagService() {
326         return assetTagService;
327     }
328 
329     public void setAssetTagService(AssetTagService assetTagService) {
330         this.assetTagService = assetTagService;
331     }
332 
333     public AssetTagPersistence getAssetTagPersistence() {
334         return assetTagPersistence;
335     }
336 
337     public void setAssetTagPersistence(AssetTagPersistence assetTagPersistence) {
338         this.assetTagPersistence = assetTagPersistence;
339     }
340 
341     public AssetTagFinder getAssetTagFinder() {
342         return assetTagFinder;
343     }
344 
345     public void setAssetTagFinder(AssetTagFinder assetTagFinder) {
346         this.assetTagFinder = assetTagFinder;
347     }
348 
349     public ExpandoValueLocalService getExpandoValueLocalService() {
350         return expandoValueLocalService;
351     }
352 
353     public void setExpandoValueLocalService(
354         ExpandoValueLocalService expandoValueLocalService) {
355         this.expandoValueLocalService = expandoValueLocalService;
356     }
357 
358     public ExpandoValueService getExpandoValueService() {
359         return expandoValueService;
360     }
361 
362     public void setExpandoValueService(ExpandoValueService expandoValueService) {
363         this.expandoValueService = expandoValueService;
364     }
365 
366     public ExpandoValuePersistence getExpandoValuePersistence() {
367         return expandoValuePersistence;
368     }
369 
370     public void setExpandoValuePersistence(
371         ExpandoValuePersistence expandoValuePersistence) {
372         this.expandoValuePersistence = expandoValuePersistence;
373     }
374 
375     protected void runSQL(String sql) throws SystemException {
376         try {
377             DataSource dataSource = bookmarksEntryPersistence.getDataSource();
378 
379             SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
380                     sql, new int[0]);
381 
382             sqlUpdate.update();
383         }
384         catch (Exception e) {
385             throw new SystemException(e);
386         }
387     }
388 
389     @BeanReference(type = BookmarksEntryLocalService.class)
390     protected BookmarksEntryLocalService bookmarksEntryLocalService;
391     @BeanReference(type = BookmarksEntryService.class)
392     protected BookmarksEntryService bookmarksEntryService;
393     @BeanReference(type = BookmarksEntryPersistence.class)
394     protected BookmarksEntryPersistence bookmarksEntryPersistence;
395     @BeanReference(type = BookmarksEntryFinder.class)
396     protected BookmarksEntryFinder bookmarksEntryFinder;
397     @BeanReference(type = BookmarksFolderLocalService.class)
398     protected BookmarksFolderLocalService bookmarksFolderLocalService;
399     @BeanReference(type = BookmarksFolderService.class)
400     protected BookmarksFolderService bookmarksFolderService;
401     @BeanReference(type = BookmarksFolderPersistence.class)
402     protected BookmarksFolderPersistence bookmarksFolderPersistence;
403     @BeanReference(type = CounterLocalService.class)
404     protected CounterLocalService counterLocalService;
405     @BeanReference(type = ResourceLocalService.class)
406     protected ResourceLocalService resourceLocalService;
407     @BeanReference(type = ResourceService.class)
408     protected ResourceService resourceService;
409     @BeanReference(type = ResourcePersistence.class)
410     protected ResourcePersistence resourcePersistence;
411     @BeanReference(type = ResourceFinder.class)
412     protected ResourceFinder resourceFinder;
413     @BeanReference(type = UserLocalService.class)
414     protected UserLocalService userLocalService;
415     @BeanReference(type = UserService.class)
416     protected UserService userService;
417     @BeanReference(type = UserPersistence.class)
418     protected UserPersistence userPersistence;
419     @BeanReference(type = UserFinder.class)
420     protected UserFinder userFinder;
421     @BeanReference(type = AssetEntryLocalService.class)
422     protected AssetEntryLocalService assetEntryLocalService;
423     @BeanReference(type = AssetEntryService.class)
424     protected AssetEntryService assetEntryService;
425     @BeanReference(type = AssetEntryPersistence.class)
426     protected AssetEntryPersistence assetEntryPersistence;
427     @BeanReference(type = AssetEntryFinder.class)
428     protected AssetEntryFinder assetEntryFinder;
429     @BeanReference(type = AssetTagLocalService.class)
430     protected AssetTagLocalService assetTagLocalService;
431     @BeanReference(type = AssetTagService.class)
432     protected AssetTagService assetTagService;
433     @BeanReference(type = AssetTagPersistence.class)
434     protected AssetTagPersistence assetTagPersistence;
435     @BeanReference(type = AssetTagFinder.class)
436     protected AssetTagFinder assetTagFinder;
437     @BeanReference(type = ExpandoValueLocalService.class)
438     protected ExpandoValueLocalService expandoValueLocalService;
439     @BeanReference(type = ExpandoValueService.class)
440     protected ExpandoValueService expandoValueService;
441     @BeanReference(type = ExpandoValuePersistence.class)
442     protected ExpandoValuePersistence expandoValuePersistence;
443 }