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.mobiledevicerules.service.base;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.BeanReference;
020    import com.liferay.portal.kernel.bean.IdentifiableBean;
021    import com.liferay.portal.kernel.dao.db.DB;
022    import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
023    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
024    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
025    import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
026    import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery;
027    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
028    import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
029    import com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery;
030    import com.liferay.portal.kernel.dao.orm.Projection;
031    import com.liferay.portal.kernel.exception.PortalException;
032    import com.liferay.portal.kernel.exception.SystemException;
033    import com.liferay.portal.kernel.lar.ExportImportHelperUtil;
034    import com.liferay.portal.kernel.lar.ManifestSummary;
035    import com.liferay.portal.kernel.lar.PortletDataContext;
036    import com.liferay.portal.kernel.lar.StagedModelDataHandlerUtil;
037    import com.liferay.portal.kernel.lar.StagedModelType;
038    import com.liferay.portal.kernel.search.Indexable;
039    import com.liferay.portal.kernel.search.IndexableType;
040    import com.liferay.portal.kernel.util.OrderByComparator;
041    import com.liferay.portal.model.PersistedModel;
042    import com.liferay.portal.service.BaseLocalServiceImpl;
043    import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
044    import com.liferay.portal.service.persistence.SystemEventPersistence;
045    import com.liferay.portal.service.persistence.UserFinder;
046    import com.liferay.portal.service.persistence.UserPersistence;
047    import com.liferay.portal.util.PortalUtil;
048    
049    import com.liferay.portlet.mobiledevicerules.model.MDRRule;
050    import com.liferay.portlet.mobiledevicerules.service.MDRRuleLocalService;
051    import com.liferay.portlet.mobiledevicerules.service.persistence.MDRRuleGroupFinder;
052    import com.liferay.portlet.mobiledevicerules.service.persistence.MDRRuleGroupPersistence;
053    import com.liferay.portlet.mobiledevicerules.service.persistence.MDRRulePersistence;
054    
055    import java.io.Serializable;
056    
057    import java.util.List;
058    
059    import javax.sql.DataSource;
060    
061    /**
062     * Provides the base implementation for the m d r rule local service.
063     *
064     * <p>
065     * 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.mobiledevicerules.service.impl.MDRRuleLocalServiceImpl}.
066     * </p>
067     *
068     * @author Edward C. Han
069     * @see com.liferay.portlet.mobiledevicerules.service.impl.MDRRuleLocalServiceImpl
070     * @see com.liferay.portlet.mobiledevicerules.service.MDRRuleLocalServiceUtil
071     * @generated
072     */
073    @ProviderType
074    public abstract class MDRRuleLocalServiceBaseImpl extends BaseLocalServiceImpl
075            implements MDRRuleLocalService, IdentifiableBean {
076            /*
077             * NOTE FOR DEVELOPERS:
078             *
079             * Never modify or reference this class directly. Always use {@link com.liferay.portlet.mobiledevicerules.service.MDRRuleLocalServiceUtil} to access the m d r rule local service.
080             */
081    
082            /**
083             * Adds the m d r rule to the database. Also notifies the appropriate model listeners.
084             *
085             * @param mdrRule the m d r rule
086             * @return the m d r rule that was added
087             */
088            @Indexable(type = IndexableType.REINDEX)
089            @Override
090            public MDRRule addMDRRule(MDRRule mdrRule) {
091                    mdrRule.setNew(true);
092    
093                    return mdrRulePersistence.update(mdrRule);
094            }
095    
096            /**
097             * Creates a new m d r rule with the primary key. Does not add the m d r rule to the database.
098             *
099             * @param ruleId the primary key for the new m d r rule
100             * @return the new m d r rule
101             */
102            @Override
103            public MDRRule createMDRRule(long ruleId) {
104                    return mdrRulePersistence.create(ruleId);
105            }
106    
107            /**
108             * Deletes the m d r rule with the primary key from the database. Also notifies the appropriate model listeners.
109             *
110             * @param ruleId the primary key of the m d r rule
111             * @return the m d r rule that was removed
112             * @throws PortalException if a m d r rule with the primary key could not be found
113             */
114            @Indexable(type = IndexableType.DELETE)
115            @Override
116            public MDRRule deleteMDRRule(long ruleId) throws PortalException {
117                    return mdrRulePersistence.remove(ruleId);
118            }
119    
120            /**
121             * Deletes the m d r rule from the database. Also notifies the appropriate model listeners.
122             *
123             * @param mdrRule the m d r rule
124             * @return the m d r rule that was removed
125             */
126            @Indexable(type = IndexableType.DELETE)
127            @Override
128            public MDRRule deleteMDRRule(MDRRule mdrRule) {
129                    return mdrRulePersistence.remove(mdrRule);
130            }
131    
132            @Override
133            public DynamicQuery dynamicQuery() {
134                    Class<?> clazz = getClass();
135    
136                    return DynamicQueryFactoryUtil.forClass(MDRRule.class,
137                            clazz.getClassLoader());
138            }
139    
140            /**
141             * Performs a dynamic query on the database and returns the matching rows.
142             *
143             * @param dynamicQuery the dynamic query
144             * @return the matching rows
145             */
146            @Override
147            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
148                    return mdrRulePersistence.findWithDynamicQuery(dynamicQuery);
149            }
150    
151            /**
152             * Performs a dynamic query on the database and returns a range of the matching rows.
153             *
154             * <p>
155             * 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.mobiledevicerules.model.impl.MDRRuleModelImpl}. 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.
156             * </p>
157             *
158             * @param dynamicQuery the dynamic query
159             * @param start the lower bound of the range of model instances
160             * @param end the upper bound of the range of model instances (not inclusive)
161             * @return the range of matching rows
162             */
163            @Override
164            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
165                    int end) {
166                    return mdrRulePersistence.findWithDynamicQuery(dynamicQuery, start, end);
167            }
168    
169            /**
170             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
171             *
172             * <p>
173             * 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.mobiledevicerules.model.impl.MDRRuleModelImpl}. 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.
174             * </p>
175             *
176             * @param dynamicQuery the dynamic query
177             * @param start the lower bound of the range of model instances
178             * @param end the upper bound of the range of model instances (not inclusive)
179             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
180             * @return the ordered range of matching rows
181             */
182            @Override
183            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
184                    int end, OrderByComparator<T> orderByComparator) {
185                    return mdrRulePersistence.findWithDynamicQuery(dynamicQuery, start,
186                            end, orderByComparator);
187            }
188    
189            /**
190             * Returns the number of rows that match the dynamic query.
191             *
192             * @param dynamicQuery the dynamic query
193             * @return the number of rows that match the dynamic query
194             */
195            @Override
196            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
197                    return mdrRulePersistence.countWithDynamicQuery(dynamicQuery);
198            }
199    
200            /**
201             * Returns the number of rows that match the dynamic query.
202             *
203             * @param dynamicQuery the dynamic query
204             * @param projection the projection to apply to the query
205             * @return the number of rows that match the dynamic query
206             */
207            @Override
208            public long dynamicQueryCount(DynamicQuery dynamicQuery,
209                    Projection projection) {
210                    return mdrRulePersistence.countWithDynamicQuery(dynamicQuery, projection);
211            }
212    
213            @Override
214            public MDRRule fetchMDRRule(long ruleId) {
215                    return mdrRulePersistence.fetchByPrimaryKey(ruleId);
216            }
217    
218            /**
219             * Returns the m d r rule matching the UUID and group.
220             *
221             * @param uuid the m d r rule's UUID
222             * @param groupId the primary key of the group
223             * @return the matching m d r rule, or <code>null</code> if a matching m d r rule could not be found
224             */
225            @Override
226            public MDRRule fetchMDRRuleByUuidAndGroupId(String uuid, long groupId) {
227                    return mdrRulePersistence.fetchByUUID_G(uuid, groupId);
228            }
229    
230            /**
231             * Returns the m d r rule with the primary key.
232             *
233             * @param ruleId the primary key of the m d r rule
234             * @return the m d r rule
235             * @throws PortalException if a m d r rule with the primary key could not be found
236             */
237            @Override
238            public MDRRule getMDRRule(long ruleId) throws PortalException {
239                    return mdrRulePersistence.findByPrimaryKey(ruleId);
240            }
241    
242            @Override
243            public ActionableDynamicQuery getActionableDynamicQuery() {
244                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
245    
246                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.mobiledevicerules.service.MDRRuleLocalServiceUtil.getService());
247                    actionableDynamicQuery.setClass(MDRRule.class);
248                    actionableDynamicQuery.setClassLoader(getClassLoader());
249    
250                    actionableDynamicQuery.setPrimaryKeyPropertyName("ruleId");
251    
252                    return actionableDynamicQuery;
253            }
254    
255            protected void initActionableDynamicQuery(
256                    ActionableDynamicQuery actionableDynamicQuery) {
257                    actionableDynamicQuery.setBaseLocalService(com.liferay.portlet.mobiledevicerules.service.MDRRuleLocalServiceUtil.getService());
258                    actionableDynamicQuery.setClass(MDRRule.class);
259                    actionableDynamicQuery.setClassLoader(getClassLoader());
260    
261                    actionableDynamicQuery.setPrimaryKeyPropertyName("ruleId");
262            }
263    
264            @Override
265            public ExportActionableDynamicQuery getExportActionableDynamicQuery(
266                    final PortletDataContext portletDataContext) {
267                    final ExportActionableDynamicQuery exportActionableDynamicQuery = new ExportActionableDynamicQuery() {
268                                    @Override
269                                    public long performCount() throws PortalException {
270                                            ManifestSummary manifestSummary = portletDataContext.getManifestSummary();
271    
272                                            StagedModelType stagedModelType = getStagedModelType();
273    
274                                            long modelAdditionCount = super.performCount();
275    
276                                            manifestSummary.addModelAdditionCount(stagedModelType.toString(),
277                                                    modelAdditionCount);
278    
279                                            long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext,
280                                                            stagedModelType);
281    
282                                            manifestSummary.addModelDeletionCount(stagedModelType.toString(),
283                                                    modelDeletionCount);
284    
285                                            return modelAdditionCount;
286                                    }
287                            };
288    
289                    initActionableDynamicQuery(exportActionableDynamicQuery);
290    
291                    exportActionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() {
292                                    @Override
293                                    public void addCriteria(DynamicQuery dynamicQuery) {
294                                            portletDataContext.addDateRangeCriteria(dynamicQuery,
295                                                    "modifiedDate");
296                                    }
297                            });
298    
299                    exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId());
300    
301                    exportActionableDynamicQuery.setGroupId(portletDataContext.getScopeGroupId());
302    
303                    exportActionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod() {
304                                    @Override
305                                    public void performAction(Object object)
306                                            throws PortalException {
307                                            MDRRule stagedModel = (MDRRule)object;
308    
309                                            StagedModelDataHandlerUtil.exportStagedModel(portletDataContext,
310                                                    stagedModel);
311                                    }
312                            });
313                    exportActionableDynamicQuery.setStagedModelType(new StagedModelType(
314                                    PortalUtil.getClassNameId(MDRRule.class.getName())));
315    
316                    return exportActionableDynamicQuery;
317            }
318    
319            /**
320             * @throws PortalException
321             */
322            @Override
323            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
324                    throws PortalException {
325                    return mdrRuleLocalService.deleteMDRRule((MDRRule)persistedModel);
326            }
327    
328            @Override
329            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
330                    throws PortalException {
331                    return mdrRulePersistence.findByPrimaryKey(primaryKeyObj);
332            }
333    
334            @Override
335            public List<MDRRule> getMDRRulesByUuidAndCompanyId(String uuid,
336                    long companyId) {
337                    return mdrRulePersistence.findByUuid_C(uuid, companyId);
338            }
339    
340            @Override
341            public List<MDRRule> getMDRRulesByUuidAndCompanyId(String uuid,
342                    long companyId, int start, int end,
343                    OrderByComparator<MDRRule> orderByComparator) {
344                    return mdrRulePersistence.findByUuid_C(uuid, companyId, start, end,
345                            orderByComparator);
346            }
347    
348            /**
349             * Returns the m d r rule matching the UUID and group.
350             *
351             * @param uuid the m d r rule's UUID
352             * @param groupId the primary key of the group
353             * @return the matching m d r rule
354             * @throws PortalException if a matching m d r rule could not be found
355             */
356            @Override
357            public MDRRule getMDRRuleByUuidAndGroupId(String uuid, long groupId)
358                    throws PortalException {
359                    return mdrRulePersistence.findByUUID_G(uuid, groupId);
360            }
361    
362            /**
363             * Returns a range of all the m d r rules.
364             *
365             * <p>
366             * 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.mobiledevicerules.model.impl.MDRRuleModelImpl}. 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.
367             * </p>
368             *
369             * @param start the lower bound of the range of m d r rules
370             * @param end the upper bound of the range of m d r rules (not inclusive)
371             * @return the range of m d r rules
372             */
373            @Override
374            public List<MDRRule> getMDRRules(int start, int end) {
375                    return mdrRulePersistence.findAll(start, end);
376            }
377    
378            /**
379             * Returns the number of m d r rules.
380             *
381             * @return the number of m d r rules
382             */
383            @Override
384            public int getMDRRulesCount() {
385                    return mdrRulePersistence.countAll();
386            }
387    
388            /**
389             * Updates the m d r rule in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
390             *
391             * @param mdrRule the m d r rule
392             * @return the m d r rule that was updated
393             */
394            @Indexable(type = IndexableType.REINDEX)
395            @Override
396            public MDRRule updateMDRRule(MDRRule mdrRule) {
397                    return mdrRulePersistence.update(mdrRule);
398            }
399    
400            /**
401             * Returns the m d r rule local service.
402             *
403             * @return the m d r rule local service
404             */
405            public com.liferay.portlet.mobiledevicerules.service.MDRRuleLocalService getMDRRuleLocalService() {
406                    return mdrRuleLocalService;
407            }
408    
409            /**
410             * Sets the m d r rule local service.
411             *
412             * @param mdrRuleLocalService the m d r rule local service
413             */
414            public void setMDRRuleLocalService(
415                    com.liferay.portlet.mobiledevicerules.service.MDRRuleLocalService mdrRuleLocalService) {
416                    this.mdrRuleLocalService = mdrRuleLocalService;
417            }
418    
419            /**
420             * Returns the m d r rule remote service.
421             *
422             * @return the m d r rule remote service
423             */
424            public com.liferay.portlet.mobiledevicerules.service.MDRRuleService getMDRRuleService() {
425                    return mdrRuleService;
426            }
427    
428            /**
429             * Sets the m d r rule remote service.
430             *
431             * @param mdrRuleService the m d r rule remote service
432             */
433            public void setMDRRuleService(
434                    com.liferay.portlet.mobiledevicerules.service.MDRRuleService mdrRuleService) {
435                    this.mdrRuleService = mdrRuleService;
436            }
437    
438            /**
439             * Returns the m d r rule persistence.
440             *
441             * @return the m d r rule persistence
442             */
443            public MDRRulePersistence getMDRRulePersistence() {
444                    return mdrRulePersistence;
445            }
446    
447            /**
448             * Sets the m d r rule persistence.
449             *
450             * @param mdrRulePersistence the m d r rule persistence
451             */
452            public void setMDRRulePersistence(MDRRulePersistence mdrRulePersistence) {
453                    this.mdrRulePersistence = mdrRulePersistence;
454            }
455    
456            /**
457             * Returns the counter local service.
458             *
459             * @return the counter local service
460             */
461            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
462                    return counterLocalService;
463            }
464    
465            /**
466             * Sets the counter local service.
467             *
468             * @param counterLocalService the counter local service
469             */
470            public void setCounterLocalService(
471                    com.liferay.counter.service.CounterLocalService counterLocalService) {
472                    this.counterLocalService = counterLocalService;
473            }
474    
475            /**
476             * Returns the system event local service.
477             *
478             * @return the system event local service
479             */
480            public com.liferay.portal.service.SystemEventLocalService getSystemEventLocalService() {
481                    return systemEventLocalService;
482            }
483    
484            /**
485             * Sets the system event local service.
486             *
487             * @param systemEventLocalService the system event local service
488             */
489            public void setSystemEventLocalService(
490                    com.liferay.portal.service.SystemEventLocalService systemEventLocalService) {
491                    this.systemEventLocalService = systemEventLocalService;
492            }
493    
494            /**
495             * Returns the system event persistence.
496             *
497             * @return the system event persistence
498             */
499            public SystemEventPersistence getSystemEventPersistence() {
500                    return systemEventPersistence;
501            }
502    
503            /**
504             * Sets the system event persistence.
505             *
506             * @param systemEventPersistence the system event persistence
507             */
508            public void setSystemEventPersistence(
509                    SystemEventPersistence systemEventPersistence) {
510                    this.systemEventPersistence = systemEventPersistence;
511            }
512    
513            /**
514             * Returns the user local service.
515             *
516             * @return the user local service
517             */
518            public com.liferay.portal.service.UserLocalService getUserLocalService() {
519                    return userLocalService;
520            }
521    
522            /**
523             * Sets the user local service.
524             *
525             * @param userLocalService the user local service
526             */
527            public void setUserLocalService(
528                    com.liferay.portal.service.UserLocalService userLocalService) {
529                    this.userLocalService = userLocalService;
530            }
531    
532            /**
533             * Returns the user remote service.
534             *
535             * @return the user remote service
536             */
537            public com.liferay.portal.service.UserService getUserService() {
538                    return userService;
539            }
540    
541            /**
542             * Sets the user remote service.
543             *
544             * @param userService the user remote service
545             */
546            public void setUserService(
547                    com.liferay.portal.service.UserService userService) {
548                    this.userService = userService;
549            }
550    
551            /**
552             * Returns the user persistence.
553             *
554             * @return the user persistence
555             */
556            public UserPersistence getUserPersistence() {
557                    return userPersistence;
558            }
559    
560            /**
561             * Sets the user persistence.
562             *
563             * @param userPersistence the user persistence
564             */
565            public void setUserPersistence(UserPersistence userPersistence) {
566                    this.userPersistence = userPersistence;
567            }
568    
569            /**
570             * Returns the user finder.
571             *
572             * @return the user finder
573             */
574            public UserFinder getUserFinder() {
575                    return userFinder;
576            }
577    
578            /**
579             * Sets the user finder.
580             *
581             * @param userFinder the user finder
582             */
583            public void setUserFinder(UserFinder userFinder) {
584                    this.userFinder = userFinder;
585            }
586    
587            /**
588             * Returns the m d r rule group local service.
589             *
590             * @return the m d r rule group local service
591             */
592            public com.liferay.portlet.mobiledevicerules.service.MDRRuleGroupLocalService getMDRRuleGroupLocalService() {
593                    return mdrRuleGroupLocalService;
594            }
595    
596            /**
597             * Sets the m d r rule group local service.
598             *
599             * @param mdrRuleGroupLocalService the m d r rule group local service
600             */
601            public void setMDRRuleGroupLocalService(
602                    com.liferay.portlet.mobiledevicerules.service.MDRRuleGroupLocalService mdrRuleGroupLocalService) {
603                    this.mdrRuleGroupLocalService = mdrRuleGroupLocalService;
604            }
605    
606            /**
607             * Returns the m d r rule group remote service.
608             *
609             * @return the m d r rule group remote service
610             */
611            public com.liferay.portlet.mobiledevicerules.service.MDRRuleGroupService getMDRRuleGroupService() {
612                    return mdrRuleGroupService;
613            }
614    
615            /**
616             * Sets the m d r rule group remote service.
617             *
618             * @param mdrRuleGroupService the m d r rule group remote service
619             */
620            public void setMDRRuleGroupService(
621                    com.liferay.portlet.mobiledevicerules.service.MDRRuleGroupService mdrRuleGroupService) {
622                    this.mdrRuleGroupService = mdrRuleGroupService;
623            }
624    
625            /**
626             * Returns the m d r rule group persistence.
627             *
628             * @return the m d r rule group persistence
629             */
630            public MDRRuleGroupPersistence getMDRRuleGroupPersistence() {
631                    return mdrRuleGroupPersistence;
632            }
633    
634            /**
635             * Sets the m d r rule group persistence.
636             *
637             * @param mdrRuleGroupPersistence the m d r rule group persistence
638             */
639            public void setMDRRuleGroupPersistence(
640                    MDRRuleGroupPersistence mdrRuleGroupPersistence) {
641                    this.mdrRuleGroupPersistence = mdrRuleGroupPersistence;
642            }
643    
644            /**
645             * Returns the m d r rule group finder.
646             *
647             * @return the m d r rule group finder
648             */
649            public MDRRuleGroupFinder getMDRRuleGroupFinder() {
650                    return mdrRuleGroupFinder;
651            }
652    
653            /**
654             * Sets the m d r rule group finder.
655             *
656             * @param mdrRuleGroupFinder the m d r rule group finder
657             */
658            public void setMDRRuleGroupFinder(MDRRuleGroupFinder mdrRuleGroupFinder) {
659                    this.mdrRuleGroupFinder = mdrRuleGroupFinder;
660            }
661    
662            public void afterPropertiesSet() {
663                    persistedModelLocalServiceRegistry.register("com.liferay.portlet.mobiledevicerules.model.MDRRule",
664                            mdrRuleLocalService);
665            }
666    
667            public void destroy() {
668                    persistedModelLocalServiceRegistry.unregister(
669                            "com.liferay.portlet.mobiledevicerules.model.MDRRule");
670            }
671    
672            /**
673             * Returns the Spring bean ID for this bean.
674             *
675             * @return the Spring bean ID for this bean
676             */
677            @Override
678            public String getBeanIdentifier() {
679                    return _beanIdentifier;
680            }
681    
682            /**
683             * Sets the Spring bean ID for this bean.
684             *
685             * @param beanIdentifier the Spring bean ID for this bean
686             */
687            @Override
688            public void setBeanIdentifier(String beanIdentifier) {
689                    _beanIdentifier = beanIdentifier;
690            }
691    
692            protected Class<?> getModelClass() {
693                    return MDRRule.class;
694            }
695    
696            protected String getModelClassName() {
697                    return MDRRule.class.getName();
698            }
699    
700            /**
701             * Performs a SQL query.
702             *
703             * @param sql the sql query
704             */
705            protected void runSQL(String sql) {
706                    try {
707                            DataSource dataSource = mdrRulePersistence.getDataSource();
708    
709                            DB db = DBFactoryUtil.getDB();
710    
711                            sql = db.buildSQL(sql);
712                            sql = PortalUtil.transformSQL(sql);
713    
714                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
715                                            sql, new int[0]);
716    
717                            sqlUpdate.update();
718                    }
719                    catch (Exception e) {
720                            throw new SystemException(e);
721                    }
722            }
723    
724            @BeanReference(type = com.liferay.portlet.mobiledevicerules.service.MDRRuleLocalService.class)
725            protected com.liferay.portlet.mobiledevicerules.service.MDRRuleLocalService mdrRuleLocalService;
726            @BeanReference(type = com.liferay.portlet.mobiledevicerules.service.MDRRuleService.class)
727            protected com.liferay.portlet.mobiledevicerules.service.MDRRuleService mdrRuleService;
728            @BeanReference(type = MDRRulePersistence.class)
729            protected MDRRulePersistence mdrRulePersistence;
730            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
731            protected com.liferay.counter.service.CounterLocalService counterLocalService;
732            @BeanReference(type = com.liferay.portal.service.SystemEventLocalService.class)
733            protected com.liferay.portal.service.SystemEventLocalService systemEventLocalService;
734            @BeanReference(type = SystemEventPersistence.class)
735            protected SystemEventPersistence systemEventPersistence;
736            @BeanReference(type = com.liferay.portal.service.UserLocalService.class)
737            protected com.liferay.portal.service.UserLocalService userLocalService;
738            @BeanReference(type = com.liferay.portal.service.UserService.class)
739            protected com.liferay.portal.service.UserService userService;
740            @BeanReference(type = UserPersistence.class)
741            protected UserPersistence userPersistence;
742            @BeanReference(type = UserFinder.class)
743            protected UserFinder userFinder;
744            @BeanReference(type = com.liferay.portlet.mobiledevicerules.service.MDRRuleGroupLocalService.class)
745            protected com.liferay.portlet.mobiledevicerules.service.MDRRuleGroupLocalService mdrRuleGroupLocalService;
746            @BeanReference(type = com.liferay.portlet.mobiledevicerules.service.MDRRuleGroupService.class)
747            protected com.liferay.portlet.mobiledevicerules.service.MDRRuleGroupService mdrRuleGroupService;
748            @BeanReference(type = MDRRuleGroupPersistence.class)
749            protected MDRRuleGroupPersistence mdrRuleGroupPersistence;
750            @BeanReference(type = MDRRuleGroupFinder.class)
751            protected MDRRuleGroupFinder mdrRuleGroupFinder;
752            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
753            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
754            private String _beanIdentifier;
755    }