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.asset.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.model.AssetLink;
036    import com.liferay.portlet.asset.service.AssetCategoryLocalService;
037    import com.liferay.portlet.asset.service.AssetCategoryPropertyLocalService;
038    import com.liferay.portlet.asset.service.AssetCategoryPropertyService;
039    import com.liferay.portlet.asset.service.AssetCategoryService;
040    import com.liferay.portlet.asset.service.AssetEntryLocalService;
041    import com.liferay.portlet.asset.service.AssetEntryService;
042    import com.liferay.portlet.asset.service.AssetLinkLocalService;
043    import com.liferay.portlet.asset.service.AssetTagLocalService;
044    import com.liferay.portlet.asset.service.AssetTagPropertyLocalService;
045    import com.liferay.portlet.asset.service.AssetTagPropertyService;
046    import com.liferay.portlet.asset.service.AssetTagService;
047    import com.liferay.portlet.asset.service.AssetTagStatsLocalService;
048    import com.liferay.portlet.asset.service.AssetVocabularyLocalService;
049    import com.liferay.portlet.asset.service.AssetVocabularyService;
050    import com.liferay.portlet.asset.service.persistence.AssetCategoryFinder;
051    import com.liferay.portlet.asset.service.persistence.AssetCategoryPersistence;
052    import com.liferay.portlet.asset.service.persistence.AssetCategoryPropertyFinder;
053    import com.liferay.portlet.asset.service.persistence.AssetCategoryPropertyPersistence;
054    import com.liferay.portlet.asset.service.persistence.AssetEntryFinder;
055    import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
056    import com.liferay.portlet.asset.service.persistence.AssetLinkPersistence;
057    import com.liferay.portlet.asset.service.persistence.AssetTagFinder;
058    import com.liferay.portlet.asset.service.persistence.AssetTagPersistence;
059    import com.liferay.portlet.asset.service.persistence.AssetTagPropertyFinder;
060    import com.liferay.portlet.asset.service.persistence.AssetTagPropertyKeyFinder;
061    import com.liferay.portlet.asset.service.persistence.AssetTagPropertyPersistence;
062    import com.liferay.portlet.asset.service.persistence.AssetTagStatsPersistence;
063    import com.liferay.portlet.asset.service.persistence.AssetVocabularyPersistence;
064    
065    import java.util.List;
066    
067    import javax.sql.DataSource;
068    
069    /**
070     * @author Brian Wing Shun Chan
071     */
072    public abstract class AssetLinkLocalServiceBaseImpl
073            implements AssetLinkLocalService {
074            public AssetLink addAssetLink(AssetLink assetLink)
075                    throws SystemException {
076                    assetLink.setNew(true);
077    
078                    return assetLinkPersistence.update(assetLink, false);
079            }
080    
081            public AssetLink createAssetLink(long linkId) {
082                    return assetLinkPersistence.create(linkId);
083            }
084    
085            public void deleteAssetLink(long linkId)
086                    throws PortalException, SystemException {
087                    assetLinkPersistence.remove(linkId);
088            }
089    
090            public void deleteAssetLink(AssetLink assetLink) throws SystemException {
091                    assetLinkPersistence.remove(assetLink);
092            }
093    
094            @SuppressWarnings("unchecked")
095            public List dynamicQuery(DynamicQuery dynamicQuery)
096                    throws SystemException {
097                    return assetLinkPersistence.findWithDynamicQuery(dynamicQuery);
098            }
099    
100            @SuppressWarnings("unchecked")
101            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
102                    throws SystemException {
103                    return assetLinkPersistence.findWithDynamicQuery(dynamicQuery, start,
104                            end);
105            }
106    
107            @SuppressWarnings("unchecked")
108            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
109                    OrderByComparator orderByComparator) throws SystemException {
110                    return assetLinkPersistence.findWithDynamicQuery(dynamicQuery, start,
111                            end, orderByComparator);
112            }
113    
114            public long dynamicQueryCount(DynamicQuery dynamicQuery)
115                    throws SystemException {
116                    return assetLinkPersistence.countWithDynamicQuery(dynamicQuery);
117            }
118    
119            public AssetLink getAssetLink(long linkId)
120                    throws PortalException, SystemException {
121                    return assetLinkPersistence.findByPrimaryKey(linkId);
122            }
123    
124            public List<AssetLink> getAssetLinks(int start, int end)
125                    throws SystemException {
126                    return assetLinkPersistence.findAll(start, end);
127            }
128    
129            public int getAssetLinksCount() throws SystemException {
130                    return assetLinkPersistence.countAll();
131            }
132    
133            public AssetLink updateAssetLink(AssetLink assetLink)
134                    throws SystemException {
135                    assetLink.setNew(false);
136    
137                    return assetLinkPersistence.update(assetLink, true);
138            }
139    
140            public AssetLink updateAssetLink(AssetLink assetLink, boolean merge)
141                    throws SystemException {
142                    assetLink.setNew(false);
143    
144                    return assetLinkPersistence.update(assetLink, merge);
145            }
146    
147            public AssetCategoryLocalService getAssetCategoryLocalService() {
148                    return assetCategoryLocalService;
149            }
150    
151            public void setAssetCategoryLocalService(
152                    AssetCategoryLocalService assetCategoryLocalService) {
153                    this.assetCategoryLocalService = assetCategoryLocalService;
154            }
155    
156            public AssetCategoryService getAssetCategoryService() {
157                    return assetCategoryService;
158            }
159    
160            public void setAssetCategoryService(
161                    AssetCategoryService assetCategoryService) {
162                    this.assetCategoryService = assetCategoryService;
163            }
164    
165            public AssetCategoryPersistence getAssetCategoryPersistence() {
166                    return assetCategoryPersistence;
167            }
168    
169            public void setAssetCategoryPersistence(
170                    AssetCategoryPersistence assetCategoryPersistence) {
171                    this.assetCategoryPersistence = assetCategoryPersistence;
172            }
173    
174            public AssetCategoryFinder getAssetCategoryFinder() {
175                    return assetCategoryFinder;
176            }
177    
178            public void setAssetCategoryFinder(AssetCategoryFinder assetCategoryFinder) {
179                    this.assetCategoryFinder = assetCategoryFinder;
180            }
181    
182            public AssetCategoryPropertyLocalService getAssetCategoryPropertyLocalService() {
183                    return assetCategoryPropertyLocalService;
184            }
185    
186            public void setAssetCategoryPropertyLocalService(
187                    AssetCategoryPropertyLocalService assetCategoryPropertyLocalService) {
188                    this.assetCategoryPropertyLocalService = assetCategoryPropertyLocalService;
189            }
190    
191            public AssetCategoryPropertyService getAssetCategoryPropertyService() {
192                    return assetCategoryPropertyService;
193            }
194    
195            public void setAssetCategoryPropertyService(
196                    AssetCategoryPropertyService assetCategoryPropertyService) {
197                    this.assetCategoryPropertyService = assetCategoryPropertyService;
198            }
199    
200            public AssetCategoryPropertyPersistence getAssetCategoryPropertyPersistence() {
201                    return assetCategoryPropertyPersistence;
202            }
203    
204            public void setAssetCategoryPropertyPersistence(
205                    AssetCategoryPropertyPersistence assetCategoryPropertyPersistence) {
206                    this.assetCategoryPropertyPersistence = assetCategoryPropertyPersistence;
207            }
208    
209            public AssetCategoryPropertyFinder getAssetCategoryPropertyFinder() {
210                    return assetCategoryPropertyFinder;
211            }
212    
213            public void setAssetCategoryPropertyFinder(
214                    AssetCategoryPropertyFinder assetCategoryPropertyFinder) {
215                    this.assetCategoryPropertyFinder = assetCategoryPropertyFinder;
216            }
217    
218            public AssetEntryLocalService getAssetEntryLocalService() {
219                    return assetEntryLocalService;
220            }
221    
222            public void setAssetEntryLocalService(
223                    AssetEntryLocalService assetEntryLocalService) {
224                    this.assetEntryLocalService = assetEntryLocalService;
225            }
226    
227            public AssetEntryService getAssetEntryService() {
228                    return assetEntryService;
229            }
230    
231            public void setAssetEntryService(AssetEntryService assetEntryService) {
232                    this.assetEntryService = assetEntryService;
233            }
234    
235            public AssetEntryPersistence getAssetEntryPersistence() {
236                    return assetEntryPersistence;
237            }
238    
239            public void setAssetEntryPersistence(
240                    AssetEntryPersistence assetEntryPersistence) {
241                    this.assetEntryPersistence = assetEntryPersistence;
242            }
243    
244            public AssetEntryFinder getAssetEntryFinder() {
245                    return assetEntryFinder;
246            }
247    
248            public void setAssetEntryFinder(AssetEntryFinder assetEntryFinder) {
249                    this.assetEntryFinder = assetEntryFinder;
250            }
251    
252            public AssetLinkLocalService getAssetLinkLocalService() {
253                    return assetLinkLocalService;
254            }
255    
256            public void setAssetLinkLocalService(
257                    AssetLinkLocalService assetLinkLocalService) {
258                    this.assetLinkLocalService = assetLinkLocalService;
259            }
260    
261            public AssetLinkPersistence getAssetLinkPersistence() {
262                    return assetLinkPersistence;
263            }
264    
265            public void setAssetLinkPersistence(
266                    AssetLinkPersistence assetLinkPersistence) {
267                    this.assetLinkPersistence = assetLinkPersistence;
268            }
269    
270            public AssetTagLocalService getAssetTagLocalService() {
271                    return assetTagLocalService;
272            }
273    
274            public void setAssetTagLocalService(
275                    AssetTagLocalService assetTagLocalService) {
276                    this.assetTagLocalService = assetTagLocalService;
277            }
278    
279            public AssetTagService getAssetTagService() {
280                    return assetTagService;
281            }
282    
283            public void setAssetTagService(AssetTagService assetTagService) {
284                    this.assetTagService = assetTagService;
285            }
286    
287            public AssetTagPersistence getAssetTagPersistence() {
288                    return assetTagPersistence;
289            }
290    
291            public void setAssetTagPersistence(AssetTagPersistence assetTagPersistence) {
292                    this.assetTagPersistence = assetTagPersistence;
293            }
294    
295            public AssetTagFinder getAssetTagFinder() {
296                    return assetTagFinder;
297            }
298    
299            public void setAssetTagFinder(AssetTagFinder assetTagFinder) {
300                    this.assetTagFinder = assetTagFinder;
301            }
302    
303            public AssetTagPropertyLocalService getAssetTagPropertyLocalService() {
304                    return assetTagPropertyLocalService;
305            }
306    
307            public void setAssetTagPropertyLocalService(
308                    AssetTagPropertyLocalService assetTagPropertyLocalService) {
309                    this.assetTagPropertyLocalService = assetTagPropertyLocalService;
310            }
311    
312            public AssetTagPropertyService getAssetTagPropertyService() {
313                    return assetTagPropertyService;
314            }
315    
316            public void setAssetTagPropertyService(
317                    AssetTagPropertyService assetTagPropertyService) {
318                    this.assetTagPropertyService = assetTagPropertyService;
319            }
320    
321            public AssetTagPropertyPersistence getAssetTagPropertyPersistence() {
322                    return assetTagPropertyPersistence;
323            }
324    
325            public void setAssetTagPropertyPersistence(
326                    AssetTagPropertyPersistence assetTagPropertyPersistence) {
327                    this.assetTagPropertyPersistence = assetTagPropertyPersistence;
328            }
329    
330            public AssetTagPropertyFinder getAssetTagPropertyFinder() {
331                    return assetTagPropertyFinder;
332            }
333    
334            public void setAssetTagPropertyFinder(
335                    AssetTagPropertyFinder assetTagPropertyFinder) {
336                    this.assetTagPropertyFinder = assetTagPropertyFinder;
337            }
338    
339            public AssetTagPropertyKeyFinder getAssetTagPropertyKeyFinder() {
340                    return assetTagPropertyKeyFinder;
341            }
342    
343            public void setAssetTagPropertyKeyFinder(
344                    AssetTagPropertyKeyFinder assetTagPropertyKeyFinder) {
345                    this.assetTagPropertyKeyFinder = assetTagPropertyKeyFinder;
346            }
347    
348            public AssetTagStatsLocalService getAssetTagStatsLocalService() {
349                    return assetTagStatsLocalService;
350            }
351    
352            public void setAssetTagStatsLocalService(
353                    AssetTagStatsLocalService assetTagStatsLocalService) {
354                    this.assetTagStatsLocalService = assetTagStatsLocalService;
355            }
356    
357            public AssetTagStatsPersistence getAssetTagStatsPersistence() {
358                    return assetTagStatsPersistence;
359            }
360    
361            public void setAssetTagStatsPersistence(
362                    AssetTagStatsPersistence assetTagStatsPersistence) {
363                    this.assetTagStatsPersistence = assetTagStatsPersistence;
364            }
365    
366            public AssetVocabularyLocalService getAssetVocabularyLocalService() {
367                    return assetVocabularyLocalService;
368            }
369    
370            public void setAssetVocabularyLocalService(
371                    AssetVocabularyLocalService assetVocabularyLocalService) {
372                    this.assetVocabularyLocalService = assetVocabularyLocalService;
373            }
374    
375            public AssetVocabularyService getAssetVocabularyService() {
376                    return assetVocabularyService;
377            }
378    
379            public void setAssetVocabularyService(
380                    AssetVocabularyService assetVocabularyService) {
381                    this.assetVocabularyService = assetVocabularyService;
382            }
383    
384            public AssetVocabularyPersistence getAssetVocabularyPersistence() {
385                    return assetVocabularyPersistence;
386            }
387    
388            public void setAssetVocabularyPersistence(
389                    AssetVocabularyPersistence assetVocabularyPersistence) {
390                    this.assetVocabularyPersistence = assetVocabularyPersistence;
391            }
392    
393            public CounterLocalService getCounterLocalService() {
394                    return counterLocalService;
395            }
396    
397            public void setCounterLocalService(CounterLocalService counterLocalService) {
398                    this.counterLocalService = counterLocalService;
399            }
400    
401            public ResourceLocalService getResourceLocalService() {
402                    return resourceLocalService;
403            }
404    
405            public void setResourceLocalService(
406                    ResourceLocalService resourceLocalService) {
407                    this.resourceLocalService = resourceLocalService;
408            }
409    
410            public ResourceService getResourceService() {
411                    return resourceService;
412            }
413    
414            public void setResourceService(ResourceService resourceService) {
415                    this.resourceService = resourceService;
416            }
417    
418            public ResourcePersistence getResourcePersistence() {
419                    return resourcePersistence;
420            }
421    
422            public void setResourcePersistence(ResourcePersistence resourcePersistence) {
423                    this.resourcePersistence = resourcePersistence;
424            }
425    
426            public ResourceFinder getResourceFinder() {
427                    return resourceFinder;
428            }
429    
430            public void setResourceFinder(ResourceFinder resourceFinder) {
431                    this.resourceFinder = resourceFinder;
432            }
433    
434            public UserLocalService getUserLocalService() {
435                    return userLocalService;
436            }
437    
438            public void setUserLocalService(UserLocalService userLocalService) {
439                    this.userLocalService = userLocalService;
440            }
441    
442            public UserService getUserService() {
443                    return userService;
444            }
445    
446            public void setUserService(UserService userService) {
447                    this.userService = userService;
448            }
449    
450            public UserPersistence getUserPersistence() {
451                    return userPersistence;
452            }
453    
454            public void setUserPersistence(UserPersistence userPersistence) {
455                    this.userPersistence = userPersistence;
456            }
457    
458            public UserFinder getUserFinder() {
459                    return userFinder;
460            }
461    
462            public void setUserFinder(UserFinder userFinder) {
463                    this.userFinder = userFinder;
464            }
465    
466            protected void runSQL(String sql) throws SystemException {
467                    try {
468                            DataSource dataSource = assetLinkPersistence.getDataSource();
469    
470                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
471                                            sql, new int[0]);
472    
473                            sqlUpdate.update();
474                    }
475                    catch (Exception e) {
476                            throw new SystemException(e);
477                    }
478            }
479    
480            @BeanReference(type = AssetCategoryLocalService.class)
481            protected AssetCategoryLocalService assetCategoryLocalService;
482            @BeanReference(type = AssetCategoryService.class)
483            protected AssetCategoryService assetCategoryService;
484            @BeanReference(type = AssetCategoryPersistence.class)
485            protected AssetCategoryPersistence assetCategoryPersistence;
486            @BeanReference(type = AssetCategoryFinder.class)
487            protected AssetCategoryFinder assetCategoryFinder;
488            @BeanReference(type = AssetCategoryPropertyLocalService.class)
489            protected AssetCategoryPropertyLocalService assetCategoryPropertyLocalService;
490            @BeanReference(type = AssetCategoryPropertyService.class)
491            protected AssetCategoryPropertyService assetCategoryPropertyService;
492            @BeanReference(type = AssetCategoryPropertyPersistence.class)
493            protected AssetCategoryPropertyPersistence assetCategoryPropertyPersistence;
494            @BeanReference(type = AssetCategoryPropertyFinder.class)
495            protected AssetCategoryPropertyFinder assetCategoryPropertyFinder;
496            @BeanReference(type = AssetEntryLocalService.class)
497            protected AssetEntryLocalService assetEntryLocalService;
498            @BeanReference(type = AssetEntryService.class)
499            protected AssetEntryService assetEntryService;
500            @BeanReference(type = AssetEntryPersistence.class)
501            protected AssetEntryPersistence assetEntryPersistence;
502            @BeanReference(type = AssetEntryFinder.class)
503            protected AssetEntryFinder assetEntryFinder;
504            @BeanReference(type = AssetLinkLocalService.class)
505            protected AssetLinkLocalService assetLinkLocalService;
506            @BeanReference(type = AssetLinkPersistence.class)
507            protected AssetLinkPersistence assetLinkPersistence;
508            @BeanReference(type = AssetTagLocalService.class)
509            protected AssetTagLocalService assetTagLocalService;
510            @BeanReference(type = AssetTagService.class)
511            protected AssetTagService assetTagService;
512            @BeanReference(type = AssetTagPersistence.class)
513            protected AssetTagPersistence assetTagPersistence;
514            @BeanReference(type = AssetTagFinder.class)
515            protected AssetTagFinder assetTagFinder;
516            @BeanReference(type = AssetTagPropertyLocalService.class)
517            protected AssetTagPropertyLocalService assetTagPropertyLocalService;
518            @BeanReference(type = AssetTagPropertyService.class)
519            protected AssetTagPropertyService assetTagPropertyService;
520            @BeanReference(type = AssetTagPropertyPersistence.class)
521            protected AssetTagPropertyPersistence assetTagPropertyPersistence;
522            @BeanReference(type = AssetTagPropertyFinder.class)
523            protected AssetTagPropertyFinder assetTagPropertyFinder;
524            @BeanReference(type = AssetTagPropertyKeyFinder.class)
525            protected AssetTagPropertyKeyFinder assetTagPropertyKeyFinder;
526            @BeanReference(type = AssetTagStatsLocalService.class)
527            protected AssetTagStatsLocalService assetTagStatsLocalService;
528            @BeanReference(type = AssetTagStatsPersistence.class)
529            protected AssetTagStatsPersistence assetTagStatsPersistence;
530            @BeanReference(type = AssetVocabularyLocalService.class)
531            protected AssetVocabularyLocalService assetVocabularyLocalService;
532            @BeanReference(type = AssetVocabularyService.class)
533            protected AssetVocabularyService assetVocabularyService;
534            @BeanReference(type = AssetVocabularyPersistence.class)
535            protected AssetVocabularyPersistence assetVocabularyPersistence;
536            @BeanReference(type = CounterLocalService.class)
537            protected CounterLocalService counterLocalService;
538            @BeanReference(type = ResourceLocalService.class)
539            protected ResourceLocalService resourceLocalService;
540            @BeanReference(type = ResourceService.class)
541            protected ResourceService resourceService;
542            @BeanReference(type = ResourcePersistence.class)
543            protected ResourcePersistence resourcePersistence;
544            @BeanReference(type = ResourceFinder.class)
545            protected ResourceFinder resourceFinder;
546            @BeanReference(type = UserLocalService.class)
547            protected UserLocalService userLocalService;
548            @BeanReference(type = UserService.class)
549            protected UserService userService;
550            @BeanReference(type = UserPersistence.class)
551            protected UserPersistence userPersistence;
552            @BeanReference(type = UserFinder.class)
553            protected UserFinder userFinder;
554    }