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 com.liferay.portal.service.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(
317                    com.liferay.portal.service.PortletLocalService portletLocalService) {
318                    this.portletLocalService = portletLocalService;
319            }
320    
321            /**
322             * Returns the portlet remote service.
323             *
324             * @return the portlet remote service
325             */
326            public com.liferay.portal.service.PortletService getPortletService() {
327                    return portletService;
328            }
329    
330            /**
331             * Sets the portlet remote service.
332             *
333             * @param portletService the portlet remote service
334             */
335            public void setPortletService(
336                    com.liferay.portal.service.PortletService portletService) {
337                    this.portletService = portletService;
338            }
339    
340            /**
341             * Returns the portlet persistence.
342             *
343             * @return the portlet persistence
344             */
345            public PortletPersistence getPortletPersistence() {
346                    return portletPersistence;
347            }
348    
349            /**
350             * Sets the portlet persistence.
351             *
352             * @param portletPersistence the portlet persistence
353             */
354            public void setPortletPersistence(PortletPersistence portletPersistence) {
355                    this.portletPersistence = portletPersistence;
356            }
357    
358            /**
359             * Returns the counter local service.
360             *
361             * @return the counter local service
362             */
363            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
364                    return counterLocalService;
365            }
366    
367            /**
368             * Sets the counter local service.
369             *
370             * @param counterLocalService the counter local service
371             */
372            public void setCounterLocalService(
373                    com.liferay.counter.service.CounterLocalService counterLocalService) {
374                    this.counterLocalService = counterLocalService;
375            }
376    
377            /**
378             * Returns the portlet preferences local service.
379             *
380             * @return the portlet preferences local service
381             */
382            public com.liferay.portal.service.PortletPreferencesLocalService getPortletPreferencesLocalService() {
383                    return portletPreferencesLocalService;
384            }
385    
386            /**
387             * Sets the portlet preferences local service.
388             *
389             * @param portletPreferencesLocalService the portlet preferences local service
390             */
391            public void setPortletPreferencesLocalService(
392                    com.liferay.portal.service.PortletPreferencesLocalService portletPreferencesLocalService) {
393                    this.portletPreferencesLocalService = portletPreferencesLocalService;
394            }
395    
396            /**
397             * Returns the portlet preferences remote service.
398             *
399             * @return the portlet preferences remote service
400             */
401            public com.liferay.portal.service.PortletPreferencesService getPortletPreferencesService() {
402                    return portletPreferencesService;
403            }
404    
405            /**
406             * Sets the portlet preferences remote service.
407             *
408             * @param portletPreferencesService the portlet preferences remote service
409             */
410            public void setPortletPreferencesService(
411                    com.liferay.portal.service.PortletPreferencesService portletPreferencesService) {
412                    this.portletPreferencesService = portletPreferencesService;
413            }
414    
415            /**
416             * Returns the portlet preferences persistence.
417             *
418             * @return the portlet preferences persistence
419             */
420            public PortletPreferencesPersistence getPortletPreferencesPersistence() {
421                    return portletPreferencesPersistence;
422            }
423    
424            /**
425             * Sets the portlet preferences persistence.
426             *
427             * @param portletPreferencesPersistence the portlet preferences persistence
428             */
429            public void setPortletPreferencesPersistence(
430                    PortletPreferencesPersistence portletPreferencesPersistence) {
431                    this.portletPreferencesPersistence = portletPreferencesPersistence;
432            }
433    
434            /**
435             * Returns the portlet preferences finder.
436             *
437             * @return the portlet preferences finder
438             */
439            public PortletPreferencesFinder getPortletPreferencesFinder() {
440                    return portletPreferencesFinder;
441            }
442    
443            /**
444             * Sets the portlet preferences finder.
445             *
446             * @param portletPreferencesFinder the portlet preferences finder
447             */
448            public void setPortletPreferencesFinder(
449                    PortletPreferencesFinder portletPreferencesFinder) {
450                    this.portletPreferencesFinder = portletPreferencesFinder;
451            }
452    
453            /**
454             * Returns the resource local service.
455             *
456             * @return the resource local service
457             */
458            public com.liferay.portal.service.ResourceLocalService getResourceLocalService() {
459                    return resourceLocalService;
460            }
461    
462            /**
463             * Sets the resource local service.
464             *
465             * @param resourceLocalService the resource local service
466             */
467            public void setResourceLocalService(
468                    com.liferay.portal.service.ResourceLocalService resourceLocalService) {
469                    this.resourceLocalService = resourceLocalService;
470            }
471    
472            /**
473             * Returns the resource action local service.
474             *
475             * @return the resource action local service
476             */
477            public com.liferay.portal.service.ResourceActionLocalService getResourceActionLocalService() {
478                    return resourceActionLocalService;
479            }
480    
481            /**
482             * Sets the resource action local service.
483             *
484             * @param resourceActionLocalService the resource action local service
485             */
486            public void setResourceActionLocalService(
487                    com.liferay.portal.service.ResourceActionLocalService resourceActionLocalService) {
488                    this.resourceActionLocalService = resourceActionLocalService;
489            }
490    
491            /**
492             * Returns the resource action persistence.
493             *
494             * @return the resource action persistence
495             */
496            public ResourceActionPersistence getResourceActionPersistence() {
497                    return resourceActionPersistence;
498            }
499    
500            /**
501             * Sets the resource action persistence.
502             *
503             * @param resourceActionPersistence the resource action persistence
504             */
505            public void setResourceActionPersistence(
506                    ResourceActionPersistence resourceActionPersistence) {
507                    this.resourceActionPersistence = resourceActionPersistence;
508            }
509    
510            /**
511             * Returns the resource block local service.
512             *
513             * @return the resource block local service
514             */
515            public com.liferay.portal.service.ResourceBlockLocalService getResourceBlockLocalService() {
516                    return resourceBlockLocalService;
517            }
518    
519            /**
520             * Sets the resource block local service.
521             *
522             * @param resourceBlockLocalService the resource block local service
523             */
524            public void setResourceBlockLocalService(
525                    com.liferay.portal.service.ResourceBlockLocalService resourceBlockLocalService) {
526                    this.resourceBlockLocalService = resourceBlockLocalService;
527            }
528    
529            /**
530             * Returns the resource block remote service.
531             *
532             * @return the resource block remote service
533             */
534            public com.liferay.portal.service.ResourceBlockService getResourceBlockService() {
535                    return resourceBlockService;
536            }
537    
538            /**
539             * Sets the resource block remote service.
540             *
541             * @param resourceBlockService the resource block remote service
542             */
543            public void setResourceBlockService(
544                    com.liferay.portal.service.ResourceBlockService resourceBlockService) {
545                    this.resourceBlockService = resourceBlockService;
546            }
547    
548            /**
549             * Returns the resource block persistence.
550             *
551             * @return the resource block persistence
552             */
553            public ResourceBlockPersistence getResourceBlockPersistence() {
554                    return resourceBlockPersistence;
555            }
556    
557            /**
558             * Sets the resource block persistence.
559             *
560             * @param resourceBlockPersistence the resource block persistence
561             */
562            public void setResourceBlockPersistence(
563                    ResourceBlockPersistence resourceBlockPersistence) {
564                    this.resourceBlockPersistence = resourceBlockPersistence;
565            }
566    
567            /**
568             * Returns the resource block finder.
569             *
570             * @return the resource block finder
571             */
572            public ResourceBlockFinder getResourceBlockFinder() {
573                    return resourceBlockFinder;
574            }
575    
576            /**
577             * Sets the resource block finder.
578             *
579             * @param resourceBlockFinder the resource block finder
580             */
581            public void setResourceBlockFinder(ResourceBlockFinder resourceBlockFinder) {
582                    this.resourceBlockFinder = resourceBlockFinder;
583            }
584    
585            /**
586             * Returns the resource permission local service.
587             *
588             * @return the resource permission local service
589             */
590            public com.liferay.portal.service.ResourcePermissionLocalService getResourcePermissionLocalService() {
591                    return resourcePermissionLocalService;
592            }
593    
594            /**
595             * Sets the resource permission local service.
596             *
597             * @param resourcePermissionLocalService the resource permission local service
598             */
599            public void setResourcePermissionLocalService(
600                    com.liferay.portal.service.ResourcePermissionLocalService resourcePermissionLocalService) {
601                    this.resourcePermissionLocalService = resourcePermissionLocalService;
602            }
603    
604            /**
605             * Returns the resource permission remote service.
606             *
607             * @return the resource permission remote service
608             */
609            public com.liferay.portal.service.ResourcePermissionService getResourcePermissionService() {
610                    return resourcePermissionService;
611            }
612    
613            /**
614             * Sets the resource permission remote service.
615             *
616             * @param resourcePermissionService the resource permission remote service
617             */
618            public void setResourcePermissionService(
619                    com.liferay.portal.service.ResourcePermissionService resourcePermissionService) {
620                    this.resourcePermissionService = resourcePermissionService;
621            }
622    
623            /**
624             * Returns the resource permission persistence.
625             *
626             * @return the resource permission persistence
627             */
628            public ResourcePermissionPersistence getResourcePermissionPersistence() {
629                    return resourcePermissionPersistence;
630            }
631    
632            /**
633             * Sets the resource permission persistence.
634             *
635             * @param resourcePermissionPersistence the resource permission persistence
636             */
637            public void setResourcePermissionPersistence(
638                    ResourcePermissionPersistence resourcePermissionPersistence) {
639                    this.resourcePermissionPersistence = resourcePermissionPersistence;
640            }
641    
642            /**
643             * Returns the resource permission finder.
644             *
645             * @return the resource permission finder
646             */
647            public ResourcePermissionFinder getResourcePermissionFinder() {
648                    return resourcePermissionFinder;
649            }
650    
651            /**
652             * Sets the resource permission finder.
653             *
654             * @param resourcePermissionFinder the resource permission finder
655             */
656            public void setResourcePermissionFinder(
657                    ResourcePermissionFinder resourcePermissionFinder) {
658                    this.resourcePermissionFinder = resourcePermissionFinder;
659            }
660    
661            /**
662             * Returns the role local service.
663             *
664             * @return the role local service
665             */
666            public com.liferay.portal.service.RoleLocalService getRoleLocalService() {
667                    return roleLocalService;
668            }
669    
670            /**
671             * Sets the role local service.
672             *
673             * @param roleLocalService the role local service
674             */
675            public void setRoleLocalService(
676                    com.liferay.portal.service.RoleLocalService roleLocalService) {
677                    this.roleLocalService = roleLocalService;
678            }
679    
680            /**
681             * Returns the role remote service.
682             *
683             * @return the role remote service
684             */
685            public com.liferay.portal.service.RoleService getRoleService() {
686                    return roleService;
687            }
688    
689            /**
690             * Sets the role remote service.
691             *
692             * @param roleService the role remote service
693             */
694            public void setRoleService(
695                    com.liferay.portal.service.RoleService roleService) {
696                    this.roleService = roleService;
697            }
698    
699            /**
700             * Returns the role persistence.
701             *
702             * @return the role persistence
703             */
704            public RolePersistence getRolePersistence() {
705                    return rolePersistence;
706            }
707    
708            /**
709             * Sets the role persistence.
710             *
711             * @param rolePersistence the role persistence
712             */
713            public void setRolePersistence(RolePersistence rolePersistence) {
714                    this.rolePersistence = rolePersistence;
715            }
716    
717            /**
718             * Returns the role finder.
719             *
720             * @return the role finder
721             */
722            public RoleFinder getRoleFinder() {
723                    return roleFinder;
724            }
725    
726            /**
727             * Sets the role finder.
728             *
729             * @param roleFinder the role finder
730             */
731            public void setRoleFinder(RoleFinder roleFinder) {
732                    this.roleFinder = roleFinder;
733            }
734    
735            public void afterPropertiesSet() {
736                    persistedModelLocalServiceRegistry.register("com.liferay.portal.model.Portlet",
737                            portletLocalService);
738            }
739    
740            public void destroy() {
741                    persistedModelLocalServiceRegistry.unregister(
742                            "com.liferay.portal.model.Portlet");
743            }
744    
745            /**
746             * Returns the Spring bean ID for this bean.
747             *
748             * @return the Spring bean ID for this bean
749             */
750            @Override
751            public String getBeanIdentifier() {
752                    return _beanIdentifier;
753            }
754    
755            /**
756             * Sets the Spring bean ID for this bean.
757             *
758             * @param beanIdentifier the Spring bean ID for this bean
759             */
760            @Override
761            public void setBeanIdentifier(String beanIdentifier) {
762                    _beanIdentifier = beanIdentifier;
763            }
764    
765            protected Class<?> getModelClass() {
766                    return Portlet.class;
767            }
768    
769            protected String getModelClassName() {
770                    return Portlet.class.getName();
771            }
772    
773            /**
774             * Performs a SQL query.
775             *
776             * @param sql the sql query
777             */
778            protected void runSQL(String sql) {
779                    try {
780                            DataSource dataSource = portletPersistence.getDataSource();
781    
782                            DB db = DBFactoryUtil.getDB();
783    
784                            sql = db.buildSQL(sql);
785                            sql = PortalUtil.transformSQL(sql);
786    
787                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
788                                            sql, new int[0]);
789    
790                            sqlUpdate.update();
791                    }
792                    catch (Exception e) {
793                            throw new SystemException(e);
794                    }
795            }
796    
797            @BeanReference(type = com.liferay.portal.service.PortletLocalService.class)
798            protected com.liferay.portal.service.PortletLocalService portletLocalService;
799            @BeanReference(type = com.liferay.portal.service.PortletService.class)
800            protected com.liferay.portal.service.PortletService portletService;
801            @BeanReference(type = PortletPersistence.class)
802            protected PortletPersistence portletPersistence;
803            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
804            protected com.liferay.counter.service.CounterLocalService counterLocalService;
805            @BeanReference(type = com.liferay.portal.service.PortletPreferencesLocalService.class)
806            protected com.liferay.portal.service.PortletPreferencesLocalService portletPreferencesLocalService;
807            @BeanReference(type = com.liferay.portal.service.PortletPreferencesService.class)
808            protected com.liferay.portal.service.PortletPreferencesService portletPreferencesService;
809            @BeanReference(type = PortletPreferencesPersistence.class)
810            protected PortletPreferencesPersistence portletPreferencesPersistence;
811            @BeanReference(type = PortletPreferencesFinder.class)
812            protected PortletPreferencesFinder portletPreferencesFinder;
813            @BeanReference(type = com.liferay.portal.service.ResourceLocalService.class)
814            protected com.liferay.portal.service.ResourceLocalService resourceLocalService;
815            @BeanReference(type = com.liferay.portal.service.ResourceActionLocalService.class)
816            protected com.liferay.portal.service.ResourceActionLocalService resourceActionLocalService;
817            @BeanReference(type = ResourceActionPersistence.class)
818            protected ResourceActionPersistence resourceActionPersistence;
819            @BeanReference(type = com.liferay.portal.service.ResourceBlockLocalService.class)
820            protected com.liferay.portal.service.ResourceBlockLocalService resourceBlockLocalService;
821            @BeanReference(type = com.liferay.portal.service.ResourceBlockService.class)
822            protected com.liferay.portal.service.ResourceBlockService resourceBlockService;
823            @BeanReference(type = ResourceBlockPersistence.class)
824            protected ResourceBlockPersistence resourceBlockPersistence;
825            @BeanReference(type = ResourceBlockFinder.class)
826            protected ResourceBlockFinder resourceBlockFinder;
827            @BeanReference(type = com.liferay.portal.service.ResourcePermissionLocalService.class)
828            protected com.liferay.portal.service.ResourcePermissionLocalService resourcePermissionLocalService;
829            @BeanReference(type = com.liferay.portal.service.ResourcePermissionService.class)
830            protected com.liferay.portal.service.ResourcePermissionService resourcePermissionService;
831            @BeanReference(type = ResourcePermissionPersistence.class)
832            protected ResourcePermissionPersistence resourcePermissionPersistence;
833            @BeanReference(type = ResourcePermissionFinder.class)
834            protected ResourcePermissionFinder resourcePermissionFinder;
835            @BeanReference(type = com.liferay.portal.service.RoleLocalService.class)
836            protected com.liferay.portal.service.RoleLocalService roleLocalService;
837            @BeanReference(type = com.liferay.portal.service.RoleService.class)
838            protected com.liferay.portal.service.RoleService roleService;
839            @BeanReference(type = RolePersistence.class)
840            protected RolePersistence rolePersistence;
841            @BeanReference(type = RoleFinder.class)
842            protected RoleFinder roleFinder;
843            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
844            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
845            private String _beanIdentifier;
846    }