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.dao.db.DB;
021    import com.liferay.portal.kernel.dao.db.DBManagerUtil;
022    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
023    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
024    import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
025    import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery;
026    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
027    import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
028    import com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery;
029    import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery;
030    import com.liferay.portal.kernel.dao.orm.Projection;
031    import com.liferay.portal.kernel.exception.PortalException;
032    import com.liferay.portal.kernel.exception.SystemException;
033    import com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService;
034    import com.liferay.portal.kernel.search.Indexable;
035    import com.liferay.portal.kernel.search.IndexableType;
036    import com.liferay.portal.kernel.util.OrderByComparator;
037    import com.liferay.portal.model.LayoutPrototype;
038    import com.liferay.portal.model.PersistedModel;
039    import com.liferay.portal.service.BaseLocalServiceImpl;
040    import com.liferay.portal.service.LayoutPrototypeLocalService;
041    import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
042    import com.liferay.portal.service.persistence.GroupFinder;
043    import com.liferay.portal.service.persistence.GroupPersistence;
044    import com.liferay.portal.service.persistence.LayoutFinder;
045    import com.liferay.portal.service.persistence.LayoutPersistence;
046    import com.liferay.portal.service.persistence.LayoutPrototypePersistence;
047    import com.liferay.portal.service.persistence.PortletPreferencesFinder;
048    import com.liferay.portal.service.persistence.PortletPreferencesPersistence;
049    import com.liferay.portal.service.persistence.UserFinder;
050    import com.liferay.portal.service.persistence.UserPersistence;
051    import com.liferay.portal.util.PortalUtil;
052    
053    import com.liferay.portlet.exportimport.lar.ExportImportHelperUtil;
054    import com.liferay.portlet.exportimport.lar.ManifestSummary;
055    import com.liferay.portlet.exportimport.lar.PortletDataContext;
056    import com.liferay.portlet.exportimport.lar.StagedModelDataHandlerUtil;
057    import com.liferay.portlet.exportimport.lar.StagedModelType;
058    
059    import java.io.Serializable;
060    
061    import java.util.List;
062    
063    import javax.sql.DataSource;
064    
065    /**
066     * Provides the base implementation for the layout prototype local service.
067     *
068     * <p>
069     * 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.LayoutPrototypeLocalServiceImpl}.
070     * </p>
071     *
072     * @author Brian Wing Shun Chan
073     * @see com.liferay.portal.service.impl.LayoutPrototypeLocalServiceImpl
074     * @see com.liferay.portal.service.LayoutPrototypeLocalServiceUtil
075     * @generated
076     */
077    @ProviderType
078    public abstract class LayoutPrototypeLocalServiceBaseImpl
079            extends BaseLocalServiceImpl implements LayoutPrototypeLocalService,
080                    IdentifiableOSGiService {
081            /*
082             * NOTE FOR DEVELOPERS:
083             *
084             * Never modify or reference this class directly. Always use {@link com.liferay.portal.service.LayoutPrototypeLocalServiceUtil} to access the layout prototype local service.
085             */
086    
087            /**
088             * Adds the layout prototype to the database. Also notifies the appropriate model listeners.
089             *
090             * @param layoutPrototype the layout prototype
091             * @return the layout prototype that was added
092             */
093            @Indexable(type = IndexableType.REINDEX)
094            @Override
095            public LayoutPrototype addLayoutPrototype(LayoutPrototype layoutPrototype) {
096                    layoutPrototype.setNew(true);
097    
098                    return layoutPrototypePersistence.update(layoutPrototype);
099            }
100    
101            /**
102             * Creates a new layout prototype with the primary key. Does not add the layout prototype to the database.
103             *
104             * @param layoutPrototypeId the primary key for the new layout prototype
105             * @return the new layout prototype
106             */
107            @Override
108            public LayoutPrototype createLayoutPrototype(long layoutPrototypeId) {
109                    return layoutPrototypePersistence.create(layoutPrototypeId);
110            }
111    
112            /**
113             * Deletes the layout prototype with the primary key from the database. Also notifies the appropriate model listeners.
114             *
115             * @param layoutPrototypeId the primary key of the layout prototype
116             * @return the layout prototype that was removed
117             * @throws PortalException if a layout prototype with the primary key could not be found
118             */
119            @Indexable(type = IndexableType.DELETE)
120            @Override
121            public LayoutPrototype deleteLayoutPrototype(long layoutPrototypeId)
122                    throws PortalException {
123                    return layoutPrototypePersistence.remove(layoutPrototypeId);
124            }
125    
126            /**
127             * Deletes the layout prototype from the database. Also notifies the appropriate model listeners.
128             *
129             * @param layoutPrototype the layout prototype
130             * @return the layout prototype that was removed
131             * @throws PortalException
132             */
133            @Indexable(type = IndexableType.DELETE)
134            @Override
135            public LayoutPrototype deleteLayoutPrototype(
136                    LayoutPrototype layoutPrototype) throws PortalException {
137                    return layoutPrototypePersistence.remove(layoutPrototype);
138            }
139    
140            @Override
141            public DynamicQuery dynamicQuery() {
142                    Class<?> clazz = getClass();
143    
144                    return DynamicQueryFactoryUtil.forClass(LayoutPrototype.class,
145                            clazz.getClassLoader());
146            }
147    
148            /**
149             * Performs a dynamic query on the database and returns the matching rows.
150             *
151             * @param dynamicQuery the dynamic query
152             * @return the matching rows
153             */
154            @Override
155            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
156                    return layoutPrototypePersistence.findWithDynamicQuery(dynamicQuery);
157            }
158    
159            /**
160             * Performs a dynamic query on the database and returns a range of the matching rows.
161             *
162             * <p>
163             * 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.LayoutPrototypeModelImpl}. 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.
164             * </p>
165             *
166             * @param dynamicQuery the dynamic query
167             * @param start the lower bound of the range of model instances
168             * @param end the upper bound of the range of model instances (not inclusive)
169             * @return the range of matching rows
170             */
171            @Override
172            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
173                    int end) {
174                    return layoutPrototypePersistence.findWithDynamicQuery(dynamicQuery,
175                            start, end);
176            }
177    
178            /**
179             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
180             *
181             * <p>
182             * 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.LayoutPrototypeModelImpl}. 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.
183             * </p>
184             *
185             * @param dynamicQuery the dynamic query
186             * @param start the lower bound of the range of model instances
187             * @param end the upper bound of the range of model instances (not inclusive)
188             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
189             * @return the ordered range of matching rows
190             */
191            @Override
192            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
193                    int end, OrderByComparator<T> orderByComparator) {
194                    return layoutPrototypePersistence.findWithDynamicQuery(dynamicQuery,
195                            start, end, orderByComparator);
196            }
197    
198            /**
199             * Returns the number of rows matching the dynamic query.
200             *
201             * @param dynamicQuery the dynamic query
202             * @return the number of rows matching the dynamic query
203             */
204            @Override
205            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
206                    return layoutPrototypePersistence.countWithDynamicQuery(dynamicQuery);
207            }
208    
209            /**
210             * Returns the number of rows matching the dynamic query.
211             *
212             * @param dynamicQuery the dynamic query
213             * @param projection the projection to apply to the query
214             * @return the number of rows matching the dynamic query
215             */
216            @Override
217            public long dynamicQueryCount(DynamicQuery dynamicQuery,
218                    Projection projection) {
219                    return layoutPrototypePersistence.countWithDynamicQuery(dynamicQuery,
220                            projection);
221            }
222    
223            @Override
224            public LayoutPrototype fetchLayoutPrototype(long layoutPrototypeId) {
225                    return layoutPrototypePersistence.fetchByPrimaryKey(layoutPrototypeId);
226            }
227    
228            /**
229             * Returns the layout prototype with the matching UUID and company.
230             *
231             * @param uuid the layout prototype's UUID
232             * @param companyId the primary key of the company
233             * @return the matching layout prototype, or <code>null</code> if a matching layout prototype could not be found
234             */
235            @Override
236            public LayoutPrototype fetchLayoutPrototypeByUuidAndCompanyId(String uuid,
237                    long companyId) {
238                    return layoutPrototypePersistence.fetchByUuid_C_First(uuid, companyId,
239                            null);
240            }
241    
242            /**
243             * Returns the layout prototype with the primary key.
244             *
245             * @param layoutPrototypeId the primary key of the layout prototype
246             * @return the layout prototype
247             * @throws PortalException if a layout prototype with the primary key could not be found
248             */
249            @Override
250            public LayoutPrototype getLayoutPrototype(long layoutPrototypeId)
251                    throws PortalException {
252                    return layoutPrototypePersistence.findByPrimaryKey(layoutPrototypeId);
253            }
254    
255            @Override
256            public ActionableDynamicQuery getActionableDynamicQuery() {
257                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
258    
259                    actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.LayoutPrototypeLocalServiceUtil.getService());
260                    actionableDynamicQuery.setClassLoader(getClassLoader());
261                    actionableDynamicQuery.setModelClass(LayoutPrototype.class);
262    
263                    actionableDynamicQuery.setPrimaryKeyPropertyName("layoutPrototypeId");
264    
265                    return actionableDynamicQuery;
266            }
267    
268            @Override
269            public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery() {
270                    IndexableActionableDynamicQuery indexableActionableDynamicQuery = new IndexableActionableDynamicQuery();
271    
272                    indexableActionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.LayoutPrototypeLocalServiceUtil.getService());
273                    indexableActionableDynamicQuery.setClassLoader(getClassLoader());
274                    indexableActionableDynamicQuery.setModelClass(LayoutPrototype.class);
275    
276                    indexableActionableDynamicQuery.setPrimaryKeyPropertyName(
277                            "layoutPrototypeId");
278    
279                    return indexableActionableDynamicQuery;
280            }
281    
282            protected void initActionableDynamicQuery(
283                    ActionableDynamicQuery actionableDynamicQuery) {
284                    actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.LayoutPrototypeLocalServiceUtil.getService());
285                    actionableDynamicQuery.setClassLoader(getClassLoader());
286                    actionableDynamicQuery.setModelClass(LayoutPrototype.class);
287    
288                    actionableDynamicQuery.setPrimaryKeyPropertyName("layoutPrototypeId");
289            }
290    
291            @Override
292            public ExportActionableDynamicQuery getExportActionableDynamicQuery(
293                    final PortletDataContext portletDataContext) {
294                    final ExportActionableDynamicQuery exportActionableDynamicQuery = new ExportActionableDynamicQuery() {
295                                    @Override
296                                    public long performCount() throws PortalException {
297                                            ManifestSummary manifestSummary = portletDataContext.getManifestSummary();
298    
299                                            StagedModelType stagedModelType = getStagedModelType();
300    
301                                            long modelAdditionCount = super.performCount();
302    
303                                            manifestSummary.addModelAdditionCount(stagedModelType,
304                                                    modelAdditionCount);
305    
306                                            long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext,
307                                                            stagedModelType);
308    
309                                            manifestSummary.addModelDeletionCount(stagedModelType,
310                                                    modelDeletionCount);
311    
312                                            return modelAdditionCount;
313                                    }
314                            };
315    
316                    initActionableDynamicQuery(exportActionableDynamicQuery);
317    
318                    exportActionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() {
319                                    @Override
320                                    public void addCriteria(DynamicQuery dynamicQuery) {
321                                            portletDataContext.addDateRangeCriteria(dynamicQuery,
322                                                    "modifiedDate");
323                                    }
324                            });
325    
326                    exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId());
327    
328                    exportActionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<LayoutPrototype>() {
329                                    @Override
330                                    public void performAction(LayoutPrototype layoutPrototype)
331                                            throws PortalException {
332                                            StagedModelDataHandlerUtil.exportStagedModel(portletDataContext,
333                                                    layoutPrototype);
334                                    }
335                            });
336                    exportActionableDynamicQuery.setStagedModelType(new StagedModelType(
337                                    PortalUtil.getClassNameId(LayoutPrototype.class.getName())));
338    
339                    return exportActionableDynamicQuery;
340            }
341    
342            /**
343             * @throws PortalException
344             */
345            @Override
346            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
347                    throws PortalException {
348                    return layoutPrototypeLocalService.deleteLayoutPrototype((LayoutPrototype)persistedModel);
349            }
350    
351            @Override
352            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
353                    throws PortalException {
354                    return layoutPrototypePersistence.findByPrimaryKey(primaryKeyObj);
355            }
356    
357            /**
358             * Returns the layout prototype with the matching UUID and company.
359             *
360             * @param uuid the layout prototype's UUID
361             * @param companyId the primary key of the company
362             * @return the matching layout prototype
363             * @throws PortalException if a matching layout prototype could not be found
364             */
365            @Override
366            public LayoutPrototype getLayoutPrototypeByUuidAndCompanyId(String uuid,
367                    long companyId) throws PortalException {
368                    return layoutPrototypePersistence.findByUuid_C_First(uuid, companyId,
369                            null);
370            }
371    
372            /**
373             * Returns a range of all the layout prototypes.
374             *
375             * <p>
376             * 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.LayoutPrototypeModelImpl}. 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.
377             * </p>
378             *
379             * @param start the lower bound of the range of layout prototypes
380             * @param end the upper bound of the range of layout prototypes (not inclusive)
381             * @return the range of layout prototypes
382             */
383            @Override
384            public List<LayoutPrototype> getLayoutPrototypes(int start, int end) {
385                    return layoutPrototypePersistence.findAll(start, end);
386            }
387    
388            /**
389             * Returns the number of layout prototypes.
390             *
391             * @return the number of layout prototypes
392             */
393            @Override
394            public int getLayoutPrototypesCount() {
395                    return layoutPrototypePersistence.countAll();
396            }
397    
398            /**
399             * Updates the layout prototype in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
400             *
401             * @param layoutPrototype the layout prototype
402             * @return the layout prototype that was updated
403             */
404            @Indexable(type = IndexableType.REINDEX)
405            @Override
406            public LayoutPrototype updateLayoutPrototype(
407                    LayoutPrototype layoutPrototype) {
408                    return layoutPrototypePersistence.update(layoutPrototype);
409            }
410    
411            /**
412             * Returns the layout prototype local service.
413             *
414             * @return the layout prototype local service
415             */
416            public LayoutPrototypeLocalService getLayoutPrototypeLocalService() {
417                    return layoutPrototypeLocalService;
418            }
419    
420            /**
421             * Sets the layout prototype local service.
422             *
423             * @param layoutPrototypeLocalService the layout prototype local service
424             */
425            public void setLayoutPrototypeLocalService(
426                    LayoutPrototypeLocalService layoutPrototypeLocalService) {
427                    this.layoutPrototypeLocalService = layoutPrototypeLocalService;
428            }
429    
430            /**
431             * Returns the layout prototype persistence.
432             *
433             * @return the layout prototype persistence
434             */
435            public LayoutPrototypePersistence getLayoutPrototypePersistence() {
436                    return layoutPrototypePersistence;
437            }
438    
439            /**
440             * Sets the layout prototype persistence.
441             *
442             * @param layoutPrototypePersistence the layout prototype persistence
443             */
444            public void setLayoutPrototypePersistence(
445                    LayoutPrototypePersistence layoutPrototypePersistence) {
446                    this.layoutPrototypePersistence = layoutPrototypePersistence;
447            }
448    
449            /**
450             * Returns the counter local service.
451             *
452             * @return the counter local service
453             */
454            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
455                    return counterLocalService;
456            }
457    
458            /**
459             * Sets the counter local service.
460             *
461             * @param counterLocalService the counter local service
462             */
463            public void setCounterLocalService(
464                    com.liferay.counter.service.CounterLocalService counterLocalService) {
465                    this.counterLocalService = counterLocalService;
466            }
467    
468            /**
469             * Returns the group local service.
470             *
471             * @return the group local service
472             */
473            public com.liferay.portal.service.GroupLocalService getGroupLocalService() {
474                    return groupLocalService;
475            }
476    
477            /**
478             * Sets the group local service.
479             *
480             * @param groupLocalService the group local service
481             */
482            public void setGroupLocalService(
483                    com.liferay.portal.service.GroupLocalService groupLocalService) {
484                    this.groupLocalService = groupLocalService;
485            }
486    
487            /**
488             * Returns the group persistence.
489             *
490             * @return the group persistence
491             */
492            public GroupPersistence getGroupPersistence() {
493                    return groupPersistence;
494            }
495    
496            /**
497             * Sets the group persistence.
498             *
499             * @param groupPersistence the group persistence
500             */
501            public void setGroupPersistence(GroupPersistence groupPersistence) {
502                    this.groupPersistence = groupPersistence;
503            }
504    
505            /**
506             * Returns the group finder.
507             *
508             * @return the group finder
509             */
510            public GroupFinder getGroupFinder() {
511                    return groupFinder;
512            }
513    
514            /**
515             * Sets the group finder.
516             *
517             * @param groupFinder the group finder
518             */
519            public void setGroupFinder(GroupFinder groupFinder) {
520                    this.groupFinder = groupFinder;
521            }
522    
523            /**
524             * Returns the layout local service.
525             *
526             * @return the layout local service
527             */
528            public com.liferay.portal.service.LayoutLocalService getLayoutLocalService() {
529                    return layoutLocalService;
530            }
531    
532            /**
533             * Sets the layout local service.
534             *
535             * @param layoutLocalService the layout local service
536             */
537            public void setLayoutLocalService(
538                    com.liferay.portal.service.LayoutLocalService layoutLocalService) {
539                    this.layoutLocalService = layoutLocalService;
540            }
541    
542            /**
543             * Returns the layout persistence.
544             *
545             * @return the layout persistence
546             */
547            public LayoutPersistence getLayoutPersistence() {
548                    return layoutPersistence;
549            }
550    
551            /**
552             * Sets the layout persistence.
553             *
554             * @param layoutPersistence the layout persistence
555             */
556            public void setLayoutPersistence(LayoutPersistence layoutPersistence) {
557                    this.layoutPersistence = layoutPersistence;
558            }
559    
560            /**
561             * Returns the layout finder.
562             *
563             * @return the layout finder
564             */
565            public LayoutFinder getLayoutFinder() {
566                    return layoutFinder;
567            }
568    
569            /**
570             * Sets the layout finder.
571             *
572             * @param layoutFinder the layout finder
573             */
574            public void setLayoutFinder(LayoutFinder layoutFinder) {
575                    this.layoutFinder = layoutFinder;
576            }
577    
578            /**
579             * Returns the portlet preferences local service.
580             *
581             * @return the portlet preferences local service
582             */
583            public com.liferay.portal.service.PortletPreferencesLocalService getPortletPreferencesLocalService() {
584                    return portletPreferencesLocalService;
585            }
586    
587            /**
588             * Sets the portlet preferences local service.
589             *
590             * @param portletPreferencesLocalService the portlet preferences local service
591             */
592            public void setPortletPreferencesLocalService(
593                    com.liferay.portal.service.PortletPreferencesLocalService portletPreferencesLocalService) {
594                    this.portletPreferencesLocalService = portletPreferencesLocalService;
595            }
596    
597            /**
598             * Returns the portlet preferences persistence.
599             *
600             * @return the portlet preferences persistence
601             */
602            public PortletPreferencesPersistence getPortletPreferencesPersistence() {
603                    return portletPreferencesPersistence;
604            }
605    
606            /**
607             * Sets the portlet preferences persistence.
608             *
609             * @param portletPreferencesPersistence the portlet preferences persistence
610             */
611            public void setPortletPreferencesPersistence(
612                    PortletPreferencesPersistence portletPreferencesPersistence) {
613                    this.portletPreferencesPersistence = portletPreferencesPersistence;
614            }
615    
616            /**
617             * Returns the portlet preferences finder.
618             *
619             * @return the portlet preferences finder
620             */
621            public PortletPreferencesFinder getPortletPreferencesFinder() {
622                    return portletPreferencesFinder;
623            }
624    
625            /**
626             * Sets the portlet preferences finder.
627             *
628             * @param portletPreferencesFinder the portlet preferences finder
629             */
630            public void setPortletPreferencesFinder(
631                    PortletPreferencesFinder portletPreferencesFinder) {
632                    this.portletPreferencesFinder = portletPreferencesFinder;
633            }
634    
635            /**
636             * Returns the resource local service.
637             *
638             * @return the resource local service
639             */
640            public com.liferay.portal.service.ResourceLocalService getResourceLocalService() {
641                    return resourceLocalService;
642            }
643    
644            /**
645             * Sets the resource local service.
646             *
647             * @param resourceLocalService the resource local service
648             */
649            public void setResourceLocalService(
650                    com.liferay.portal.service.ResourceLocalService resourceLocalService) {
651                    this.resourceLocalService = resourceLocalService;
652            }
653    
654            /**
655             * Returns the user local service.
656             *
657             * @return the user local service
658             */
659            public com.liferay.portal.service.UserLocalService getUserLocalService() {
660                    return userLocalService;
661            }
662    
663            /**
664             * Sets the user local service.
665             *
666             * @param userLocalService the user local service
667             */
668            public void setUserLocalService(
669                    com.liferay.portal.service.UserLocalService userLocalService) {
670                    this.userLocalService = userLocalService;
671            }
672    
673            /**
674             * Returns the user persistence.
675             *
676             * @return the user persistence
677             */
678            public UserPersistence getUserPersistence() {
679                    return userPersistence;
680            }
681    
682            /**
683             * Sets the user persistence.
684             *
685             * @param userPersistence the user persistence
686             */
687            public void setUserPersistence(UserPersistence userPersistence) {
688                    this.userPersistence = userPersistence;
689            }
690    
691            /**
692             * Returns the user finder.
693             *
694             * @return the user finder
695             */
696            public UserFinder getUserFinder() {
697                    return userFinder;
698            }
699    
700            /**
701             * Sets the user finder.
702             *
703             * @param userFinder the user finder
704             */
705            public void setUserFinder(UserFinder userFinder) {
706                    this.userFinder = userFinder;
707            }
708    
709            public void afterPropertiesSet() {
710                    persistedModelLocalServiceRegistry.register("com.liferay.portal.model.LayoutPrototype",
711                            layoutPrototypeLocalService);
712            }
713    
714            public void destroy() {
715                    persistedModelLocalServiceRegistry.unregister(
716                            "com.liferay.portal.model.LayoutPrototype");
717            }
718    
719            /**
720             * Returns the OSGi service identifier.
721             *
722             * @return the OSGi service identifier
723             */
724            @Override
725            public String getOSGiServiceIdentifier() {
726                    return LayoutPrototypeLocalService.class.getName();
727            }
728    
729            protected Class<?> getModelClass() {
730                    return LayoutPrototype.class;
731            }
732    
733            protected String getModelClassName() {
734                    return LayoutPrototype.class.getName();
735            }
736    
737            /**
738             * Performs a SQL query.
739             *
740             * @param sql the sql query
741             */
742            protected void runSQL(String sql) {
743                    try {
744                            DataSource dataSource = layoutPrototypePersistence.getDataSource();
745    
746                            DB db = DBManagerUtil.getDB();
747    
748                            sql = db.buildSQL(sql);
749                            sql = PortalUtil.transformSQL(sql);
750    
751                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
752                                            sql, new int[0]);
753    
754                            sqlUpdate.update();
755                    }
756                    catch (Exception e) {
757                            throw new SystemException(e);
758                    }
759            }
760    
761            @BeanReference(type = com.liferay.portal.service.LayoutPrototypeLocalService.class)
762            protected LayoutPrototypeLocalService layoutPrototypeLocalService;
763            @BeanReference(type = LayoutPrototypePersistence.class)
764            protected LayoutPrototypePersistence layoutPrototypePersistence;
765            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
766            protected com.liferay.counter.service.CounterLocalService counterLocalService;
767            @BeanReference(type = com.liferay.portal.service.GroupLocalService.class)
768            protected com.liferay.portal.service.GroupLocalService groupLocalService;
769            @BeanReference(type = GroupPersistence.class)
770            protected GroupPersistence groupPersistence;
771            @BeanReference(type = GroupFinder.class)
772            protected GroupFinder groupFinder;
773            @BeanReference(type = com.liferay.portal.service.LayoutLocalService.class)
774            protected com.liferay.portal.service.LayoutLocalService layoutLocalService;
775            @BeanReference(type = LayoutPersistence.class)
776            protected LayoutPersistence layoutPersistence;
777            @BeanReference(type = LayoutFinder.class)
778            protected LayoutFinder layoutFinder;
779            @BeanReference(type = com.liferay.portal.service.PortletPreferencesLocalService.class)
780            protected com.liferay.portal.service.PortletPreferencesLocalService portletPreferencesLocalService;
781            @BeanReference(type = PortletPreferencesPersistence.class)
782            protected PortletPreferencesPersistence portletPreferencesPersistence;
783            @BeanReference(type = PortletPreferencesFinder.class)
784            protected PortletPreferencesFinder portletPreferencesFinder;
785            @BeanReference(type = com.liferay.portal.service.ResourceLocalService.class)
786            protected com.liferay.portal.service.ResourceLocalService resourceLocalService;
787            @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
788            protected com.liferay.portal.service.UserLocalService userLocalService;
789            @BeanReference(type = UserPersistence.class)
790            protected UserPersistence userPersistence;
791            @BeanReference(type = UserFinder.class)
792            protected UserFinder userFinder;
793            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
794            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
795    }