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