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.wiki.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.wiki.model.WikiPageResource;
036    import com.liferay.portlet.wiki.service.WikiNodeLocalService;
037    import com.liferay.portlet.wiki.service.WikiNodeService;
038    import com.liferay.portlet.wiki.service.WikiPageLocalService;
039    import com.liferay.portlet.wiki.service.WikiPageResourceLocalService;
040    import com.liferay.portlet.wiki.service.WikiPageService;
041    import com.liferay.portlet.wiki.service.persistence.WikiNodePersistence;
042    import com.liferay.portlet.wiki.service.persistence.WikiPageFinder;
043    import com.liferay.portlet.wiki.service.persistence.WikiPagePersistence;
044    import com.liferay.portlet.wiki.service.persistence.WikiPageResourcePersistence;
045    
046    import java.util.List;
047    
048    import javax.sql.DataSource;
049    
050    /**
051     * The base implementation of the wiki page resource local service.
052     *
053     * <p>
054     * This implementation exists only as a container for the default service methods generated by ServiceBuilder. All custom service methods should be put in {@link com.liferay.portlet.wiki.service.impl.WikiPageResourceLocalServiceImpl}.
055     * </p>
056     *
057     * <p>
058     * Never modify or reference this class directly. Always use {@link com.liferay.portlet.wiki.service.WikiPageResourceLocalServiceUtil} to access the wiki page resource local service.
059     * </p>
060     *
061     * @author Brian Wing Shun Chan
062     * @see com.liferay.portlet.wiki.service.impl.WikiPageResourceLocalServiceImpl
063     * @see com.liferay.portlet.wiki.service.WikiPageResourceLocalServiceUtil
064     * @generated
065     */
066    public abstract class WikiPageResourceLocalServiceBaseImpl
067            implements WikiPageResourceLocalService {
068            /**
069             * Adds the wiki page resource to the database. Also notifies the appropriate model listeners.
070             *
071             * @param wikiPageResource the wiki page resource to add
072             * @return the wiki page resource that was added
073             * @throws SystemException if a system exception occurred
074             */
075            public WikiPageResource addWikiPageResource(
076                    WikiPageResource wikiPageResource) throws SystemException {
077                    wikiPageResource.setNew(true);
078    
079                    return wikiPageResourcePersistence.update(wikiPageResource, false);
080            }
081    
082            /**
083             * Creates a new wiki page resource with the primary key. Does not add the wiki page resource to the database.
084             *
085             * @param resourcePrimKey the primary key for the new wiki page resource
086             * @return the new wiki page resource
087             */
088            public WikiPageResource createWikiPageResource(long resourcePrimKey) {
089                    return wikiPageResourcePersistence.create(resourcePrimKey);
090            }
091    
092            /**
093             * Deletes the wiki page resource with the primary key from the database. Also notifies the appropriate model listeners.
094             *
095             * @param resourcePrimKey the primary key of the wiki page resource to delete
096             * @throws PortalException if a wiki page resource with the primary key could not be found
097             * @throws SystemException if a system exception occurred
098             */
099            public void deleteWikiPageResource(long resourcePrimKey)
100                    throws PortalException, SystemException {
101                    wikiPageResourcePersistence.remove(resourcePrimKey);
102            }
103    
104            /**
105             * Deletes the wiki page resource from the database. Also notifies the appropriate model listeners.
106             *
107             * @param wikiPageResource the wiki page resource to delete
108             * @throws SystemException if a system exception occurred
109             */
110            public void deleteWikiPageResource(WikiPageResource wikiPageResource)
111                    throws SystemException {
112                    wikiPageResourcePersistence.remove(wikiPageResource);
113            }
114    
115            /**
116             * Performs a dynamic query on the database and returns the matching rows.
117             *
118             * @param dynamicQuery the dynamic query to search with
119             * @return the matching rows
120             * @throws SystemException if a system exception occurred
121             */
122            @SuppressWarnings("rawtypes")
123            public List dynamicQuery(DynamicQuery dynamicQuery)
124                    throws SystemException {
125                    return wikiPageResourcePersistence.findWithDynamicQuery(dynamicQuery);
126            }
127    
128            /**
129             * Performs a dynamic query on the database and returns a range of the matching rows.
130             *
131             * <p>
132             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
133             * </p>
134             *
135             * @param dynamicQuery the dynamic query to search with
136             * @param start the lower bound of the range of model instances to return
137             * @param end the upper bound of the range of model instances to return (not inclusive)
138             * @return the range of matching rows
139             * @throws SystemException if a system exception occurred
140             */
141            @SuppressWarnings("rawtypes")
142            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
143                    throws SystemException {
144                    return wikiPageResourcePersistence.findWithDynamicQuery(dynamicQuery,
145                            start, end);
146            }
147    
148            /**
149             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
150             *
151             * <p>
152             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
153             * </p>
154             *
155             * @param dynamicQuery the dynamic query to search with
156             * @param start the lower bound of the range of model instances to return
157             * @param end the upper bound of the range of model instances to return (not inclusive)
158             * @param orderByComparator the comparator to order the results by
159             * @return the ordered range of matching rows
160             * @throws SystemException if a system exception occurred
161             */
162            @SuppressWarnings("rawtypes")
163            public List dynamicQuery(DynamicQuery dynamicQuery, int start, int end,
164                    OrderByComparator orderByComparator) throws SystemException {
165                    return wikiPageResourcePersistence.findWithDynamicQuery(dynamicQuery,
166                            start, end, orderByComparator);
167            }
168    
169            /**
170             * Counts the number of rows that match the dynamic query.
171             *
172             * @param dynamicQuery the dynamic query to search with
173             * @return the number of rows that match the dynamic query
174             * @throws SystemException if a system exception occurred
175             */
176            public long dynamicQueryCount(DynamicQuery dynamicQuery)
177                    throws SystemException {
178                    return wikiPageResourcePersistence.countWithDynamicQuery(dynamicQuery);
179            }
180    
181            /**
182             * Gets the wiki page resource with the primary key.
183             *
184             * @param resourcePrimKey the primary key of the wiki page resource to get
185             * @return the wiki page resource
186             * @throws PortalException if a wiki page resource with the primary key could not be found
187             * @throws SystemException if a system exception occurred
188             */
189            public WikiPageResource getWikiPageResource(long resourcePrimKey)
190                    throws PortalException, SystemException {
191                    return wikiPageResourcePersistence.findByPrimaryKey(resourcePrimKey);
192            }
193    
194            /**
195             * Gets a range of all the wiki page resources.
196             *
197             * <p>
198             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
199             * </p>
200             *
201             * @param start the lower bound of the range of wiki page resources to return
202             * @param end the upper bound of the range of wiki page resources to return (not inclusive)
203             * @return the range of wiki page resources
204             * @throws SystemException if a system exception occurred
205             */
206            public List<WikiPageResource> getWikiPageResources(int start, int end)
207                    throws SystemException {
208                    return wikiPageResourcePersistence.findAll(start, end);
209            }
210    
211            /**
212             * Gets the number of wiki page resources.
213             *
214             * @return the number of wiki page resources
215             * @throws SystemException if a system exception occurred
216             */
217            public int getWikiPageResourcesCount() throws SystemException {
218                    return wikiPageResourcePersistence.countAll();
219            }
220    
221            /**
222             * Updates the wiki page resource in the database. Also notifies the appropriate model listeners.
223             *
224             * @param wikiPageResource the wiki page resource to update
225             * @return the wiki page resource that was updated
226             * @throws SystemException if a system exception occurred
227             */
228            public WikiPageResource updateWikiPageResource(
229                    WikiPageResource wikiPageResource) throws SystemException {
230                    wikiPageResource.setNew(false);
231    
232                    return wikiPageResourcePersistence.update(wikiPageResource, true);
233            }
234    
235            /**
236             * Updates the wiki page resource in the database. Also notifies the appropriate model listeners.
237             *
238             * @param wikiPageResource the wiki page resource to update
239             * @param merge whether to merge the wiki page resource with the current session. See {@link com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean)} for an explanation.
240             * @return the wiki page resource that was updated
241             * @throws SystemException if a system exception occurred
242             */
243            public WikiPageResource updateWikiPageResource(
244                    WikiPageResource wikiPageResource, boolean merge)
245                    throws SystemException {
246                    wikiPageResource.setNew(false);
247    
248                    return wikiPageResourcePersistence.update(wikiPageResource, merge);
249            }
250    
251            /**
252             * Gets the wiki node local service.
253             *
254             * @return the wiki node local service
255             */
256            public WikiNodeLocalService getWikiNodeLocalService() {
257                    return wikiNodeLocalService;
258            }
259    
260            /**
261             * Sets the wiki node local service.
262             *
263             * @param wikiNodeLocalService the wiki node local service
264             */
265            public void setWikiNodeLocalService(
266                    WikiNodeLocalService wikiNodeLocalService) {
267                    this.wikiNodeLocalService = wikiNodeLocalService;
268            }
269    
270            /**
271             * Gets the wiki node remote service.
272             *
273             * @return the wiki node remote service
274             */
275            public WikiNodeService getWikiNodeService() {
276                    return wikiNodeService;
277            }
278    
279            /**
280             * Sets the wiki node remote service.
281             *
282             * @param wikiNodeService the wiki node remote service
283             */
284            public void setWikiNodeService(WikiNodeService wikiNodeService) {
285                    this.wikiNodeService = wikiNodeService;
286            }
287    
288            /**
289             * Gets the wiki node persistence.
290             *
291             * @return the wiki node persistence
292             */
293            public WikiNodePersistence getWikiNodePersistence() {
294                    return wikiNodePersistence;
295            }
296    
297            /**
298             * Sets the wiki node persistence.
299             *
300             * @param wikiNodePersistence the wiki node persistence
301             */
302            public void setWikiNodePersistence(WikiNodePersistence wikiNodePersistence) {
303                    this.wikiNodePersistence = wikiNodePersistence;
304            }
305    
306            /**
307             * Gets the wiki page local service.
308             *
309             * @return the wiki page local service
310             */
311            public WikiPageLocalService getWikiPageLocalService() {
312                    return wikiPageLocalService;
313            }
314    
315            /**
316             * Sets the wiki page local service.
317             *
318             * @param wikiPageLocalService the wiki page local service
319             */
320            public void setWikiPageLocalService(
321                    WikiPageLocalService wikiPageLocalService) {
322                    this.wikiPageLocalService = wikiPageLocalService;
323            }
324    
325            /**
326             * Gets the wiki page remote service.
327             *
328             * @return the wiki page remote service
329             */
330            public WikiPageService getWikiPageService() {
331                    return wikiPageService;
332            }
333    
334            /**
335             * Sets the wiki page remote service.
336             *
337             * @param wikiPageService the wiki page remote service
338             */
339            public void setWikiPageService(WikiPageService wikiPageService) {
340                    this.wikiPageService = wikiPageService;
341            }
342    
343            /**
344             * Gets the wiki page persistence.
345             *
346             * @return the wiki page persistence
347             */
348            public WikiPagePersistence getWikiPagePersistence() {
349                    return wikiPagePersistence;
350            }
351    
352            /**
353             * Sets the wiki page persistence.
354             *
355             * @param wikiPagePersistence the wiki page persistence
356             */
357            public void setWikiPagePersistence(WikiPagePersistence wikiPagePersistence) {
358                    this.wikiPagePersistence = wikiPagePersistence;
359            }
360    
361            /**
362             * Gets the wiki page finder.
363             *
364             * @return the wiki page finder
365             */
366            public WikiPageFinder getWikiPageFinder() {
367                    return wikiPageFinder;
368            }
369    
370            /**
371             * Sets the wiki page finder.
372             *
373             * @param wikiPageFinder the wiki page finder
374             */
375            public void setWikiPageFinder(WikiPageFinder wikiPageFinder) {
376                    this.wikiPageFinder = wikiPageFinder;
377            }
378    
379            /**
380             * Gets the wiki page resource local service.
381             *
382             * @return the wiki page resource local service
383             */
384            public WikiPageResourceLocalService getWikiPageResourceLocalService() {
385                    return wikiPageResourceLocalService;
386            }
387    
388            /**
389             * Sets the wiki page resource local service.
390             *
391             * @param wikiPageResourceLocalService the wiki page resource local service
392             */
393            public void setWikiPageResourceLocalService(
394                    WikiPageResourceLocalService wikiPageResourceLocalService) {
395                    this.wikiPageResourceLocalService = wikiPageResourceLocalService;
396            }
397    
398            /**
399             * Gets the wiki page resource persistence.
400             *
401             * @return the wiki page resource persistence
402             */
403            public WikiPageResourcePersistence getWikiPageResourcePersistence() {
404                    return wikiPageResourcePersistence;
405            }
406    
407            /**
408             * Sets the wiki page resource persistence.
409             *
410             * @param wikiPageResourcePersistence the wiki page resource persistence
411             */
412            public void setWikiPageResourcePersistence(
413                    WikiPageResourcePersistence wikiPageResourcePersistence) {
414                    this.wikiPageResourcePersistence = wikiPageResourcePersistence;
415            }
416    
417            /**
418             * Gets the counter local service.
419             *
420             * @return the counter local service
421             */
422            public CounterLocalService getCounterLocalService() {
423                    return counterLocalService;
424            }
425    
426            /**
427             * Sets the counter local service.
428             *
429             * @param counterLocalService the counter local service
430             */
431            public void setCounterLocalService(CounterLocalService counterLocalService) {
432                    this.counterLocalService = counterLocalService;
433            }
434    
435            /**
436             * Gets the resource local service.
437             *
438             * @return the resource local service
439             */
440            public ResourceLocalService getResourceLocalService() {
441                    return resourceLocalService;
442            }
443    
444            /**
445             * Sets the resource local service.
446             *
447             * @param resourceLocalService the resource local service
448             */
449            public void setResourceLocalService(
450                    ResourceLocalService resourceLocalService) {
451                    this.resourceLocalService = resourceLocalService;
452            }
453    
454            /**
455             * Gets the resource remote service.
456             *
457             * @return the resource remote service
458             */
459            public ResourceService getResourceService() {
460                    return resourceService;
461            }
462    
463            /**
464             * Sets the resource remote service.
465             *
466             * @param resourceService the resource remote service
467             */
468            public void setResourceService(ResourceService resourceService) {
469                    this.resourceService = resourceService;
470            }
471    
472            /**
473             * Gets the resource persistence.
474             *
475             * @return the resource persistence
476             */
477            public ResourcePersistence getResourcePersistence() {
478                    return resourcePersistence;
479            }
480    
481            /**
482             * Sets the resource persistence.
483             *
484             * @param resourcePersistence the resource persistence
485             */
486            public void setResourcePersistence(ResourcePersistence resourcePersistence) {
487                    this.resourcePersistence = resourcePersistence;
488            }
489    
490            /**
491             * Gets the resource finder.
492             *
493             * @return the resource finder
494             */
495            public ResourceFinder getResourceFinder() {
496                    return resourceFinder;
497            }
498    
499            /**
500             * Sets the resource finder.
501             *
502             * @param resourceFinder the resource finder
503             */
504            public void setResourceFinder(ResourceFinder resourceFinder) {
505                    this.resourceFinder = resourceFinder;
506            }
507    
508            /**
509             * Gets the user local service.
510             *
511             * @return the user local service
512             */
513            public UserLocalService getUserLocalService() {
514                    return userLocalService;
515            }
516    
517            /**
518             * Sets the user local service.
519             *
520             * @param userLocalService the user local service
521             */
522            public void setUserLocalService(UserLocalService userLocalService) {
523                    this.userLocalService = userLocalService;
524            }
525    
526            /**
527             * Gets the user remote service.
528             *
529             * @return the user remote service
530             */
531            public UserService getUserService() {
532                    return userService;
533            }
534    
535            /**
536             * Sets the user remote service.
537             *
538             * @param userService the user remote service
539             */
540            public void setUserService(UserService userService) {
541                    this.userService = userService;
542            }
543    
544            /**
545             * Gets the user persistence.
546             *
547             * @return the user persistence
548             */
549            public UserPersistence getUserPersistence() {
550                    return userPersistence;
551            }
552    
553            /**
554             * Sets the user persistence.
555             *
556             * @param userPersistence the user persistence
557             */
558            public void setUserPersistence(UserPersistence userPersistence) {
559                    this.userPersistence = userPersistence;
560            }
561    
562            /**
563             * Gets the user finder.
564             *
565             * @return the user finder
566             */
567            public UserFinder getUserFinder() {
568                    return userFinder;
569            }
570    
571            /**
572             * Sets the user finder.
573             *
574             * @param userFinder the user finder
575             */
576            public void setUserFinder(UserFinder userFinder) {
577                    this.userFinder = userFinder;
578            }
579    
580            /**
581             * Performs an SQL query.
582             *
583             * @param sql the sql query to perform
584             */
585            protected void runSQL(String sql) throws SystemException {
586                    try {
587                            DataSource dataSource = wikiPageResourcePersistence.getDataSource();
588    
589                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
590                                            sql, new int[0]);
591    
592                            sqlUpdate.update();
593                    }
594                    catch (Exception e) {
595                            throw new SystemException(e);
596                    }
597            }
598    
599            @BeanReference(type = WikiNodeLocalService.class)
600            protected WikiNodeLocalService wikiNodeLocalService;
601            @BeanReference(type = WikiNodeService.class)
602            protected WikiNodeService wikiNodeService;
603            @BeanReference(type = WikiNodePersistence.class)
604            protected WikiNodePersistence wikiNodePersistence;
605            @BeanReference(type = WikiPageLocalService.class)
606            protected WikiPageLocalService wikiPageLocalService;
607            @BeanReference(type = WikiPageService.class)
608            protected WikiPageService wikiPageService;
609            @BeanReference(type = WikiPagePersistence.class)
610            protected WikiPagePersistence wikiPagePersistence;
611            @BeanReference(type = WikiPageFinder.class)
612            protected WikiPageFinder wikiPageFinder;
613            @BeanReference(type = WikiPageResourceLocalService.class)
614            protected WikiPageResourceLocalService wikiPageResourceLocalService;
615            @BeanReference(type = WikiPageResourcePersistence.class)
616            protected WikiPageResourcePersistence wikiPageResourcePersistence;
617            @BeanReference(type = CounterLocalService.class)
618            protected CounterLocalService counterLocalService;
619            @BeanReference(type = ResourceLocalService.class)
620            protected ResourceLocalService resourceLocalService;
621            @BeanReference(type = ResourceService.class)
622            protected ResourceService resourceService;
623            @BeanReference(type = ResourcePersistence.class)
624            protected ResourcePersistence resourcePersistence;
625            @BeanReference(type = ResourceFinder.class)
626            protected ResourceFinder resourceFinder;
627            @BeanReference(type = UserLocalService.class)
628            protected UserLocalService userLocalService;
629            @BeanReference(type = UserService.class)
630            protected UserService userService;
631            @BeanReference(type = UserPersistence.class)
632            protected UserPersistence userPersistence;
633            @BeanReference(type = UserFinder.class)
634            protected UserFinder userFinder;
635    }