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