001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.bookmarks.service.base;
016    
017    import com.liferay.counter.service.CounterLocalService;
018    
019    import com.liferay.portal.kernel.annotation.BeanReference;
020    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
021    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
022    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
023    import com.liferay.portal.kernel.exception.PortalException;
024    import com.liferay.portal.kernel.exception.SystemException;
025    import com.liferay.portal.kernel.util.OrderByComparator;
026    import com.liferay.portal.service.ResourceLocalService;
027    import com.liferay.portal.service.ResourceService;
028    import com.liferay.portal.service.UserLocalService;
029    import com.liferay.portal.service.UserService;
030    import com.liferay.portal.service.persistence.ResourceFinder;
031    import com.liferay.portal.service.persistence.ResourcePersistence;
032    import com.liferay.portal.service.persistence.UserFinder;
033    import com.liferay.portal.service.persistence.UserPersistence;
034    
035    import com.liferay.portlet.asset.service.AssetEntryLocalService;
036    import com.liferay.portlet.asset.service.AssetEntryService;
037    import com.liferay.portlet.asset.service.AssetTagLocalService;
038    import com.liferay.portlet.asset.service.AssetTagService;
039    import com.liferay.portlet.asset.service.persistence.AssetEntryFinder;
040    import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
041    import com.liferay.portlet.asset.service.persistence.AssetTagFinder;
042    import com.liferay.portlet.asset.service.persistence.AssetTagPersistence;
043    import com.liferay.portlet.bookmarks.model.BookmarksEntry;
044    import com.liferay.portlet.bookmarks.service.BookmarksEntryLocalService;
045    import com.liferay.portlet.bookmarks.service.BookmarksEntryService;
046    import com.liferay.portlet.bookmarks.service.BookmarksFolderLocalService;
047    import com.liferay.portlet.bookmarks.service.BookmarksFolderService;
048    import com.liferay.portlet.bookmarks.service.persistence.BookmarksEntryFinder;
049    import com.liferay.portlet.bookmarks.service.persistence.BookmarksEntryPersistence;
050    import com.liferay.portlet.bookmarks.service.persistence.BookmarksFolderPersistence;
051    import com.liferay.portlet.expando.service.ExpandoValueLocalService;
052    import com.liferay.portlet.expando.service.ExpandoValueService;
053    import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
054    
055    import java.util.List;
056    
057    import javax.sql.DataSource;
058    
059    /**
060     * @author Brian Wing Shun Chan
061     */
062    public abstract class BookmarksEntryLocalServiceBaseImpl
063            implements BookmarksEntryLocalService {
064            public BookmarksEntry addBookmarksEntry(BookmarksEntry bookmarksEntry)
065                    throws SystemException {
066                    bookmarksEntry.setNew(true);
067    
068                    return bookmarksEntryPersistence.update(bookmarksEntry, false);
069            }
070    
071            public BookmarksEntry createBookmarksEntry(long entryId) {
072                    return bookmarksEntryPersistence.create(entryId);
073            }
074    
075            public void deleteBookmarksEntry(long entryId)
076                    throws PortalException, SystemException {
077                    bookmarksEntryPersistence.remove(entryId);
078            }
079    
080            public void deleteBookmarksEntry(BookmarksEntry bookmarksEntry)
081                    throws SystemException {
082                    bookmarksEntryPersistence.remove(bookmarksEntry);
083            }
084    
085            @SuppressWarnings("unchecked")
086            public List dynamicQuery(DynamicQuery dynamicQuery)
087                    throws SystemException {
088                    return bookmarksEntryPersistence.findWithDynamicQuery(dynamicQuery);
089            }
090    
091            @SuppressWarnings("unchecked")
092            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
093                    throws SystemException {
094                    return bookmarksEntryPersistence.findWithDynamicQuery(dynamicQuery,
095                            start, end);
096            }
097    
098            @SuppressWarnings("unchecked")
099            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
100                    OrderByComparator orderByComparator) throws SystemException {
101                    return bookmarksEntryPersistence.findWithDynamicQuery(dynamicQuery,
102                            start, end, orderByComparator);
103            }
104    
105            public long dynamicQueryCount(DynamicQuery dynamicQuery)
106                    throws SystemException {
107                    return bookmarksEntryPersistence.countWithDynamicQuery(dynamicQuery);
108            }
109    
110            public BookmarksEntry getBookmarksEntry(long entryId)
111                    throws PortalException, SystemException {
112                    return bookmarksEntryPersistence.findByPrimaryKey(entryId);
113            }
114    
115            public BookmarksEntry getBookmarksEntryByUuidAndGroupId(String uuid,
116                    long groupId) throws PortalException, SystemException {
117                    return bookmarksEntryPersistence.findByUUID_G(uuid, groupId);
118            }
119    
120            public List<BookmarksEntry> getBookmarksEntries(int start, int end)
121                    throws SystemException {
122                    return bookmarksEntryPersistence.findAll(start, end);
123            }
124    
125            public int getBookmarksEntriesCount() throws SystemException {
126                    return bookmarksEntryPersistence.countAll();
127            }
128    
129            public BookmarksEntry updateBookmarksEntry(BookmarksEntry bookmarksEntry)
130                    throws SystemException {
131                    bookmarksEntry.setNew(false);
132    
133                    return bookmarksEntryPersistence.update(bookmarksEntry, true);
134            }
135    
136            public BookmarksEntry updateBookmarksEntry(BookmarksEntry bookmarksEntry,
137                    boolean merge) throws SystemException {
138                    bookmarksEntry.setNew(false);
139    
140                    return bookmarksEntryPersistence.update(bookmarksEntry, merge);
141            }
142    
143            public BookmarksEntryLocalService getBookmarksEntryLocalService() {
144                    return bookmarksEntryLocalService;
145            }
146    
147            public void setBookmarksEntryLocalService(
148                    BookmarksEntryLocalService bookmarksEntryLocalService) {
149                    this.bookmarksEntryLocalService = bookmarksEntryLocalService;
150            }
151    
152            public BookmarksEntryService getBookmarksEntryService() {
153                    return bookmarksEntryService;
154            }
155    
156            public void setBookmarksEntryService(
157                    BookmarksEntryService bookmarksEntryService) {
158                    this.bookmarksEntryService = bookmarksEntryService;
159            }
160    
161            public BookmarksEntryPersistence getBookmarksEntryPersistence() {
162                    return bookmarksEntryPersistence;
163            }
164    
165            public void setBookmarksEntryPersistence(
166                    BookmarksEntryPersistence bookmarksEntryPersistence) {
167                    this.bookmarksEntryPersistence = bookmarksEntryPersistence;
168            }
169    
170            public BookmarksEntryFinder getBookmarksEntryFinder() {
171                    return bookmarksEntryFinder;
172            }
173    
174            public void setBookmarksEntryFinder(
175                    BookmarksEntryFinder bookmarksEntryFinder) {
176                    this.bookmarksEntryFinder = bookmarksEntryFinder;
177            }
178    
179            public BookmarksFolderLocalService getBookmarksFolderLocalService() {
180                    return bookmarksFolderLocalService;
181            }
182    
183            public void setBookmarksFolderLocalService(
184                    BookmarksFolderLocalService bookmarksFolderLocalService) {
185                    this.bookmarksFolderLocalService = bookmarksFolderLocalService;
186            }
187    
188            public BookmarksFolderService getBookmarksFolderService() {
189                    return bookmarksFolderService;
190            }
191    
192            public void setBookmarksFolderService(
193                    BookmarksFolderService bookmarksFolderService) {
194                    this.bookmarksFolderService = bookmarksFolderService;
195            }
196    
197            public BookmarksFolderPersistence getBookmarksFolderPersistence() {
198                    return bookmarksFolderPersistence;
199            }
200    
201            public void setBookmarksFolderPersistence(
202                    BookmarksFolderPersistence bookmarksFolderPersistence) {
203                    this.bookmarksFolderPersistence = bookmarksFolderPersistence;
204            }
205    
206            public CounterLocalService getCounterLocalService() {
207                    return counterLocalService;
208            }
209    
210            public void setCounterLocalService(CounterLocalService counterLocalService) {
211                    this.counterLocalService = counterLocalService;
212            }
213    
214            public ResourceLocalService getResourceLocalService() {
215                    return resourceLocalService;
216            }
217    
218            public void setResourceLocalService(
219                    ResourceLocalService resourceLocalService) {
220                    this.resourceLocalService = resourceLocalService;
221            }
222    
223            public ResourceService getResourceService() {
224                    return resourceService;
225            }
226    
227            public void setResourceService(ResourceService resourceService) {
228                    this.resourceService = resourceService;
229            }
230    
231            public ResourcePersistence getResourcePersistence() {
232                    return resourcePersistence;
233            }
234    
235            public void setResourcePersistence(ResourcePersistence resourcePersistence) {
236                    this.resourcePersistence = resourcePersistence;
237            }
238    
239            public ResourceFinder getResourceFinder() {
240                    return resourceFinder;
241            }
242    
243            public void setResourceFinder(ResourceFinder resourceFinder) {
244                    this.resourceFinder = resourceFinder;
245            }
246    
247            public UserLocalService getUserLocalService() {
248                    return userLocalService;
249            }
250    
251            public void setUserLocalService(UserLocalService userLocalService) {
252                    this.userLocalService = userLocalService;
253            }
254    
255            public UserService getUserService() {
256                    return userService;
257            }
258    
259            public void setUserService(UserService userService) {
260                    this.userService = userService;
261            }
262    
263            public UserPersistence getUserPersistence() {
264                    return userPersistence;
265            }
266    
267            public void setUserPersistence(UserPersistence userPersistence) {
268                    this.userPersistence = userPersistence;
269            }
270    
271            public UserFinder getUserFinder() {
272                    return userFinder;
273            }
274    
275            public void setUserFinder(UserFinder userFinder) {
276                    this.userFinder = userFinder;
277            }
278    
279            public AssetEntryLocalService getAssetEntryLocalService() {
280                    return assetEntryLocalService;
281            }
282    
283            public void setAssetEntryLocalService(
284                    AssetEntryLocalService assetEntryLocalService) {
285                    this.assetEntryLocalService = assetEntryLocalService;
286            }
287    
288            public AssetEntryService getAssetEntryService() {
289                    return assetEntryService;
290            }
291    
292            public void setAssetEntryService(AssetEntryService assetEntryService) {
293                    this.assetEntryService = assetEntryService;
294            }
295    
296            public AssetEntryPersistence getAssetEntryPersistence() {
297                    return assetEntryPersistence;
298            }
299    
300            public void setAssetEntryPersistence(
301                    AssetEntryPersistence assetEntryPersistence) {
302                    this.assetEntryPersistence = assetEntryPersistence;
303            }
304    
305            public AssetEntryFinder getAssetEntryFinder() {
306                    return assetEntryFinder;
307            }
308    
309            public void setAssetEntryFinder(AssetEntryFinder assetEntryFinder) {
310                    this.assetEntryFinder = assetEntryFinder;
311            }
312    
313            public AssetTagLocalService getAssetTagLocalService() {
314                    return assetTagLocalService;
315            }
316    
317            public void setAssetTagLocalService(
318                    AssetTagLocalService assetTagLocalService) {
319                    this.assetTagLocalService = assetTagLocalService;
320            }
321    
322            public AssetTagService getAssetTagService() {
323                    return assetTagService;
324            }
325    
326            public void setAssetTagService(AssetTagService assetTagService) {
327                    this.assetTagService = assetTagService;
328            }
329    
330            public AssetTagPersistence getAssetTagPersistence() {
331                    return assetTagPersistence;
332            }
333    
334            public void setAssetTagPersistence(AssetTagPersistence assetTagPersistence) {
335                    this.assetTagPersistence = assetTagPersistence;
336            }
337    
338            public AssetTagFinder getAssetTagFinder() {
339                    return assetTagFinder;
340            }
341    
342            public void setAssetTagFinder(AssetTagFinder assetTagFinder) {
343                    this.assetTagFinder = assetTagFinder;
344            }
345    
346            public ExpandoValueLocalService getExpandoValueLocalService() {
347                    return expandoValueLocalService;
348            }
349    
350            public void setExpandoValueLocalService(
351                    ExpandoValueLocalService expandoValueLocalService) {
352                    this.expandoValueLocalService = expandoValueLocalService;
353            }
354    
355            public ExpandoValueService getExpandoValueService() {
356                    return expandoValueService;
357            }
358    
359            public void setExpandoValueService(ExpandoValueService expandoValueService) {
360                    this.expandoValueService = expandoValueService;
361            }
362    
363            public ExpandoValuePersistence getExpandoValuePersistence() {
364                    return expandoValuePersistence;
365            }
366    
367            public void setExpandoValuePersistence(
368                    ExpandoValuePersistence expandoValuePersistence) {
369                    this.expandoValuePersistence = expandoValuePersistence;
370            }
371    
372            protected void runSQL(String sql) throws SystemException {
373                    try {
374                            DataSource dataSource = bookmarksEntryPersistence.getDataSource();
375    
376                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
377                                            sql, new int[0]);
378    
379                            sqlUpdate.update();
380                    }
381                    catch (Exception e) {
382                            throw new SystemException(e);
383                    }
384            }
385    
386            @BeanReference(type = BookmarksEntryLocalService.class)
387            protected BookmarksEntryLocalService bookmarksEntryLocalService;
388            @BeanReference(type = BookmarksEntryService.class)
389            protected BookmarksEntryService bookmarksEntryService;
390            @BeanReference(type = BookmarksEntryPersistence.class)
391            protected BookmarksEntryPersistence bookmarksEntryPersistence;
392            @BeanReference(type = BookmarksEntryFinder.class)
393            protected BookmarksEntryFinder bookmarksEntryFinder;
394            @BeanReference(type = BookmarksFolderLocalService.class)
395            protected BookmarksFolderLocalService bookmarksFolderLocalService;
396            @BeanReference(type = BookmarksFolderService.class)
397            protected BookmarksFolderService bookmarksFolderService;
398            @BeanReference(type = BookmarksFolderPersistence.class)
399            protected BookmarksFolderPersistence bookmarksFolderPersistence;
400            @BeanReference(type = CounterLocalService.class)
401            protected CounterLocalService counterLocalService;
402            @BeanReference(type = ResourceLocalService.class)
403            protected ResourceLocalService resourceLocalService;
404            @BeanReference(type = ResourceService.class)
405            protected ResourceService resourceService;
406            @BeanReference(type = ResourcePersistence.class)
407            protected ResourcePersistence resourcePersistence;
408            @BeanReference(type = ResourceFinder.class)
409            protected ResourceFinder resourceFinder;
410            @BeanReference(type = UserLocalService.class)
411            protected UserLocalService userLocalService;
412            @BeanReference(type = UserService.class)
413            protected UserService userService;
414            @BeanReference(type = UserPersistence.class)
415            protected UserPersistence userPersistence;
416            @BeanReference(type = UserFinder.class)
417            protected UserFinder userFinder;
418            @BeanReference(type = AssetEntryLocalService.class)
419            protected AssetEntryLocalService assetEntryLocalService;
420            @BeanReference(type = AssetEntryService.class)
421            protected AssetEntryService assetEntryService;
422            @BeanReference(type = AssetEntryPersistence.class)
423            protected AssetEntryPersistence assetEntryPersistence;
424            @BeanReference(type = AssetEntryFinder.class)
425            protected AssetEntryFinder assetEntryFinder;
426            @BeanReference(type = AssetTagLocalService.class)
427            protected AssetTagLocalService assetTagLocalService;
428            @BeanReference(type = AssetTagService.class)
429            protected AssetTagService assetTagService;
430            @BeanReference(type = AssetTagPersistence.class)
431            protected AssetTagPersistence assetTagPersistence;
432            @BeanReference(type = AssetTagFinder.class)
433            protected AssetTagFinder assetTagFinder;
434            @BeanReference(type = ExpandoValueLocalService.class)
435            protected ExpandoValueLocalService expandoValueLocalService;
436            @BeanReference(type = ExpandoValueService.class)
437            protected ExpandoValueService expandoValueService;
438            @BeanReference(type = ExpandoValuePersistence.class)
439            protected ExpandoValuePersistence expandoValuePersistence;
440    }