001    /**
002     * Copyright (c) 2000-present 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.portal.service.base;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.BeanReference;
020    import com.liferay.portal.kernel.bean.IdentifiableBean;
021    import com.liferay.portal.kernel.dao.db.DB;
022    import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
023    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
024    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
025    import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
026    import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery;
027    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
028    import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
029    import com.liferay.portal.kernel.dao.orm.Projection;
030    import com.liferay.portal.kernel.exception.PortalException;
031    import com.liferay.portal.kernel.exception.SystemException;
032    import com.liferay.portal.kernel.search.Indexable;
033    import com.liferay.portal.kernel.search.IndexableType;
034    import com.liferay.portal.kernel.util.OrderByComparator;
035    import com.liferay.portal.model.PersistedModel;
036    import com.liferay.portal.model.Portlet;
037    import com.liferay.portal.service.BaseLocalServiceImpl;
038    import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
039    import com.liferay.portal.service.PortletLocalService;
040    import com.liferay.portal.service.persistence.PortletPersistence;
041    import com.liferay.portal.service.persistence.PortletPreferencesFinder;
042    import com.liferay.portal.service.persistence.PortletPreferencesPersistence;
043    import com.liferay.portal.service.persistence.ResourceActionPersistence;
044    import com.liferay.portal.service.persistence.ResourceBlockFinder;
045    import com.liferay.portal.service.persistence.ResourceBlockPersistence;
046    import com.liferay.portal.service.persistence.ResourcePermissionFinder;
047    import com.liferay.portal.service.persistence.ResourcePermissionPersistence;
048    import com.liferay.portal.service.persistence.RoleFinder;
049    import com.liferay.portal.service.persistence.RolePersistence;
050    import com.liferay.portal.util.PortalUtil;
051    
052    import java.io.Serializable;
053    
054    import java.util.List;
055    
056    import javax.sql.DataSource;
057    
058    /**
059     * Provides the base implementation for the portlet local service.
060     *
061     * <p>
062     * 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.portal.service.impl.PortletLocalServiceImpl}.
063     * </p>
064     *
065     * @author Brian Wing Shun Chan
066     * @see com.liferay.portal.service.impl.PortletLocalServiceImpl
067     * @see com.liferay.portal.service.PortletLocalServiceUtil
068     * @generated
069     */
070    @ProviderType
071    public abstract class PortletLocalServiceBaseImpl extends BaseLocalServiceImpl
072            implements PortletLocalService, IdentifiableBean {
073            /*
074             * NOTE FOR DEVELOPERS:
075             *
076             * Never modify or reference this class directly. Always use {@link com.liferay.portal.service.PortletLocalServiceUtil} to access the portlet local service.
077             */
078    
079            /**
080             * Adds the portlet to the database. Also notifies the appropriate model listeners.
081             *
082             * @param portlet the portlet
083             * @return the portlet that was added
084             */
085            @Indexable(type = IndexableType.REINDEX)
086            @Override
087            public Portlet addPortlet(Portlet portlet) {
088                    portlet.setNew(true);
089    
090                    return portletPersistence.update(portlet);
091            }
092    
093            /**
094             * Creates a new portlet with the primary key. Does not add the portlet to the database.
095             *
096             * @param id the primary key for the new portlet
097             * @return the new portlet
098             */
099            @Override
100            public Portlet createPortlet(long id) {
101                    return portletPersistence.create(id);
102            }
103    
104            /**
105             * Deletes the portlet with the primary key from the database. Also notifies the appropriate model listeners.
106             *
107             * @param id the primary key of the portlet
108             * @return the portlet that was removed
109             * @throws PortalException if a portlet with the primary key could not be found
110             */
111            @Indexable(type = IndexableType.DELETE)
112            @Override
113            public Portlet deletePortlet(long id) throws PortalException {
114                    return portletPersistence.remove(id);
115            }
116    
117            /**
118             * Deletes the portlet from the database. Also notifies the appropriate model listeners.
119             *
120             * @param portlet the portlet
121             * @return the portlet that was removed
122             */
123            @Indexable(type = IndexableType.DELETE)
124            @Override
125            public Portlet deletePortlet(Portlet portlet) {
126                    return portletPersistence.remove(portlet);
127            }
128    
129            @Override
130            public DynamicQuery dynamicQuery() {
131                    Class<?> clazz = getClass();
132    
133                    return DynamicQueryFactoryUtil.forClass(Portlet.class,
134                            clazz.getClassLoader());
135            }
136    
137            /**
138             * Performs a dynamic query on the database and returns the matching rows.
139             *
140             * @param dynamicQuery the dynamic query
141             * @return the matching rows
142             */
143            @Override
144            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
145                    return portletPersistence.findWithDynamicQuery(dynamicQuery);
146            }
147    
148            /**
149             * Performs a dynamic query on the database and returns a 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. 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.portal.model.impl.PortletModelImpl}. 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.
153             * </p>
154             *
155             * @param dynamicQuery the dynamic query
156             * @param start the lower bound of the range of model instances
157             * @param end the upper bound of the range of model instances (not inclusive)
158             * @return the range of matching rows
159             */
160            @Override
161            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
162                    int end) {
163                    return portletPersistence.findWithDynamicQuery(dynamicQuery, start, end);
164            }
165    
166            /**
167             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
168             *
169             * <p>
170             * 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.portal.model.impl.PortletModelImpl}. 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.
171             * </p>
172             *
173             * @param dynamicQuery the dynamic query
174             * @param start the lower bound of the range of model instances
175             * @param end the upper bound of the range of model instances (not inclusive)
176             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
177             * @return the ordered range of matching rows
178             */
179            @Override
180            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
181                    int end, OrderByComparator<T> orderByComparator) {
182                    return portletPersistence.findWithDynamicQuery(dynamicQuery, start,
183                            end, orderByComparator);
184            }
185    
186            /**
187             * Returns the number of rows matching the dynamic query.
188             *
189             * @param dynamicQuery the dynamic query
190             * @return the number of rows matching the dynamic query
191             */
192            @Override
193            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
194                    return portletPersistence.countWithDynamicQuery(dynamicQuery);
195            }
196    
197            /**
198             * Returns the number of rows matching the dynamic query.
199             *
200             * @param dynamicQuery the dynamic query
201             * @param projection the projection to apply to the query
202             * @return the number of rows matching the dynamic query
203             */
204            @Override
205            public long dynamicQueryCount(DynamicQuery dynamicQuery,
206                    Projection projection) {
207                    return portletPersistence.countWithDynamicQuery(dynamicQuery, projection);
208            }
209    
210            @Override
211            public Portlet fetchPortlet(long id) {
212                    return portletPersistence.fetchByPrimaryKey(id);
213            }
214    
215            /**
216             * Returns the portlet with the primary key.
217             *
218             * @param id the primary key of the portlet
219             * @return the portlet
220             * @throws PortalException if a portlet with the primary key could not be found
221             */
222            @Override
223            public Portlet getPortlet(long id) throws PortalException {
224                    return portletPersistence.findByPrimaryKey(id);
225            }
226    
227            @Override
228            public ActionableDynamicQuery getActionableDynamicQuery() {
229                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
230    
231                    actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.PortletLocalServiceUtil.getService());
232                    actionableDynamicQuery.setClass(Portlet.class);
233                    actionableDynamicQuery.setClassLoader(getClassLoader());
234    
235                    actionableDynamicQuery.setPrimaryKeyPropertyName("id");
236    
237                    return actionableDynamicQuery;
238            }
239    
240            protected void initActionableDynamicQuery(
241                    ActionableDynamicQuery actionableDynamicQuery) {
242                    actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.PortletLocalServiceUtil.getService());
243                    actionableDynamicQuery.setClass(Portlet.class);
244                    actionableDynamicQuery.setClassLoader(getClassLoader());
245    
246                    actionableDynamicQuery.setPrimaryKeyPropertyName("id");
247            }
248    
249            /**
250             * @throws PortalException
251             */
252            @Override
253            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
254                    throws PortalException {
255                    return portletLocalService.deletePortlet((Portlet)persistedModel);
256            }
257    
258            @Override
259            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
260                    throws PortalException {
261                    return portletPersistence.findByPrimaryKey(primaryKeyObj);
262            }
263    
264            /**
265             * Returns a range of all the portlets.
266             *
267             * <p>
268             * 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.portal.model.impl.PortletModelImpl}. 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.
269             * </p>
270             *
271             * @param start the lower bound of the range of portlets
272             * @param end the upper bound of the range of portlets (not inclusive)
273             * @return the range of portlets
274             */
275            @Override
276            public List<Portlet> getPortlets(int start, int end) {
277                    return portletPersistence.findAll(start, end);
278            }
279    
280            /**
281             * Returns the number of portlets.
282             *
283             * @return the number of portlets
284             */
285            @Override
286            public int getPortletsCount() {
287                    return portletPersistence.countAll();
288            }
289    
290            /**
291             * Updates the portlet in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
292             *
293             * @param portlet the portlet
294             * @return the portlet that was updated
295             */
296            @Indexable(type = IndexableType.REINDEX)
297            @Override
298            public Portlet updatePortlet(Portlet portlet) {
299                    return portletPersistence.update(portlet);
300            }
301    
302            /**
303             * Returns the portlet local service.
304             *
305             * @return the portlet local service
306             */
307            public PortletLocalService getPortletLocalService() {
308                    return portletLocalService;
309            }
310    
311            /**
312             * Sets the portlet local service.
313             *
314             * @param portletLocalService the portlet local service
315             */
316            public void setPortletLocalService(PortletLocalService portletLocalService) {
317                    this.portletLocalService = portletLocalService;
318            }
319    
320            /**
321             * Returns the portlet remote service.
322             *
323             * @return the portlet remote service
324             */
325            public com.liferay.portal.service.PortletService getPortletService() {
326                    return portletService;
327            }
328    
329            /**
330             * Sets the portlet remote service.
331             *
332             * @param portletService the portlet remote service
333             */
334            public void setPortletService(
335                    com.liferay.portal.service.PortletService portletService) {
336                    this.portletService = portletService;
337            }
338    
339            /**
340             * Returns the portlet persistence.
341             *
342             * @return the portlet persistence
343             */
344            public PortletPersistence getPortletPersistence() {
345                    return portletPersistence;
346            }
347    
348            /**
349             * Sets the portlet persistence.
350             *
351             * @param portletPersistence the portlet persistence
352             */
353            public void setPortletPersistence(PortletPersistence portletPersistence) {
354                    this.portletPersistence = portletPersistence;
355            }
356    
357            /**
358             * Returns the counter local service.
359             *
360             * @return the counter local service
361             */
362            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
363                    return counterLocalService;
364            }
365    
366            /**
367             * Sets the counter local service.
368             *
369             * @param counterLocalService the counter local service
370             */
371            public void setCounterLocalService(
372                    com.liferay.counter.service.CounterLocalService counterLocalService) {
373                    this.counterLocalService = counterLocalService;
374            }
375    
376            /**
377             * Returns the portlet preferences local service.
378             *
379             * @return the portlet preferences local service
380             */
381            public com.liferay.portal.service.PortletPreferencesLocalService getPortletPreferencesLocalService() {
382                    return portletPreferencesLocalService;
383            }
384    
385            /**
386             * Sets the portlet preferences local service.
387             *
388             * @param portletPreferencesLocalService the portlet preferences local service
389             */
390            public void setPortletPreferencesLocalService(
391                    com.liferay.portal.service.PortletPreferencesLocalService portletPreferencesLocalService) {
392                    this.portletPreferencesLocalService = portletPreferencesLocalService;
393            }
394    
395            /**
396             * Returns the portlet preferences remote service.
397             *
398             * @return the portlet preferences remote service
399             */
400            public com.liferay.portal.service.PortletPreferencesService getPortletPreferencesService() {
401                    return portletPreferencesService;
402            }
403    
404            /**
405             * Sets the portlet preferences remote service.
406             *
407             * @param portletPreferencesService the portlet preferences remote service
408             */
409            public void setPortletPreferencesService(
410                    com.liferay.portal.service.PortletPreferencesService portletPreferencesService) {
411                    this.portletPreferencesService = portletPreferencesService;
412            }
413    
414            /**
415             * Returns the portlet preferences persistence.
416             *
417             * @return the portlet preferences persistence
418             */
419            public PortletPreferencesPersistence getPortletPreferencesPersistence() {
420                    return portletPreferencesPersistence;
421            }
422    
423            /**
424             * Sets the portlet preferences persistence.
425             *
426             * @param portletPreferencesPersistence the portlet preferences persistence
427             */
428            public void setPortletPreferencesPersistence(
429                    PortletPreferencesPersistence portletPreferencesPersistence) {
430                    this.portletPreferencesPersistence = portletPreferencesPersistence;
431            }
432    
433            /**
434             * Returns the portlet preferences finder.
435             *
436             * @return the portlet preferences finder
437             */
438            public PortletPreferencesFinder getPortletPreferencesFinder() {
439                    return portletPreferencesFinder;
440            }
441    
442            /**
443             * Sets the portlet preferences finder.
444             *
445             * @param portletPreferencesFinder the portlet preferences finder
446             */
447            public void setPortletPreferencesFinder(
448                    PortletPreferencesFinder portletPreferencesFinder) {
449                    this.portletPreferencesFinder = portletPreferencesFinder;
450            }
451    
452            /**
453             * Returns the resource local service.
454             *
455             * @return the resource local service
456             */
457            public com.liferay.portal.service.ResourceLocalService getResourceLocalService() {
458                    return resourceLocalService;
459            }
460    
461            /**
462             * Sets the resource local service.
463             *
464             * @param resourceLocalService the resource local service
465             */
466            public void setResourceLocalService(
467                    com.liferay.portal.service.ResourceLocalService resourceLocalService) {
468                    this.resourceLocalService = resourceLocalService;
469            }
470    
471            /**
472             * Returns the resource action local service.
473             *
474             * @return the resource action local service
475             */
476            public com.liferay.portal.service.ResourceActionLocalService getResourceActionLocalService() {
477                    return resourceActionLocalService;
478            }
479    
480            /**
481             * Sets the resource action local service.
482             *
483             * @param resourceActionLocalService the resource action local service
484             */
485            public void setResourceActionLocalService(
486                    com.liferay.portal.service.ResourceActionLocalService resourceActionLocalService) {
487                    this.resourceActionLocalService = resourceActionLocalService;
488            }
489    
490            /**
491             * Returns the resource action persistence.
492             *
493             * @return the resource action persistence
494             */
495            public ResourceActionPersistence getResourceActionPersistence() {
496                    return resourceActionPersistence;
497            }
498    
499            /**
500             * Sets the resource action persistence.
501             *
502             * @param resourceActionPersistence the resource action persistence
503             */
504            public void setResourceActionPersistence(
505                    ResourceActionPersistence resourceActionPersistence) {
506                    this.resourceActionPersistence = resourceActionPersistence;
507            }
508    
509            /**
510             * Returns the resource block local service.
511             *
512             * @return the resource block local service
513             */
514            public com.liferay.portal.service.ResourceBlockLocalService getResourceBlockLocalService() {
515                    return resourceBlockLocalService;
516            }
517    
518            /**
519             * Sets the resource block local service.
520             *
521             * @param resourceBlockLocalService the resource block local service
522             */
523            public void setResourceBlockLocalService(
524                    com.liferay.portal.service.ResourceBlockLocalService resourceBlockLocalService) {
525                    this.resourceBlockLocalService = resourceBlockLocalService;
526            }
527    
528            /**
529             * Returns the resource block remote service.
530             *
531             * @return the resource block remote service
532             */
533            public com.liferay.portal.service.ResourceBlockService getResourceBlockService() {
534                    return resourceBlockService;
535            }
536    
537            /**
538             * Sets the resource block remote service.
539             *
540             * @param resourceBlockService the resource block remote service
541             */
542            public void setResourceBlockService(
543                    com.liferay.portal.service.ResourceBlockService resourceBlockService) {
544                    this.resourceBlockService = resourceBlockService;
545            }
546    
547            /**
548             * Returns the resource block persistence.
549             *
550             * @return the resource block persistence
551             */
552            public ResourceBlockPersistence getResourceBlockPersistence() {
553                    return resourceBlockPersistence;
554            }
555    
556            /**
557             * Sets the resource block persistence.
558             *
559             * @param resourceBlockPersistence the resource block persistence
560             */
561            public void setResourceBlockPersistence(
562                    ResourceBlockPersistence resourceBlockPersistence) {
563                    this.resourceBlockPersistence = resourceBlockPersistence;
564            }
565    
566            /**
567             * Returns the resource block finder.
568             *
569             * @return the resource block finder
570             */
571            public ResourceBlockFinder getResourceBlockFinder() {
572                    return resourceBlockFinder;
573            }
574    
575            /**
576             * Sets the resource block finder.
577             *
578             * @param resourceBlockFinder the resource block finder
579             */
580            public void setResourceBlockFinder(ResourceBlockFinder resourceBlockFinder) {
581                    this.resourceBlockFinder = resourceBlockFinder;
582            }
583    
584            /**
585             * Returns the resource permission local service.
586             *
587             * @return the resource permission local service
588             */
589            public com.liferay.portal.service.ResourcePermissionLocalService getResourcePermissionLocalService() {
590                    return resourcePermissionLocalService;
591            }
592    
593            /**
594             * Sets the resource permission local service.
595             *
596             * @param resourcePermissionLocalService the resource permission local service
597             */
598            public void setResourcePermissionLocalService(
599                    com.liferay.portal.service.ResourcePermissionLocalService resourcePermissionLocalService) {
600                    this.resourcePermissionLocalService = resourcePermissionLocalService;
601            }
602    
603            /**
604             * Returns the resource permission remote service.
605             *
606             * @return the resource permission remote service
607             */
608            public com.liferay.portal.service.ResourcePermissionService getResourcePermissionService() {
609                    return resourcePermissionService;
610            }
611    
612            /**
613             * Sets the resource permission remote service.
614             *
615             * @param resourcePermissionService the resource permission remote service
616             */
617            public void setResourcePermissionService(
618                    com.liferay.portal.service.ResourcePermissionService resourcePermissionService) {
619                    this.resourcePermissionService = resourcePermissionService;
620            }
621    
622            /**
623             * Returns the resource permission persistence.
624             *
625             * @return the resource permission persistence
626             */
627            public ResourcePermissionPersistence getResourcePermissionPersistence() {
628                    return resourcePermissionPersistence;
629            }
630    
631            /**
632             * Sets the resource permission persistence.
633             *
634             * @param resourcePermissionPersistence the resource permission persistence
635             */
636            public void setResourcePermissionPersistence(
637                    ResourcePermissionPersistence resourcePermissionPersistence) {
638                    this.resourcePermissionPersistence = resourcePermissionPersistence;
639            }
640    
641            /**
642             * Returns the resource permission finder.
643             *
644             * @return the resource permission finder
645             */
646            public ResourcePermissionFinder getResourcePermissionFinder() {
647                    return resourcePermissionFinder;
648            }
649    
650            /**
651             * Sets the resource permission finder.
652             *
653             * @param resourcePermissionFinder the resource permission finder
654             */
655            public void setResourcePermissionFinder(
656                    ResourcePermissionFinder resourcePermissionFinder) {
657                    this.resourcePermissionFinder = resourcePermissionFinder;
658            }
659    
660            /**
661             * Returns the role local service.
662             *
663             * @return the role local service
664             */
665            public com.liferay.portal.service.RoleLocalService getRoleLocalService() {
666                    return roleLocalService;
667            }
668    
669            /**
670             * Sets the role local service.
671             *
672             * @param roleLocalService the role local service
673             */
674            public void setRoleLocalService(
675                    com.liferay.portal.service.RoleLocalService roleLocalService) {
676                    this.roleLocalService = roleLocalService;
677            }
678    
679            /**
680             * Returns the role remote service.
681             *
682             * @return the role remote service
683             */
684            public com.liferay.portal.service.RoleService getRoleService() {
685                    return roleService;
686            }
687    
688            /**
689             * Sets the role remote service.
690             *
691             * @param roleService the role remote service
692             */
693            public void setRoleService(
694                    com.liferay.portal.service.RoleService roleService) {
695                    this.roleService = roleService;
696            }
697    
698            /**
699             * Returns the role persistence.
700             *
701             * @return the role persistence
702             */
703            public RolePersistence getRolePersistence() {
704                    return rolePersistence;
705            }
706    
707            /**
708             * Sets the role persistence.
709             *
710             * @param rolePersistence the role persistence
711             */
712            public void setRolePersistence(RolePersistence rolePersistence) {
713                    this.rolePersistence = rolePersistence;
714            }
715    
716            /**
717             * Returns the role finder.
718             *
719             * @return the role finder
720             */
721            public RoleFinder getRoleFinder() {
722                    return roleFinder;
723            }
724    
725            /**
726             * Sets the role finder.
727             *
728             * @param roleFinder the role finder
729             */
730            public void setRoleFinder(RoleFinder roleFinder) {
731                    this.roleFinder = roleFinder;
732            }
733    
734            public void afterPropertiesSet() {
735                    persistedModelLocalServiceRegistry.register("com.liferay.portal.model.Portlet",
736                            portletLocalService);
737            }
738    
739            public void destroy() {
740                    persistedModelLocalServiceRegistry.unregister(
741                            "com.liferay.portal.model.Portlet");
742            }
743    
744            /**
745             * Returns the Spring bean ID for this bean.
746             *
747             * @return the Spring bean ID for this bean
748             */
749            @Override
750            public String getBeanIdentifier() {
751                    return _beanIdentifier;
752            }
753    
754            /**
755             * Sets the Spring bean ID for this bean.
756             *
757             * @param beanIdentifier the Spring bean ID for this bean
758             */
759            @Override
760            public void setBeanIdentifier(String beanIdentifier) {
761                    _beanIdentifier = beanIdentifier;
762            }
763    
764            protected Class<?> getModelClass() {
765                    return Portlet.class;
766            }
767    
768            protected String getModelClassName() {
769                    return Portlet.class.getName();
770            }
771    
772            /**
773             * Performs a SQL query.
774             *
775             * @param sql the sql query
776             */
777            protected void runSQL(String sql) {
778                    try {
779                            DataSource dataSource = portletPersistence.getDataSource();
780    
781                            DB db = DBFactoryUtil.getDB();
782    
783                            sql = db.buildSQL(sql);
784                            sql = PortalUtil.transformSQL(sql);
785    
786                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
787                                            sql, new int[0]);
788    
789                            sqlUpdate.update();
790                    }
791                    catch (Exception e) {
792                            throw new SystemException(e);
793                    }
794            }
795    
796            @BeanReference(type = com.liferay.portal.service.PortletLocalService.class)
797            protected PortletLocalService portletLocalService;
798            @BeanReference(type = com.liferay.portal.service.PortletService.class)
799            protected com.liferay.portal.service.PortletService portletService;
800            @BeanReference(type = PortletPersistence.class)
801            protected PortletPersistence portletPersistence;
802            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
803            protected com.liferay.counter.service.CounterLocalService counterLocalService;
804            @BeanReference(type = com.liferay.portal.service.PortletPreferencesLocalService.class)
805            protected com.liferay.portal.service.PortletPreferencesLocalService portletPreferencesLocalService;
806            @BeanReference(type = com.liferay.portal.service.PortletPreferencesService.class)
807            protected com.liferay.portal.service.PortletPreferencesService portletPreferencesService;
808            @BeanReference(type = PortletPreferencesPersistence.class)
809            protected PortletPreferencesPersistence portletPreferencesPersistence;
810            @BeanReference(type = PortletPreferencesFinder.class)
811            protected PortletPreferencesFinder portletPreferencesFinder;
812            @BeanReference(type = com.liferay.portal.service.ResourceLocalService.class)
813            protected com.liferay.portal.service.ResourceLocalService resourceLocalService;
814            @BeanReference(type = com.liferay.portal.service.ResourceActionLocalService.class)
815            protected com.liferay.portal.service.ResourceActionLocalService resourceActionLocalService;
816            @BeanReference(type = ResourceActionPersistence.class)
817            protected ResourceActionPersistence resourceActionPersistence;
818            @BeanReference(type = com.liferay.portal.service.ResourceBlockLocalService.class)
819            protected com.liferay.portal.service.ResourceBlockLocalService resourceBlockLocalService;
820            @BeanReference(type = com.liferay.portal.service.ResourceBlockService.class)
821            protected com.liferay.portal.service.ResourceBlockService resourceBlockService;
822            @BeanReference(type = ResourceBlockPersistence.class)
823            protected ResourceBlockPersistence resourceBlockPersistence;
824            @BeanReference(type = ResourceBlockFinder.class)
825            protected ResourceBlockFinder resourceBlockFinder;
826            @BeanReference(type = com.liferay.portal.service.ResourcePermissionLocalService.class)
827            protected com.liferay.portal.service.ResourcePermissionLocalService resourcePermissionLocalService;
828            @BeanReference(type = com.liferay.portal.service.ResourcePermissionService.class)
829            protected com.liferay.portal.service.ResourcePermissionService resourcePermissionService;
830            @BeanReference(type = ResourcePermissionPersistence.class)
831            protected ResourcePermissionPersistence resourcePermissionPersistence;
832            @BeanReference(type = ResourcePermissionFinder.class)
833            protected ResourcePermissionFinder resourcePermissionFinder;
834            @BeanReference(type = com.liferay.portal.service.RoleLocalService.class)
835            protected com.liferay.portal.service.RoleLocalService roleLocalService;
836            @BeanReference(type = com.liferay.portal.service.RoleService.class)
837            protected com.liferay.portal.service.RoleService roleService;
838            @BeanReference(type = RolePersistence.class)
839            protected RolePersistence rolePersistence;
840            @BeanReference(type = RoleFinder.class)
841            protected RoleFinder roleFinder;
842            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
843            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
844            private String _beanIdentifier;
845    }