001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.base;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.BeanReference;
020    import com.liferay.portal.kernel.dao.db.DB;
021    import com.liferay.portal.kernel.dao.db.DBManagerUtil;
022    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
023    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
024    import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
025    import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery;
026    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
027    import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
028    import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery;
029    import com.liferay.portal.kernel.dao.orm.Projection;
030    import com.liferay.portal.kernel.exception.PortalException;
031    import com.liferay.portal.kernel.exception.SystemException;
032    import com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService;
033    import com.liferay.portal.kernel.search.Indexable;
034    import com.liferay.portal.kernel.search.IndexableType;
035    import com.liferay.portal.kernel.util.OrderByComparator;
036    import com.liferay.portal.model.PersistedModel;
037    import com.liferay.portal.model.UserGroupGroupRole;
038    import com.liferay.portal.service.BaseLocalServiceImpl;
039    import com.liferay.portal.service.PersistedModelLocalServiceRegistry;
040    import com.liferay.portal.service.UserGroupGroupRoleLocalService;
041    import com.liferay.portal.service.persistence.RoleFinder;
042    import com.liferay.portal.service.persistence.RolePersistence;
043    import com.liferay.portal.service.persistence.UserGroupFinder;
044    import com.liferay.portal.service.persistence.UserGroupGroupRoleFinder;
045    import com.liferay.portal.service.persistence.UserGroupGroupRolePK;
046    import com.liferay.portal.service.persistence.UserGroupGroupRolePersistence;
047    import com.liferay.portal.service.persistence.UserGroupPersistence;
048    import com.liferay.portal.util.PortalUtil;
049    
050    import java.io.Serializable;
051    
052    import java.util.List;
053    
054    import javax.sql.DataSource;
055    
056    /**
057     * Provides the base implementation for the user group group role local service.
058     *
059     * <p>
060     * This implementation exists only as a container for the default service methods generated by ServiceBuilder. All custom service methods should be put in {@link com.liferay.portal.service.impl.UserGroupGroupRoleLocalServiceImpl}.
061     * </p>
062     *
063     * @author Brian Wing Shun Chan
064     * @see com.liferay.portal.service.impl.UserGroupGroupRoleLocalServiceImpl
065     * @see com.liferay.portal.service.UserGroupGroupRoleLocalServiceUtil
066     * @generated
067     */
068    @ProviderType
069    public abstract class UserGroupGroupRoleLocalServiceBaseImpl
070            extends BaseLocalServiceImpl implements UserGroupGroupRoleLocalService,
071                    IdentifiableOSGiService {
072            /*
073             * NOTE FOR DEVELOPERS:
074             *
075             * Never modify or reference this class directly. Always use {@link com.liferay.portal.service.UserGroupGroupRoleLocalServiceUtil} to access the user group group role local service.
076             */
077    
078            /**
079             * Adds the user group group role to the database. Also notifies the appropriate model listeners.
080             *
081             * @param userGroupGroupRole the user group group role
082             * @return the user group group role that was added
083             */
084            @Indexable(type = IndexableType.REINDEX)
085            @Override
086            public UserGroupGroupRole addUserGroupGroupRole(
087                    UserGroupGroupRole userGroupGroupRole) {
088                    userGroupGroupRole.setNew(true);
089    
090                    return userGroupGroupRolePersistence.update(userGroupGroupRole);
091            }
092    
093            /**
094             * Creates a new user group group role with the primary key. Does not add the user group group role to the database.
095             *
096             * @param userGroupGroupRolePK the primary key for the new user group group role
097             * @return the new user group group role
098             */
099            @Override
100            public UserGroupGroupRole createUserGroupGroupRole(
101                    UserGroupGroupRolePK userGroupGroupRolePK) {
102                    return userGroupGroupRolePersistence.create(userGroupGroupRolePK);
103            }
104    
105            /**
106             * Deletes the user group group role with the primary key from the database. Also notifies the appropriate model listeners.
107             *
108             * @param userGroupGroupRolePK the primary key of the user group group role
109             * @return the user group group role that was removed
110             * @throws PortalException if a user group group role with the primary key could not be found
111             */
112            @Indexable(type = IndexableType.DELETE)
113            @Override
114            public UserGroupGroupRole deleteUserGroupGroupRole(
115                    UserGroupGroupRolePK userGroupGroupRolePK) throws PortalException {
116                    return userGroupGroupRolePersistence.remove(userGroupGroupRolePK);
117            }
118    
119            /**
120             * Deletes the user group group role from the database. Also notifies the appropriate model listeners.
121             *
122             * @param userGroupGroupRole the user group group role
123             * @return the user group group role that was removed
124             */
125            @Indexable(type = IndexableType.DELETE)
126            @Override
127            public UserGroupGroupRole deleteUserGroupGroupRole(
128                    UserGroupGroupRole userGroupGroupRole) {
129                    return userGroupGroupRolePersistence.remove(userGroupGroupRole);
130            }
131    
132            @Override
133            public DynamicQuery dynamicQuery() {
134                    Class<?> clazz = getClass();
135    
136                    return DynamicQueryFactoryUtil.forClass(UserGroupGroupRole.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 userGroupGroupRolePersistence.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.portal.model.impl.UserGroupGroupRoleModelImpl}. 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 userGroupGroupRolePersistence.findWithDynamicQuery(dynamicQuery,
167                            start, end);
168            }
169    
170            /**
171             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
172             *
173             * <p>
174             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.UserGroupGroupRoleModelImpl}. 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.
175             * </p>
176             *
177             * @param dynamicQuery the dynamic query
178             * @param start the lower bound of the range of model instances
179             * @param end the upper bound of the range of model instances (not inclusive)
180             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
181             * @return the ordered range of matching rows
182             */
183            @Override
184            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
185                    int end, OrderByComparator<T> orderByComparator) {
186                    return userGroupGroupRolePersistence.findWithDynamicQuery(dynamicQuery,
187                            start, end, orderByComparator);
188            }
189    
190            /**
191             * Returns the number of rows matching the dynamic query.
192             *
193             * @param dynamicQuery the dynamic query
194             * @return the number of rows matching the dynamic query
195             */
196            @Override
197            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
198                    return userGroupGroupRolePersistence.countWithDynamicQuery(dynamicQuery);
199            }
200    
201            /**
202             * Returns the number of rows matching the dynamic query.
203             *
204             * @param dynamicQuery the dynamic query
205             * @param projection the projection to apply to the query
206             * @return the number of rows matching the dynamic query
207             */
208            @Override
209            public long dynamicQueryCount(DynamicQuery dynamicQuery,
210                    Projection projection) {
211                    return userGroupGroupRolePersistence.countWithDynamicQuery(dynamicQuery,
212                            projection);
213            }
214    
215            @Override
216            public UserGroupGroupRole fetchUserGroupGroupRole(
217                    UserGroupGroupRolePK userGroupGroupRolePK) {
218                    return userGroupGroupRolePersistence.fetchByPrimaryKey(userGroupGroupRolePK);
219            }
220    
221            /**
222             * Returns the user group group role with the primary key.
223             *
224             * @param userGroupGroupRolePK the primary key of the user group group role
225             * @return the user group group role
226             * @throws PortalException if a user group group role with the primary key could not be found
227             */
228            @Override
229            public UserGroupGroupRole getUserGroupGroupRole(
230                    UserGroupGroupRolePK userGroupGroupRolePK) throws PortalException {
231                    return userGroupGroupRolePersistence.findByPrimaryKey(userGroupGroupRolePK);
232            }
233    
234            @Override
235            public ActionableDynamicQuery getActionableDynamicQuery() {
236                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
237    
238                    actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.UserGroupGroupRoleLocalServiceUtil.getService());
239                    actionableDynamicQuery.setClassLoader(getClassLoader());
240                    actionableDynamicQuery.setModelClass(UserGroupGroupRole.class);
241    
242                    actionableDynamicQuery.setPrimaryKeyPropertyName(
243                            "primaryKey.userGroupId");
244    
245                    actionableDynamicQuery.setGroupIdPropertyName("primaryKey.groupId");
246    
247                    return actionableDynamicQuery;
248            }
249    
250            @Override
251            public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery() {
252                    IndexableActionableDynamicQuery indexableActionableDynamicQuery = new IndexableActionableDynamicQuery();
253    
254                    indexableActionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.UserGroupGroupRoleLocalServiceUtil.getService());
255                    indexableActionableDynamicQuery.setClassLoader(getClassLoader());
256                    indexableActionableDynamicQuery.setModelClass(UserGroupGroupRole.class);
257    
258                    indexableActionableDynamicQuery.setPrimaryKeyPropertyName(
259                            "primaryKey.userGroupId");
260    
261                    indexableActionableDynamicQuery.setGroupIdPropertyName(
262                            "primaryKey.groupId");
263    
264                    return indexableActionableDynamicQuery;
265            }
266    
267            protected void initActionableDynamicQuery(
268                    ActionableDynamicQuery actionableDynamicQuery) {
269                    actionableDynamicQuery.setBaseLocalService(com.liferay.portal.service.UserGroupGroupRoleLocalServiceUtil.getService());
270                    actionableDynamicQuery.setClassLoader(getClassLoader());
271                    actionableDynamicQuery.setModelClass(UserGroupGroupRole.class);
272    
273                    actionableDynamicQuery.setPrimaryKeyPropertyName(
274                            "primaryKey.userGroupId");
275    
276                    actionableDynamicQuery.setGroupIdPropertyName("primaryKey.groupId");
277            }
278    
279            /**
280             * @throws PortalException
281             */
282            @Override
283            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
284                    throws PortalException {
285                    return userGroupGroupRoleLocalService.deleteUserGroupGroupRole((UserGroupGroupRole)persistedModel);
286            }
287    
288            @Override
289            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
290                    throws PortalException {
291                    return userGroupGroupRolePersistence.findByPrimaryKey(primaryKeyObj);
292            }
293    
294            /**
295             * Returns a range of all the user group group roles.
296             *
297             * <p>
298             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.UserGroupGroupRoleModelImpl}. 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.
299             * </p>
300             *
301             * @param start the lower bound of the range of user group group roles
302             * @param end the upper bound of the range of user group group roles (not inclusive)
303             * @return the range of user group group roles
304             */
305            @Override
306            public List<UserGroupGroupRole> getUserGroupGroupRoles(int start, int end) {
307                    return userGroupGroupRolePersistence.findAll(start, end);
308            }
309    
310            /**
311             * Returns the number of user group group roles.
312             *
313             * @return the number of user group group roles
314             */
315            @Override
316            public int getUserGroupGroupRolesCount() {
317                    return userGroupGroupRolePersistence.countAll();
318            }
319    
320            /**
321             * Updates the user group group role in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
322             *
323             * @param userGroupGroupRole the user group group role
324             * @return the user group group role that was updated
325             */
326            @Indexable(type = IndexableType.REINDEX)
327            @Override
328            public UserGroupGroupRole updateUserGroupGroupRole(
329                    UserGroupGroupRole userGroupGroupRole) {
330                    return userGroupGroupRolePersistence.update(userGroupGroupRole);
331            }
332    
333            /**
334             * Returns the user group group role local service.
335             *
336             * @return the user group group role local service
337             */
338            public UserGroupGroupRoleLocalService getUserGroupGroupRoleLocalService() {
339                    return userGroupGroupRoleLocalService;
340            }
341    
342            /**
343             * Sets the user group group role local service.
344             *
345             * @param userGroupGroupRoleLocalService the user group group role local service
346             */
347            public void setUserGroupGroupRoleLocalService(
348                    UserGroupGroupRoleLocalService userGroupGroupRoleLocalService) {
349                    this.userGroupGroupRoleLocalService = userGroupGroupRoleLocalService;
350            }
351    
352            /**
353             * Returns the user group group role persistence.
354             *
355             * @return the user group group role persistence
356             */
357            public UserGroupGroupRolePersistence getUserGroupGroupRolePersistence() {
358                    return userGroupGroupRolePersistence;
359            }
360    
361            /**
362             * Sets the user group group role persistence.
363             *
364             * @param userGroupGroupRolePersistence the user group group role persistence
365             */
366            public void setUserGroupGroupRolePersistence(
367                    UserGroupGroupRolePersistence userGroupGroupRolePersistence) {
368                    this.userGroupGroupRolePersistence = userGroupGroupRolePersistence;
369            }
370    
371            /**
372             * Returns the user group group role finder.
373             *
374             * @return the user group group role finder
375             */
376            public UserGroupGroupRoleFinder getUserGroupGroupRoleFinder() {
377                    return userGroupGroupRoleFinder;
378            }
379    
380            /**
381             * Sets the user group group role finder.
382             *
383             * @param userGroupGroupRoleFinder the user group group role finder
384             */
385            public void setUserGroupGroupRoleFinder(
386                    UserGroupGroupRoleFinder userGroupGroupRoleFinder) {
387                    this.userGroupGroupRoleFinder = userGroupGroupRoleFinder;
388            }
389    
390            /**
391             * Returns the counter local service.
392             *
393             * @return the counter local service
394             */
395            public com.liferay.counter.service.CounterLocalService getCounterLocalService() {
396                    return counterLocalService;
397            }
398    
399            /**
400             * Sets the counter local service.
401             *
402             * @param counterLocalService the counter local service
403             */
404            public void setCounterLocalService(
405                    com.liferay.counter.service.CounterLocalService counterLocalService) {
406                    this.counterLocalService = counterLocalService;
407            }
408    
409            /**
410             * Returns the role local service.
411             *
412             * @return the role local service
413             */
414            public com.liferay.portal.service.RoleLocalService getRoleLocalService() {
415                    return roleLocalService;
416            }
417    
418            /**
419             * Sets the role local service.
420             *
421             * @param roleLocalService the role local service
422             */
423            public void setRoleLocalService(
424                    com.liferay.portal.service.RoleLocalService roleLocalService) {
425                    this.roleLocalService = roleLocalService;
426            }
427    
428            /**
429             * Returns the role persistence.
430             *
431             * @return the role persistence
432             */
433            public RolePersistence getRolePersistence() {
434                    return rolePersistence;
435            }
436    
437            /**
438             * Sets the role persistence.
439             *
440             * @param rolePersistence the role persistence
441             */
442            public void setRolePersistence(RolePersistence rolePersistence) {
443                    this.rolePersistence = rolePersistence;
444            }
445    
446            /**
447             * Returns the role finder.
448             *
449             * @return the role finder
450             */
451            public RoleFinder getRoleFinder() {
452                    return roleFinder;
453            }
454    
455            /**
456             * Sets the role finder.
457             *
458             * @param roleFinder the role finder
459             */
460            public void setRoleFinder(RoleFinder roleFinder) {
461                    this.roleFinder = roleFinder;
462            }
463    
464            /**
465             * Returns the user group local service.
466             *
467             * @return the user group local service
468             */
469            public com.liferay.portal.service.UserGroupLocalService getUserGroupLocalService() {
470                    return userGroupLocalService;
471            }
472    
473            /**
474             * Sets the user group local service.
475             *
476             * @param userGroupLocalService the user group local service
477             */
478            public void setUserGroupLocalService(
479                    com.liferay.portal.service.UserGroupLocalService userGroupLocalService) {
480                    this.userGroupLocalService = userGroupLocalService;
481            }
482    
483            /**
484             * Returns the user group persistence.
485             *
486             * @return the user group persistence
487             */
488            public UserGroupPersistence getUserGroupPersistence() {
489                    return userGroupPersistence;
490            }
491    
492            /**
493             * Sets the user group persistence.
494             *
495             * @param userGroupPersistence the user group persistence
496             */
497            public void setUserGroupPersistence(
498                    UserGroupPersistence userGroupPersistence) {
499                    this.userGroupPersistence = userGroupPersistence;
500            }
501    
502            /**
503             * Returns the user group finder.
504             *
505             * @return the user group finder
506             */
507            public UserGroupFinder getUserGroupFinder() {
508                    return userGroupFinder;
509            }
510    
511            /**
512             * Sets the user group finder.
513             *
514             * @param userGroupFinder the user group finder
515             */
516            public void setUserGroupFinder(UserGroupFinder userGroupFinder) {
517                    this.userGroupFinder = userGroupFinder;
518            }
519    
520            public void afterPropertiesSet() {
521                    persistedModelLocalServiceRegistry.register("com.liferay.portal.model.UserGroupGroupRole",
522                            userGroupGroupRoleLocalService);
523            }
524    
525            public void destroy() {
526                    persistedModelLocalServiceRegistry.unregister(
527                            "com.liferay.portal.model.UserGroupGroupRole");
528            }
529    
530            /**
531             * Returns the OSGi service identifier.
532             *
533             * @return the OSGi service identifier
534             */
535            @Override
536            public String getOSGiServiceIdentifier() {
537                    return UserGroupGroupRoleLocalService.class.getName();
538            }
539    
540            protected Class<?> getModelClass() {
541                    return UserGroupGroupRole.class;
542            }
543    
544            protected String getModelClassName() {
545                    return UserGroupGroupRole.class.getName();
546            }
547    
548            /**
549             * Performs a SQL query.
550             *
551             * @param sql the sql query
552             */
553            protected void runSQL(String sql) {
554                    try {
555                            DataSource dataSource = userGroupGroupRolePersistence.getDataSource();
556    
557                            DB db = DBManagerUtil.getDB();
558    
559                            sql = db.buildSQL(sql);
560                            sql = PortalUtil.transformSQL(sql);
561    
562                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
563                                            sql, new int[0]);
564    
565                            sqlUpdate.update();
566                    }
567                    catch (Exception e) {
568                            throw new SystemException(e);
569                    }
570            }
571    
572            @BeanReference(type = com.liferay.portal.service.UserGroupGroupRoleLocalService.class)
573            protected UserGroupGroupRoleLocalService userGroupGroupRoleLocalService;
574            @BeanReference(type = UserGroupGroupRolePersistence.class)
575            protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
576            @BeanReference(type = UserGroupGroupRoleFinder.class)
577            protected UserGroupGroupRoleFinder userGroupGroupRoleFinder;
578            @BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
579            protected com.liferay.counter.service.CounterLocalService counterLocalService;
580            @BeanReference(type = com.liferay.portal.service.RoleLocalService.class)
581            protected com.liferay.portal.service.RoleLocalService roleLocalService;
582            @BeanReference(type = RolePersistence.class)
583            protected RolePersistence rolePersistence;
584            @BeanReference(type = RoleFinder.class)
585            protected RoleFinder roleFinder;
586            @BeanReference(type = com.liferay.portal.service.UserGroupLocalService.class)
587            protected com.liferay.portal.service.UserGroupLocalService userGroupLocalService;
588            @BeanReference(type = UserGroupPersistence.class)
589            protected UserGroupPersistence userGroupPersistence;
590            @BeanReference(type = UserGroupFinder.class)
591            protected UserGroupFinder userGroupFinder;
592            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
593            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
594    }