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