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