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