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.portlet.dynamicdatamapping.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.dao.orm.Property;
032    import com.liferay.portal.kernel.dao.orm.PropertyFactoryUtil;
033    import com.liferay.portal.kernel.exception.PortalException;
034    import com.liferay.portal.kernel.exception.SystemException;
035    import com.liferay.portal.kernel.search.Indexable;
036    import com.liferay.portal.kernel.search.IndexableType;
037    import com.liferay.portal.kernel.util.OrderByComparator;
038    import com.liferay.portal.model.PersistedModel;
039    import com.liferay.portal.service.BaseLocalServiceImpl;
040    import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
041    import com.liferay.portal.service.persistence.ClassNamePersistence;
042    import com.liferay.portal.service.persistence.GroupFinder;
043    import com.liferay.portal.service.persistence.GroupPersistence;
044    import com.liferay.portal.service.persistence.ImagePersistence;
045    import com.liferay.portal.service.persistence.SystemEventPersistence;
046    import com.liferay.portal.service.persistence.UserFinder;
047    import com.liferay.portal.service.persistence.UserPersistence;
048    import com.liferay.portal.util.PortalUtil;
049    
050    import com.liferay.portlet.dynamicdatamapping.model.DDMTemplate;
051    import com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLocalService;
052    import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructureFinder;
053    import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMStructurePersistence;
054    import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMTemplateFinder;
055    import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMTemplateLinkPersistence;
056    import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMTemplatePersistence;
057    import com.liferay.portlet.dynamicdatamapping.service.persistence.DDMTemplateVersionPersistence;
058    import com.liferay.portlet.exportimport.lar.ExportImportHelperUtil;
059    import com.liferay.portlet.exportimport.lar.ManifestSummary;
060    import com.liferay.portlet.exportimport.lar.PortletDataContext;
061    import com.liferay.portlet.exportimport.lar.StagedModelDataHandlerUtil;
062    import com.liferay.portlet.exportimport.lar.StagedModelType;
063    
064    import java.io.Serializable;
065    
066    import java.util.List;
067    
068    import javax.sql.DataSource;
069    
070    /**
071     * Provides the base implementation for the d d m template local service.
072     *
073     * <p>
074     * 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.portlet.dynamicdatamapping.service.impl.DDMTemplateLocalServiceImpl}.
075     * </p>
076     *
077     * @author Brian Wing Shun Chan
078     * @see com.liferay.portlet.dynamicdatamapping.service.impl.DDMTemplateLocalServiceImpl
079     * @see com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLocalServiceUtil
080     * @generated
081     */
082    @ProviderType
083    public abstract class DDMTemplateLocalServiceBaseImpl
084            extends BaseLocalServiceImpl implements DDMTemplateLocalService,
085                    IdentifiableBean {
086            /*
087             * NOTE FOR DEVELOPERS:
088             *
089             * Never modify or reference this class directly. Always use {@link com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLocalServiceUtil} to access the d d m template local service.
090             */
091    
092            /**
093             * Adds the d d m template to the database. Also notifies the appropriate model listeners.
094             *
095             * @param ddmTemplate the d d m template
096             * @return the d d m template that was added
097             */
098            @Indexable(type = IndexableType.REINDEX)
099            @Override
100            public DDMTemplate addDDMTemplate(DDMTemplate ddmTemplate) {
101                    ddmTemplate.setNew(true);
102    
103                    return ddmTemplatePersistence.update(ddmTemplate);
104            }
105    
106            /**
107             * Creates a new d d m template with the primary key. Does not add the d d m template to the database.
108             *
109             * @param templateId the primary key for the new d d m template
110             * @return the new d d m template
111             */
112            @Override
113            public DDMTemplate createDDMTemplate(long templateId) {
114                    return ddmTemplatePersistence.create(templateId);
115            }
116    
117            /**
118             * Deletes the d d m template with the primary key from the database. Also notifies the appropriate model listeners.
119             *
120             * @param templateId the primary key of the d d m template
121             * @return the d d m template that was removed
122             * @throws PortalException if a d d m template with the primary key could not be found
123             */
124            @Indexable(type = IndexableType.DELETE)
125            @Override
126            public DDMTemplate deleteDDMTemplate(long templateId)
127                    throws PortalException {
128                    return ddmTemplatePersistence.remove(templateId);
129            }
130    
131            /**
132             * Deletes the d d m template from the database. Also notifies the appropriate model listeners.
133             *
134             * @param ddmTemplate the d d m template
135             * @return the d d m template that was removed
136             */
137            @Indexable(type = IndexableType.DELETE)
138            @Override
139            public DDMTemplate deleteDDMTemplate(DDMTemplate ddmTemplate) {
140                    return ddmTemplatePersistence.remove(ddmTemplate);
141            }
142    
143            @Override
144            public DynamicQuery dynamicQuery() {
145                    Class<?> clazz = getClass();
146    
147                    return DynamicQueryFactoryUtil.forClass(DDMTemplate.class,
148                            clazz.getClassLoader());
149            }
150    
151            /**
152             * Performs a dynamic query on the database and returns the matching rows.
153             *
154             * @param dynamicQuery the dynamic query
155             * @return the matching rows
156             */
157            @Override
158            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
159                    return ddmTemplatePersistence.findWithDynamicQuery(dynamicQuery);
160            }
161    
162            /**
163             * Performs a dynamic query on the database and returns a range of the matching rows.
164             *
165             * <p>
166             * 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.portlet.dynamicdatamapping.model.impl.DDMTemplateModelImpl}. 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.
167             * </p>
168             *
169             * @param dynamicQuery the dynamic query
170             * @param start the lower bound of the range of model instances
171             * @param end the upper bound of the range of model instances (not inclusive)
172             * @return the range of matching rows
173             */
174            @Override
175            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
176                    int end) {
177                    return ddmTemplatePersistence.findWithDynamicQuery(dynamicQuery, start,
178                            end);
179            }
180    
181            /**
182             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
183             *
184             * <p>
185             * 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.portlet.dynamicdatamapping.model.impl.DDMTemplateModelImpl}. 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.
186             * </p>
187             *
188             * @param dynamicQuery the dynamic query
189             * @param start the lower bound of the range of model instances
190             * @param end the upper bound of the range of model instances (not inclusive)
191             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
192             * @return the ordered range of matching rows
193             */
194            @Override
195            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
196                    int end, OrderByComparator<T> orderByComparator) {
197                    return ddmTemplatePersistence.findWithDynamicQuery(dynamicQuery, start,
198                            end, orderByComparator);
199            }
200    
201            /**
202             * Returns the number of rows matching the dynamic query.
203             *
204             * @param dynamicQuery the dynamic query
205             * @return the number of rows matching the dynamic query
206             */
207            @Override
208            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
209                    return ddmTemplatePersistence.countWithDynamicQuery(dynamicQuery);
210            }
211    
212            /**
213             * Returns the number of rows matching the dynamic query.
214             *
215             * @param dynamicQuery the dynamic query
216             * @param projection the projection to apply to the query
217             * @return the number of rows matching the dynamic query
218             */
219            @Override
220            public long dynamicQueryCount(DynamicQuery dynamicQuery,
221                    Projection projection) {
222                    return ddmTemplatePersistence.countWithDynamicQuery(dynamicQuery,
223                            projection);
224            }
225    
226            @Override
227            public DDMTemplate fetchDDMTemplate(long templateId) {
228                    return ddmTemplatePersistence.fetchByPrimaryKey(templateId);
229            }
230    
231            /**
232             * Returns the d d m template matching the UUID and group.
233             *
234             * @param uuid the d d m template's UUID
235             * @param groupId the primary key of the group
236             * @return the matching d d m template, or <code>null</code> if a matching d d m template could not be found
237             */
238            @Override
239            public DDMTemplate fetchDDMTemplateByUuidAndGroupId(String uuid,
240                    long groupId) {
241                    return ddmTemplatePersistence.fetchByUUID_G(uuid, groupId);
242            }
243    
244            /**
245             * Returns the d d m template with the primary key.
246             *
247             * @param templateId the primary key of the d d m template
248             * @return the d d m template
249             * @throws PortalException if a d d m template with the primary key could not be found
250             */
251            @Override
252            public DDMTemplate getDDMTemplate(long templateId)
253                    throws PortalException {
254                    return ddmTemplatePersistence.findByPrimaryKey(templateId);
255            }
256    
257            @Override
258            public ActionableDynamicQuery getActionableDynamicQuery() {
259                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
260    
261                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLocalServiceUtil.getService());
262                    actionableDynamicQuery.setClass(DDMTemplate.class);
263                    actionableDynamicQuery.setClassLoader(getClassLoader());
264    
265                    actionableDynamicQuery.setPrimaryKeyPropertyName("templateId");
266    
267                    return actionableDynamicQuery;
268            }
269    
270            protected void initActionableDynamicQuery(
271                    ActionableDynamicQuery actionableDynamicQuery) {
272                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLocalServiceUtil.getService());
273                    actionableDynamicQuery.setClass(DDMTemplate.class);
274                    actionableDynamicQuery.setClassLoader(getClassLoader());
275    
276                    actionableDynamicQuery.setPrimaryKeyPropertyName("templateId");
277            }
278    
279            @Override
280            public ExportActionableDynamicQuery getExportActionableDynamicQuery(
281                    final PortletDataContext portletDataContext) {
282                    final ExportActionableDynamicQuery exportActionableDynamicQuery = new ExportActionableDynamicQuery() {
283                                    @Override
284                                    public long performCount() throws PortalException {
285                                            ManifestSummary manifestSummary = portletDataContext.getManifestSummary();
286    
287                                            StagedModelType stagedModelType = getStagedModelType();
288    
289                                            long modelAdditionCount = super.performCount();
290    
291                                            manifestSummary.addModelAdditionCount(stagedModelType.toString(),
292                                                    modelAdditionCount);
293    
294                                            long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext,
295                                                            stagedModelType);
296    
297                                            manifestSummary.addModelDeletionCount(stagedModelType.toString(),
298                                                    modelDeletionCount);
299    
300                                            return modelAdditionCount;
301                                    }
302                            };
303    
304                    initActionableDynamicQuery(exportActionableDynamicQuery);
305    
306                    exportActionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() {
307                                    @Override
308                                    public void addCriteria(DynamicQuery dynamicQuery) {
309                                            portletDataContext.addDateRangeCriteria(dynamicQuery,
310                                                    "modifiedDate");
311    
312                                            StagedModelType stagedModelType = exportActionableDynamicQuery.getStagedModelType();
313    
314                                            if (stagedModelType.getReferrerClassNameId() >= 0) {
315                                                    Property classNameIdProperty = PropertyFactoryUtil.forName(
316                                                                    "classNameId");
317    
318                                                    dynamicQuery.add(classNameIdProperty.eq(
319                                                                    stagedModelType.getReferrerClassNameId()));
320                                            }
321                                    }
322                            });
323    
324                    exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId());
325    
326                    exportActionableDynamicQuery.setGroupId(portletDataContext.getScopeGroupId());
327    
328                    exportActionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod() {
329                                    @Override
330                                    public void performAction(Object object)
331                                            throws PortalException {
332                                            DDMTemplate stagedModel = (DDMTemplate)object;
333    
334                                            StagedModelDataHandlerUtil.exportStagedModel(portletDataContext,
335                                                    stagedModel);
336                                    }
337                            });
338                    exportActionableDynamicQuery.setStagedModelType(new StagedModelType(
339                                    PortalUtil.getClassNameId(DDMTemplate.class.getName())));
340    
341                    return exportActionableDynamicQuery;
342            }
343    
344            /**
345             * @throws PortalException
346             */
347            @Override
348            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
349                    throws PortalException {
350                    return ddmTemplateLocalService.deleteDDMTemplate((DDMTemplate)persistedModel);
351            }
352    
353            @Override
354            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
355                    throws PortalException {
356                    return ddmTemplatePersistence.findByPrimaryKey(primaryKeyObj);
357            }
358    
359            /**
360             * Returns all the d d m templates matching the UUID and company.
361             *
362             * @param uuid the UUID of the d d m templates
363             * @param companyId the primary key of the company
364             * @return the matching d d m templates, or an empty list if no matches were found
365             */
366            @Override
367            public List<DDMTemplate> getDDMTemplatesByUuidAndCompanyId(String uuid,
368                    long companyId) {
369                    return ddmTemplatePersistence.findByUuid_C(uuid, companyId);
370            }
371    
372            /**
373             * Returns a range of d d m templates matching the UUID and company.
374             *
375             * @param uuid the UUID of the d d m templates
376             * @param companyId the primary key of the company
377             * @param start the lower bound of the range of d d m templates
378             * @param end the upper bound of the range of d d m templates (not inclusive)
379             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
380             * @return the range of matching d d m templates, or an empty list if no matches were found
381             */
382            @Override
383            public List<DDMTemplate> getDDMTemplatesByUuidAndCompanyId(String uuid,
384                    long companyId, int start, int end,
385                    OrderByComparator<DDMTemplate> orderByComparator) {
386                    return ddmTemplatePersistence.findByUuid_C(uuid, companyId, start, end,
387                            orderByComparator);
388            }
389    
390            /**
391             * Returns the d d m template matching the UUID and group.
392             *
393             * @param uuid the d d m template's UUID
394             * @param groupId the primary key of the group
395             * @return the matching d d m template
396             * @throws PortalException if a matching d d m template could not be found
397             */
398            @Override
399            public DDMTemplate getDDMTemplateByUuidAndGroupId(String uuid, long groupId)
400                    throws PortalException {
401                    return ddmTemplatePersistence.findByUUID_G(uuid, groupId);
402            }
403    
404            /**
405             * Returns a range of all the d d m templates.
406             *
407             * <p>
408             * 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.portlet.dynamicdatamapping.model.impl.DDMTemplateModelImpl}. 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.
409             * </p>
410             *
411             * @param start the lower bound of the range of d d m templates
412             * @param end the upper bound of the range of d d m templates (not inclusive)
413             * @return the range of d d m templates
414             */
415            @Override
416            public List<DDMTemplate> getDDMTemplates(int start, int end) {
417                    return ddmTemplatePersistence.findAll(start, end);
418            }
419    
420            /**
421             * Returns the number of d d m templates.
422             *
423             * @return the number of d d m templates
424             */
425            @Override
426            public int getDDMTemplatesCount() {
427                    return ddmTemplatePersistence.countAll();
428            }
429    
430            /**
431             * Updates the d d m template in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
432             *
433             * @param ddmTemplate the d d m template
434             * @return the d d m template that was updated
435             */
436            @Indexable(type = IndexableType.REINDEX)
437            @Override
438            public DDMTemplate updateDDMTemplate(DDMTemplate ddmTemplate) {
439                    return ddmTemplatePersistence.update(ddmTemplate);
440            }
441    
442            /**
443             * Returns the d d m template local service.
444             *
445             * @return the d d m template local service
446             */
447            public DDMTemplateLocalService getDDMTemplateLocalService() {
448                    return ddmTemplateLocalService;
449            }
450    
451            /**
452             * Sets the d d m template local service.
453             *
454             * @param ddmTemplateLocalService the d d m template local service
455             */
456            public void setDDMTemplateLocalService(
457                    DDMTemplateLocalService ddmTemplateLocalService) {
458                    this.ddmTemplateLocalService = ddmTemplateLocalService;
459            }
460    
461            /**
462             * Returns the d d m template remote service.
463             *
464             * @return the d d m template remote service
465             */
466            public com.liferay.portlet.dynamicdatamapping.service.DDMTemplateService getDDMTemplateService() {
467                    return ddmTemplateService;
468            }
469    
470            /**
471             * Sets the d d m template remote service.
472             *
473             * @param ddmTemplateService the d d m template remote service
474             */
475            public void setDDMTemplateService(
476                    com.liferay.portlet.dynamicdatamapping.service.DDMTemplateService ddmTemplateService) {
477                    this.ddmTemplateService = ddmTemplateService;
478            }
479    
480            /**
481             * Returns the d d m template persistence.
482             *
483             * @return the d d m template persistence
484             */
485            public DDMTemplatePersistence getDDMTemplatePersistence() {
486                    return ddmTemplatePersistence;
487            }
488    
489            /**
490             * Sets the d d m template persistence.
491             *
492             * @param ddmTemplatePersistence the d d m template persistence
493             */
494            public void setDDMTemplatePersistence(
495                    DDMTemplatePersistence ddmTemplatePersistence) {
496                    this.ddmTemplatePersistence = ddmTemplatePersistence;
497            }
498    
499            /**
500             * Returns the d d m template finder.
501             *
502             * @return the d d m template finder
503             */
504            public DDMTemplateFinder getDDMTemplateFinder() {
505                    return ddmTemplateFinder;
506            }
507    
508            /**
509             * Sets the d d m template finder.
510             *
511             * @param ddmTemplateFinder the d d m template finder
512             */
513            public void setDDMTemplateFinder(DDMTemplateFinder ddmTemplateFinder) {
514                    this.ddmTemplateFinder = ddmTemplateFinder;
515            }
516    
517            /**
518             * Returns the counter local service.
519             *
520             * @return the counter local service
521             */
522            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
523                    return counterLocalService;
524            }
525    
526            /**
527             * Sets the counter local service.
528             *
529             * @param counterLocalService the counter local service
530             */
531            public void setCounterLocalService(
532                    com.liferay.counter.service.CounterLocalService counterLocalService) {
533                    this.counterLocalService = counterLocalService;
534            }
535    
536            /**
537             * Returns the class name local service.
538             *
539             * @return the class name local service
540             */
541            public com.liferay.portal.service.ClassNameLocalService getClassNameLocalService() {
542                    return classNameLocalService;
543            }
544    
545            /**
546             * Sets the class name local service.
547             *
548             * @param classNameLocalService the class name local service
549             */
550            public void setClassNameLocalService(
551                    com.liferay.portal.service.ClassNameLocalService classNameLocalService) {
552                    this.classNameLocalService = classNameLocalService;
553            }
554    
555            /**
556             * Returns the class name remote service.
557             *
558             * @return the class name remote service
559             */
560            public com.liferay.portal.service.ClassNameService getClassNameService() {
561                    return classNameService;
562            }
563    
564            /**
565             * Sets the class name remote service.
566             *
567             * @param classNameService the class name remote service
568             */
569            public void setClassNameService(
570                    com.liferay.portal.service.ClassNameService classNameService) {
571                    this.classNameService = classNameService;
572            }
573    
574            /**
575             * Returns the class name persistence.
576             *
577             * @return the class name persistence
578             */
579            public ClassNamePersistence getClassNamePersistence() {
580                    return classNamePersistence;
581            }
582    
583            /**
584             * Sets the class name persistence.
585             *
586             * @param classNamePersistence the class name persistence
587             */
588            public void setClassNamePersistence(
589                    ClassNamePersistence classNamePersistence) {
590                    this.classNamePersistence = classNamePersistence;
591            }
592    
593            /**
594             * Returns the group local service.
595             *
596             * @return the group local service
597             */
598            public com.liferay.portal.service.GroupLocalService getGroupLocalService() {
599                    return groupLocalService;
600            }
601    
602            /**
603             * Sets the group local service.
604             *
605             * @param groupLocalService the group local service
606             */
607            public void setGroupLocalService(
608                    com.liferay.portal.service.GroupLocalService groupLocalService) {
609                    this.groupLocalService = groupLocalService;
610            }
611    
612            /**
613             * Returns the group remote service.
614             *
615             * @return the group remote service
616             */
617            public com.liferay.portal.service.GroupService getGroupService() {
618                    return groupService;
619            }
620    
621            /**
622             * Sets the group remote service.
623             *
624             * @param groupService the group remote service
625             */
626            public void setGroupService(
627                    com.liferay.portal.service.GroupService groupService) {
628                    this.groupService = groupService;
629            }
630    
631            /**
632             * Returns the group persistence.
633             *
634             * @return the group persistence
635             */
636            public GroupPersistence getGroupPersistence() {
637                    return groupPersistence;
638            }
639    
640            /**
641             * Sets the group persistence.
642             *
643             * @param groupPersistence the group persistence
644             */
645            public void setGroupPersistence(GroupPersistence groupPersistence) {
646                    this.groupPersistence = groupPersistence;
647            }
648    
649            /**
650             * Returns the group finder.
651             *
652             * @return the group finder
653             */
654            public GroupFinder getGroupFinder() {
655                    return groupFinder;
656            }
657    
658            /**
659             * Sets the group finder.
660             *
661             * @param groupFinder the group finder
662             */
663            public void setGroupFinder(GroupFinder groupFinder) {
664                    this.groupFinder = groupFinder;
665            }
666    
667            /**
668             * Returns the image local service.
669             *
670             * @return the image local service
671             */
672            public com.liferay.portal.service.ImageLocalService getImageLocalService() {
673                    return imageLocalService;
674            }
675    
676            /**
677             * Sets the image local service.
678             *
679             * @param imageLocalService the image local service
680             */
681            public void setImageLocalService(
682                    com.liferay.portal.service.ImageLocalService imageLocalService) {
683                    this.imageLocalService = imageLocalService;
684            }
685    
686            /**
687             * Returns the image remote service.
688             *
689             * @return the image remote service
690             */
691            public com.liferay.portal.service.ImageService getImageService() {
692                    return imageService;
693            }
694    
695            /**
696             * Sets the image remote service.
697             *
698             * @param imageService the image remote service
699             */
700            public void setImageService(
701                    com.liferay.portal.service.ImageService imageService) {
702                    this.imageService = imageService;
703            }
704    
705            /**
706             * Returns the image persistence.
707             *
708             * @return the image persistence
709             */
710            public ImagePersistence getImagePersistence() {
711                    return imagePersistence;
712            }
713    
714            /**
715             * Sets the image persistence.
716             *
717             * @param imagePersistence the image persistence
718             */
719            public void setImagePersistence(ImagePersistence imagePersistence) {
720                    this.imagePersistence = imagePersistence;
721            }
722    
723            /**
724             * Returns the resource local service.
725             *
726             * @return the resource local service
727             */
728            public com.liferay.portal.service.ResourceLocalService getResourceLocalService() {
729                    return resourceLocalService;
730            }
731    
732            /**
733             * Sets the resource local service.
734             *
735             * @param resourceLocalService the resource local service
736             */
737            public void setResourceLocalService(
738                    com.liferay.portal.service.ResourceLocalService resourceLocalService) {
739                    this.resourceLocalService = resourceLocalService;
740            }
741    
742            /**
743             * Returns the system event local service.
744             *
745             * @return the system event local service
746             */
747            public com.liferay.portal.service.SystemEventLocalService getSystemEventLocalService() {
748                    return systemEventLocalService;
749            }
750    
751            /**
752             * Sets the system event local service.
753             *
754             * @param systemEventLocalService the system event local service
755             */
756            public void setSystemEventLocalService(
757                    com.liferay.portal.service.SystemEventLocalService systemEventLocalService) {
758                    this.systemEventLocalService = systemEventLocalService;
759            }
760    
761            /**
762             * Returns the system event persistence.
763             *
764             * @return the system event persistence
765             */
766            public SystemEventPersistence getSystemEventPersistence() {
767                    return systemEventPersistence;
768            }
769    
770            /**
771             * Sets the system event persistence.
772             *
773             * @param systemEventPersistence the system event persistence
774             */
775            public void setSystemEventPersistence(
776                    SystemEventPersistence systemEventPersistence) {
777                    this.systemEventPersistence = systemEventPersistence;
778            }
779    
780            /**
781             * Returns the user local service.
782             *
783             * @return the user local service
784             */
785            public com.liferay.portal.service.UserLocalService getUserLocalService() {
786                    return userLocalService;
787            }
788    
789            /**
790             * Sets the user local service.
791             *
792             * @param userLocalService the user local service
793             */
794            public void setUserLocalService(
795                    com.liferay.portal.service.UserLocalService userLocalService) {
796                    this.userLocalService = userLocalService;
797            }
798    
799            /**
800             * Returns the user remote service.
801             *
802             * @return the user remote service
803             */
804            public com.liferay.portal.service.UserService getUserService() {
805                    return userService;
806            }
807    
808            /**
809             * Sets the user remote service.
810             *
811             * @param userService the user remote service
812             */
813            public void setUserService(
814                    com.liferay.portal.service.UserService userService) {
815                    this.userService = userService;
816            }
817    
818            /**
819             * Returns the user persistence.
820             *
821             * @return the user persistence
822             */
823            public UserPersistence getUserPersistence() {
824                    return userPersistence;
825            }
826    
827            /**
828             * Sets the user persistence.
829             *
830             * @param userPersistence the user persistence
831             */
832            public void setUserPersistence(UserPersistence userPersistence) {
833                    this.userPersistence = userPersistence;
834            }
835    
836            /**
837             * Returns the user finder.
838             *
839             * @return the user finder
840             */
841            public UserFinder getUserFinder() {
842                    return userFinder;
843            }
844    
845            /**
846             * Sets the user finder.
847             *
848             * @param userFinder the user finder
849             */
850            public void setUserFinder(UserFinder userFinder) {
851                    this.userFinder = userFinder;
852            }
853    
854            /**
855             * Returns the d d m structure local service.
856             *
857             * @return the d d m structure local service
858             */
859            public com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalService getDDMStructureLocalService() {
860                    return ddmStructureLocalService;
861            }
862    
863            /**
864             * Sets the d d m structure local service.
865             *
866             * @param ddmStructureLocalService the d d m structure local service
867             */
868            public void setDDMStructureLocalService(
869                    com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalService ddmStructureLocalService) {
870                    this.ddmStructureLocalService = ddmStructureLocalService;
871            }
872    
873            /**
874             * Returns the d d m structure remote service.
875             *
876             * @return the d d m structure remote service
877             */
878            public com.liferay.portlet.dynamicdatamapping.service.DDMStructureService getDDMStructureService() {
879                    return ddmStructureService;
880            }
881    
882            /**
883             * Sets the d d m structure remote service.
884             *
885             * @param ddmStructureService the d d m structure remote service
886             */
887            public void setDDMStructureService(
888                    com.liferay.portlet.dynamicdatamapping.service.DDMStructureService ddmStructureService) {
889                    this.ddmStructureService = ddmStructureService;
890            }
891    
892            /**
893             * Returns the d d m structure persistence.
894             *
895             * @return the d d m structure persistence
896             */
897            public DDMStructurePersistence getDDMStructurePersistence() {
898                    return ddmStructurePersistence;
899            }
900    
901            /**
902             * Sets the d d m structure persistence.
903             *
904             * @param ddmStructurePersistence the d d m structure persistence
905             */
906            public void setDDMStructurePersistence(
907                    DDMStructurePersistence ddmStructurePersistence) {
908                    this.ddmStructurePersistence = ddmStructurePersistence;
909            }
910    
911            /**
912             * Returns the d d m structure finder.
913             *
914             * @return the d d m structure finder
915             */
916            public DDMStructureFinder getDDMStructureFinder() {
917                    return ddmStructureFinder;
918            }
919    
920            /**
921             * Sets the d d m structure finder.
922             *
923             * @param ddmStructureFinder the d d m structure finder
924             */
925            public void setDDMStructureFinder(DDMStructureFinder ddmStructureFinder) {
926                    this.ddmStructureFinder = ddmStructureFinder;
927            }
928    
929            /**
930             * Returns the d d m template link local service.
931             *
932             * @return the d d m template link local service
933             */
934            public com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLinkLocalService getDDMTemplateLinkLocalService() {
935                    return ddmTemplateLinkLocalService;
936            }
937    
938            /**
939             * Sets the d d m template link local service.
940             *
941             * @param ddmTemplateLinkLocalService the d d m template link local service
942             */
943            public void setDDMTemplateLinkLocalService(
944                    com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLinkLocalService ddmTemplateLinkLocalService) {
945                    this.ddmTemplateLinkLocalService = ddmTemplateLinkLocalService;
946            }
947    
948            /**
949             * Returns the d d m template link persistence.
950             *
951             * @return the d d m template link persistence
952             */
953            public DDMTemplateLinkPersistence getDDMTemplateLinkPersistence() {
954                    return ddmTemplateLinkPersistence;
955            }
956    
957            /**
958             * Sets the d d m template link persistence.
959             *
960             * @param ddmTemplateLinkPersistence the d d m template link persistence
961             */
962            public void setDDMTemplateLinkPersistence(
963                    DDMTemplateLinkPersistence ddmTemplateLinkPersistence) {
964                    this.ddmTemplateLinkPersistence = ddmTemplateLinkPersistence;
965            }
966    
967            /**
968             * Returns the d d m template version local service.
969             *
970             * @return the d d m template version local service
971             */
972            public com.liferay.portlet.dynamicdatamapping.service.DDMTemplateVersionLocalService getDDMTemplateVersionLocalService() {
973                    return ddmTemplateVersionLocalService;
974            }
975    
976            /**
977             * Sets the d d m template version local service.
978             *
979             * @param ddmTemplateVersionLocalService the d d m template version local service
980             */
981            public void setDDMTemplateVersionLocalService(
982                    com.liferay.portlet.dynamicdatamapping.service.DDMTemplateVersionLocalService ddmTemplateVersionLocalService) {
983                    this.ddmTemplateVersionLocalService = ddmTemplateVersionLocalService;
984            }
985    
986            /**
987             * Returns the d d m template version remote service.
988             *
989             * @return the d d m template version remote service
990             */
991            public com.liferay.portlet.dynamicdatamapping.service.DDMTemplateVersionService getDDMTemplateVersionService() {
992                    return ddmTemplateVersionService;
993            }
994    
995            /**
996             * Sets the d d m template version remote service.
997             *
998             * @param ddmTemplateVersionService the d d m template version remote service
999             */
1000            public void setDDMTemplateVersionService(
1001                    com.liferay.portlet.dynamicdatamapping.service.DDMTemplateVersionService ddmTemplateVersionService) {
1002                    this.ddmTemplateVersionService = ddmTemplateVersionService;
1003            }
1004    
1005            /**
1006             * Returns the d d m template version persistence.
1007             *
1008             * @return the d d m template version persistence
1009             */
1010            public DDMTemplateVersionPersistence getDDMTemplateVersionPersistence() {
1011                    return ddmTemplateVersionPersistence;
1012            }
1013    
1014            /**
1015             * Sets the d d m template version persistence.
1016             *
1017             * @param ddmTemplateVersionPersistence the d d m template version persistence
1018             */
1019            public void setDDMTemplateVersionPersistence(
1020                    DDMTemplateVersionPersistence ddmTemplateVersionPersistence) {
1021                    this.ddmTemplateVersionPersistence = ddmTemplateVersionPersistence;
1022            }
1023    
1024            public void afterPropertiesSet() {
1025                    persistedModelLocalServiceRegistry.register("com.liferay.portlet.dynamicdatamapping.model.DDMTemplate",
1026                            ddmTemplateLocalService);
1027            }
1028    
1029            public void destroy() {
1030                    persistedModelLocalServiceRegistry.unregister(
1031                            "com.liferay.portlet.dynamicdatamapping.model.DDMTemplate");
1032            }
1033    
1034            /**
1035             * Returns the Spring bean ID for this bean.
1036             *
1037             * @return the Spring bean ID for this bean
1038             */
1039            @Override
1040            public String getBeanIdentifier() {
1041                    return _beanIdentifier;
1042            }
1043    
1044            /**
1045             * Sets the Spring bean ID for this bean.
1046             *
1047             * @param beanIdentifier the Spring bean ID for this bean
1048             */
1049            @Override
1050            public void setBeanIdentifier(String beanIdentifier) {
1051                    _beanIdentifier = beanIdentifier;
1052            }
1053    
1054            protected Class<?> getModelClass() {
1055                    return DDMTemplate.class;
1056            }
1057    
1058            protected String getModelClassName() {
1059                    return DDMTemplate.class.getName();
1060            }
1061    
1062            /**
1063             * Performs a SQL query.
1064             *
1065             * @param sql the sql query
1066             */
1067            protected void runSQL(String sql) {
1068                    try {
1069                            DataSource dataSource = ddmTemplatePersistence.getDataSource();
1070    
1071                            DB db = DBFactoryUtil.getDB();
1072    
1073                            sql = db.buildSQL(sql);
1074                            sql = PortalUtil.transformSQL(sql);
1075    
1076                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
1077                                            sql, new int[0]);
1078    
1079                            sqlUpdate.update();
1080                    }
1081                    catch (Exception e) {
1082                            throw new SystemException(e);
1083                    }
1084            }
1085    
1086            @BeanReference(type = DDMTemplateLocalService.class)
1087            protected DDMTemplateLocalService ddmTemplateLocalService;
1088            @BeanReference(type = com.liferay.portlet.dynamicdatamapping.service.DDMTemplateService.class)
1089            protected com.liferay.portlet.dynamicdatamapping.service.DDMTemplateService ddmTemplateService;
1090            @BeanReference(type = DDMTemplatePersistence.class)
1091            protected DDMTemplatePersistence ddmTemplatePersistence;
1092            @BeanReference(type = DDMTemplateFinder.class)
1093            protected DDMTemplateFinder ddmTemplateFinder;
1094            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
1095            protected com.liferay.counter.service.CounterLocalService counterLocalService;
1096            @BeanReference(type = com.liferay.portal.service.ClassNameLocalService.class)
1097            protected com.liferay.portal.service.ClassNameLocalService classNameLocalService;
1098            @BeanReference(type = com.liferay.portal.service.ClassNameService.class)
1099            protected com.liferay.portal.service.ClassNameService classNameService;
1100            @BeanReference(type = ClassNamePersistence.class)
1101            protected ClassNamePersistence classNamePersistence;
1102            @BeanReference(type = com.liferay.portal.service.GroupLocalService.class)
1103            protected com.liferay.portal.service.GroupLocalService groupLocalService;
1104            @BeanReference(type = com.liferay.portal.service.GroupService.class)
1105            protected com.liferay.portal.service.GroupService groupService;
1106            @BeanReference(type = GroupPersistence.class)
1107            protected GroupPersistence groupPersistence;
1108            @BeanReference(type = GroupFinder.class)
1109            protected GroupFinder groupFinder;
1110            @BeanReference(type = com.liferay.portal.service.ImageLocalService.class)
1111            protected com.liferay.portal.service.ImageLocalService imageLocalService;
1112            @BeanReference(type = com.liferay.portal.service.ImageService.class)
1113            protected com.liferay.portal.service.ImageService imageService;
1114            @BeanReference(type = ImagePersistence.class)
1115            protected ImagePersistence imagePersistence;
1116            @BeanReference(type = com.liferay.portal.service.ResourceLocalService.class)
1117            protected com.liferay.portal.service.ResourceLocalService resourceLocalService;
1118            @BeanReference(type = com.liferay.portal.service.SystemEventLocalService.class)
1119            protected com.liferay.portal.service.SystemEventLocalService systemEventLocalService;
1120            @BeanReference(type = SystemEventPersistence.class)
1121            protected SystemEventPersistence systemEventPersistence;
1122            @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
1123            protected com.liferay.portal.service.UserLocalService userLocalService;
1124            @BeanReference(type = com.liferay.portal.service.UserService.class)
1125            protected com.liferay.portal.service.UserService userService;
1126            @BeanReference(type = UserPersistence.class)
1127            protected UserPersistence userPersistence;
1128            @BeanReference(type = UserFinder.class)
1129            protected UserFinder userFinder;
1130            @BeanReference(type = com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalService.class)
1131            protected com.liferay.portlet.dynamicdatamapping.service.DDMStructureLocalService ddmStructureLocalService;
1132            @BeanReference(type = com.liferay.portlet.dynamicdatamapping.service.DDMStructureService.class)
1133            protected com.liferay.portlet.dynamicdatamapping.service.DDMStructureService ddmStructureService;
1134            @BeanReference(type = DDMStructurePersistence.class)
1135            protected DDMStructurePersistence ddmStructurePersistence;
1136            @BeanReference(type = DDMStructureFinder.class)
1137            protected DDMStructureFinder ddmStructureFinder;
1138            @BeanReference(type = com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLinkLocalService.class)
1139            protected com.liferay.portlet.dynamicdatamapping.service.DDMTemplateLinkLocalService ddmTemplateLinkLocalService;
1140            @BeanReference(type = DDMTemplateLinkPersistence.class)
1141            protected DDMTemplateLinkPersistence ddmTemplateLinkPersistence;
1142            @BeanReference(type = com.liferay.portlet.dynamicdatamapping.service.DDMTemplateVersionLocalService.class)
1143            protected com.liferay.portlet.dynamicdatamapping.service.DDMTemplateVersionLocalService ddmTemplateVersionLocalService;
1144            @BeanReference(type = com.liferay.portlet.dynamicdatamapping.service.DDMTemplateVersionService.class)
1145            protected com.liferay.portlet.dynamicdatamapping.service.DDMTemplateVersionService ddmTemplateVersionService;
1146            @BeanReference(type = DDMTemplateVersionPersistence.class)
1147            protected DDMTemplateVersionPersistence ddmTemplateVersionPersistence;
1148            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
1149            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
1150            private String _beanIdentifier;
1151    }