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.expando.kernel.service.persistence.ExpandoRowPersistence;
020    
021    import com.liferay.exportimport.kernel.lar.ExportImportHelperUtil;
022    import com.liferay.exportimport.kernel.lar.ManifestSummary;
023    import com.liferay.exportimport.kernel.lar.PortletDataContext;
024    import com.liferay.exportimport.kernel.lar.StagedModelDataHandlerUtil;
025    import com.liferay.exportimport.kernel.lar.StagedModelType;
026    import com.liferay.exportimport.kernel.service.persistence.ExportImportConfigurationFinder;
027    import com.liferay.exportimport.kernel.service.persistence.ExportImportConfigurationPersistence;
028    
029    import com.liferay.portal.kernel.bean.BeanReference;
030    import com.liferay.portal.kernel.dao.db.DB;
031    import com.liferay.portal.kernel.dao.db.DBManagerUtil;
032    import com.liferay.portal.kernel.dao.jdbc.SqlUpdate;
033    import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil;
034    import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
035    import com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery;
036    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
037    import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil;
038    import com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery;
039    import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery;
040    import com.liferay.portal.kernel.dao.orm.Projection;
041    import com.liferay.portal.kernel.exception.PortalException;
042    import com.liferay.portal.kernel.exception.SystemException;
043    import com.liferay.portal.kernel.model.PersistedModel;
044    import com.liferay.portal.kernel.model.UserGroup;
045    import com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService;
046    import com.liferay.portal.kernel.search.Indexable;
047    import com.liferay.portal.kernel.search.IndexableType;
048    import com.liferay.portal.kernel.service.BaseLocalServiceImpl;
049    import com.liferay.portal.kernel.service.PersistedModelLocalServiceRegistry;
050    import com.liferay.portal.kernel.service.UserGroupLocalService;
051    import com.liferay.portal.kernel.service.persistence.GroupFinder;
052    import com.liferay.portal.kernel.service.persistence.GroupPersistence;
053    import com.liferay.portal.kernel.service.persistence.LayoutFinder;
054    import com.liferay.portal.kernel.service.persistence.LayoutPersistence;
055    import com.liferay.portal.kernel.service.persistence.TeamFinder;
056    import com.liferay.portal.kernel.service.persistence.TeamPersistence;
057    import com.liferay.portal.kernel.service.persistence.UserFinder;
058    import com.liferay.portal.kernel.service.persistence.UserGroupFinder;
059    import com.liferay.portal.kernel.service.persistence.UserGroupGroupRoleFinder;
060    import com.liferay.portal.kernel.service.persistence.UserGroupGroupRolePersistence;
061    import com.liferay.portal.kernel.service.persistence.UserGroupPersistence;
062    import com.liferay.portal.kernel.service.persistence.UserPersistence;
063    import com.liferay.portal.kernel.util.OrderByComparator;
064    import com.liferay.portal.kernel.util.PortalUtil;
065    
066    import java.io.Serializable;
067    
068    import java.util.List;
069    
070    import javax.sql.DataSource;
071    
072    /**
073     * Provides the base implementation for the user group local service.
074     *
075     * <p>
076     * 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.UserGroupLocalServiceImpl}.
077     * </p>
078     *
079     * @author Brian Wing Shun Chan
080     * @see com.liferay.portal.service.impl.UserGroupLocalServiceImpl
081     * @see com.liferay.portal.kernel.service.UserGroupLocalServiceUtil
082     * @generated
083     */
084    @ProviderType
085    public abstract class UserGroupLocalServiceBaseImpl extends BaseLocalServiceImpl
086            implements UserGroupLocalService, IdentifiableOSGiService {
087            /*
088             * NOTE FOR DEVELOPERS:
089             *
090             * Never modify or reference this class directly. Always use {@link com.liferay.portal.kernel.service.UserGroupLocalServiceUtil} to access the user group local service.
091             */
092    
093            /**
094             * Adds the user group to the database. Also notifies the appropriate model listeners.
095             *
096             * @param userGroup the user group
097             * @return the user group that was added
098             */
099            @Indexable(type = IndexableType.REINDEX)
100            @Override
101            public UserGroup addUserGroup(UserGroup userGroup) {
102                    userGroup.setNew(true);
103    
104                    return userGroupPersistence.update(userGroup);
105            }
106    
107            /**
108             * Creates a new user group with the primary key. Does not add the user group to the database.
109             *
110             * @param userGroupId the primary key for the new user group
111             * @return the new user group
112             */
113            @Override
114            public UserGroup createUserGroup(long userGroupId) {
115                    return userGroupPersistence.create(userGroupId);
116            }
117    
118            /**
119             * Deletes the user group with the primary key from the database. Also notifies the appropriate model listeners.
120             *
121             * @param userGroupId the primary key of the user group
122             * @return the user group that was removed
123             * @throws PortalException if a user group with the primary key could not be found
124             */
125            @Indexable(type = IndexableType.DELETE)
126            @Override
127            public UserGroup deleteUserGroup(long userGroupId)
128                    throws PortalException {
129                    return userGroupPersistence.remove(userGroupId);
130            }
131    
132            /**
133             * Deletes the user group from the database. Also notifies the appropriate model listeners.
134             *
135             * @param userGroup the user group
136             * @return the user group that was removed
137             * @throws PortalException
138             */
139            @Indexable(type = IndexableType.DELETE)
140            @Override
141            public UserGroup deleteUserGroup(UserGroup userGroup)
142                    throws PortalException {
143                    return userGroupPersistence.remove(userGroup);
144            }
145    
146            @Override
147            public DynamicQuery dynamicQuery() {
148                    Class<?> clazz = getClass();
149    
150                    return DynamicQueryFactoryUtil.forClass(UserGroup.class,
151                            clazz.getClassLoader());
152            }
153    
154            /**
155             * Performs a dynamic query on the database and returns the matching rows.
156             *
157             * @param dynamicQuery the dynamic query
158             * @return the matching rows
159             */
160            @Override
161            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery) {
162                    return userGroupPersistence.findWithDynamicQuery(dynamicQuery);
163            }
164    
165            /**
166             * Performs a dynamic query on the database and returns a range of the matching rows.
167             *
168             * <p>
169             * 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.UserGroupModelImpl}. 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.
170             * </p>
171             *
172             * @param dynamicQuery the dynamic query
173             * @param start the lower bound of the range of model instances
174             * @param end the upper bound of the range of model instances (not inclusive)
175             * @return the range of matching rows
176             */
177            @Override
178            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
179                    int end) {
180                    return userGroupPersistence.findWithDynamicQuery(dynamicQuery, start,
181                            end);
182            }
183    
184            /**
185             * Performs a dynamic query on the database and returns an ordered range of the matching rows.
186             *
187             * <p>
188             * 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.UserGroupModelImpl}. 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.
189             * </p>
190             *
191             * @param dynamicQuery the dynamic query
192             * @param start the lower bound of the range of model instances
193             * @param end the upper bound of the range of model instances (not inclusive)
194             * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
195             * @return the ordered range of matching rows
196             */
197            @Override
198            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
199                    int end, OrderByComparator<T> orderByComparator) {
200                    return userGroupPersistence.findWithDynamicQuery(dynamicQuery, start,
201                            end, orderByComparator);
202            }
203    
204            /**
205             * Returns the number of rows matching the dynamic query.
206             *
207             * @param dynamicQuery the dynamic query
208             * @return the number of rows matching the dynamic query
209             */
210            @Override
211            public long dynamicQueryCount(DynamicQuery dynamicQuery) {
212                    return userGroupPersistence.countWithDynamicQuery(dynamicQuery);
213            }
214    
215            /**
216             * Returns the number of rows matching the dynamic query.
217             *
218             * @param dynamicQuery the dynamic query
219             * @param projection the projection to apply to the query
220             * @return the number of rows matching the dynamic query
221             */
222            @Override
223            public long dynamicQueryCount(DynamicQuery dynamicQuery,
224                    Projection projection) {
225                    return userGroupPersistence.countWithDynamicQuery(dynamicQuery,
226                            projection);
227            }
228    
229            @Override
230            public UserGroup fetchUserGroup(long userGroupId) {
231                    return userGroupPersistence.fetchByPrimaryKey(userGroupId);
232            }
233    
234            /**
235             * Returns the user group with the matching UUID and company.
236             *
237             * @param uuid the user group's UUID
238             * @param companyId the primary key of the company
239             * @return the matching user group, or <code>null</code> if a matching user group could not be found
240             */
241            @Override
242            public UserGroup fetchUserGroupByUuidAndCompanyId(String uuid,
243                    long companyId) {
244                    return userGroupPersistence.fetchByUuid_C_First(uuid, companyId, null);
245            }
246    
247            /**
248             * Returns the user group with the primary key.
249             *
250             * @param userGroupId the primary key of the user group
251             * @return the user group
252             * @throws PortalException if a user group with the primary key could not be found
253             */
254            @Override
255            public UserGroup getUserGroup(long userGroupId) throws PortalException {
256                    return userGroupPersistence.findByPrimaryKey(userGroupId);
257            }
258    
259            @Override
260            public ActionableDynamicQuery getActionableDynamicQuery() {
261                    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();
262    
263                    actionableDynamicQuery.setBaseLocalService(com.liferay.portal.kernel.service.UserGroupLocalServiceUtil.getService());
264                    actionableDynamicQuery.setClassLoader(getClassLoader());
265                    actionableDynamicQuery.setModelClass(UserGroup.class);
266    
267                    actionableDynamicQuery.setPrimaryKeyPropertyName("userGroupId");
268    
269                    return actionableDynamicQuery;
270            }
271    
272            @Override
273            public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery() {
274                    IndexableActionableDynamicQuery indexableActionableDynamicQuery = new IndexableActionableDynamicQuery();
275    
276                    indexableActionableDynamicQuery.setBaseLocalService(com.liferay.portal.kernel.service.UserGroupLocalServiceUtil.getService());
277                    indexableActionableDynamicQuery.setClassLoader(getClassLoader());
278                    indexableActionableDynamicQuery.setModelClass(UserGroup.class);
279    
280                    indexableActionableDynamicQuery.setPrimaryKeyPropertyName("userGroupId");
281    
282                    return indexableActionableDynamicQuery;
283            }
284    
285            protected void initActionableDynamicQuery(
286                    ActionableDynamicQuery actionableDynamicQuery) {
287                    actionableDynamicQuery.setBaseLocalService(com.liferay.portal.kernel.service.UserGroupLocalServiceUtil.getService());
288                    actionableDynamicQuery.setClassLoader(getClassLoader());
289                    actionableDynamicQuery.setModelClass(UserGroup.class);
290    
291                    actionableDynamicQuery.setPrimaryKeyPropertyName("userGroupId");
292            }
293    
294            @Override
295            public ExportActionableDynamicQuery getExportActionableDynamicQuery(
296                    final PortletDataContext portletDataContext) {
297                    final ExportActionableDynamicQuery exportActionableDynamicQuery = new ExportActionableDynamicQuery() {
298                                    @Override
299                                    public long performCount() throws PortalException {
300                                            ManifestSummary manifestSummary = portletDataContext.getManifestSummary();
301    
302                                            StagedModelType stagedModelType = getStagedModelType();
303    
304                                            long modelAdditionCount = super.performCount();
305    
306                                            manifestSummary.addModelAdditionCount(stagedModelType,
307                                                    modelAdditionCount);
308    
309                                            long modelDeletionCount = ExportImportHelperUtil.getModelDeletionCount(portletDataContext,
310                                                            stagedModelType);
311    
312                                            manifestSummary.addModelDeletionCount(stagedModelType,
313                                                    modelDeletionCount);
314    
315                                            return modelAdditionCount;
316                                    }
317                            };
318    
319                    initActionableDynamicQuery(exportActionableDynamicQuery);
320    
321                    exportActionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() {
322                                    @Override
323                                    public void addCriteria(DynamicQuery dynamicQuery) {
324                                            portletDataContext.addDateRangeCriteria(dynamicQuery,
325                                                    "modifiedDate");
326                                    }
327                            });
328    
329                    exportActionableDynamicQuery.setCompanyId(portletDataContext.getCompanyId());
330    
331                    exportActionableDynamicQuery.setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<UserGroup>() {
332                                    @Override
333                                    public void performAction(UserGroup userGroup)
334                                            throws PortalException {
335                                            StagedModelDataHandlerUtil.exportStagedModel(portletDataContext,
336                                                    userGroup);
337                                    }
338                            });
339                    exportActionableDynamicQuery.setStagedModelType(new StagedModelType(
340                                    PortalUtil.getClassNameId(UserGroup.class.getName())));
341    
342                    return exportActionableDynamicQuery;
343            }
344    
345            /**
346             * @throws PortalException
347             */
348            @Override
349            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
350                    throws PortalException {
351                    return userGroupLocalService.deleteUserGroup((UserGroup)persistedModel);
352            }
353    
354            @Override
355            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
356                    throws PortalException {
357                    return userGroupPersistence.findByPrimaryKey(primaryKeyObj);
358            }
359    
360            /**
361             * Returns the user group with the matching UUID and company.
362             *
363             * @param uuid the user group's UUID
364             * @param companyId the primary key of the company
365             * @return the matching user group
366             * @throws PortalException if a matching user group could not be found
367             */
368            @Override
369            public UserGroup getUserGroupByUuidAndCompanyId(String uuid, long companyId)
370                    throws PortalException {
371                    return userGroupPersistence.findByUuid_C_First(uuid, companyId, null);
372            }
373    
374            /**
375             * Returns a range of all the user groups.
376             *
377             * <p>
378             * 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.UserGroupModelImpl}. 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.
379             * </p>
380             *
381             * @param start the lower bound of the range of user groups
382             * @param end the upper bound of the range of user groups (not inclusive)
383             * @return the range of user groups
384             */
385            @Override
386            public List<UserGroup> getUserGroups(int start, int end) {
387                    return userGroupPersistence.findAll(start, end);
388            }
389    
390            /**
391             * Returns the number of user groups.
392             *
393             * @return the number of user groups
394             */
395            @Override
396            public int getUserGroupsCount() {
397                    return userGroupPersistence.countAll();
398            }
399    
400            /**
401             * Updates the user group in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
402             *
403             * @param userGroup the user group
404             * @return the user group that was updated
405             */
406            @Indexable(type = IndexableType.REINDEX)
407            @Override
408            public UserGroup updateUserGroup(UserGroup userGroup) {
409                    return userGroupPersistence.update(userGroup);
410            }
411    
412            /**
413             */
414            @Override
415            public void addGroupUserGroup(long groupId, long userGroupId) {
416                    groupPersistence.addUserGroup(groupId, userGroupId);
417            }
418    
419            /**
420             */
421            @Override
422            public void addGroupUserGroup(long groupId, UserGroup userGroup) {
423                    groupPersistence.addUserGroup(groupId, userGroup);
424            }
425    
426            /**
427             */
428            @Override
429            public void addGroupUserGroups(long groupId, long[] userGroupIds) {
430                    groupPersistence.addUserGroups(groupId, userGroupIds);
431            }
432    
433            /**
434             */
435            @Override
436            public void addGroupUserGroups(long groupId, List<UserGroup> UserGroups) {
437                    groupPersistence.addUserGroups(groupId, UserGroups);
438            }
439    
440            /**
441             */
442            @Override
443            public void clearGroupUserGroups(long groupId) {
444                    groupPersistence.clearUserGroups(groupId);
445            }
446    
447            /**
448             */
449            @Override
450            public void deleteGroupUserGroup(long groupId, long userGroupId) {
451                    groupPersistence.removeUserGroup(groupId, userGroupId);
452            }
453    
454            /**
455             */
456            @Override
457            public void deleteGroupUserGroup(long groupId, UserGroup userGroup) {
458                    groupPersistence.removeUserGroup(groupId, userGroup);
459            }
460    
461            /**
462             */
463            @Override
464            public void deleteGroupUserGroups(long groupId, long[] userGroupIds) {
465                    groupPersistence.removeUserGroups(groupId, userGroupIds);
466            }
467    
468            /**
469             */
470            @Override
471            public void deleteGroupUserGroups(long groupId, List<UserGroup> UserGroups) {
472                    groupPersistence.removeUserGroups(groupId, UserGroups);
473            }
474    
475            /**
476             * Returns the groupIds of the groups associated with the user group.
477             *
478             * @param userGroupId the userGroupId of the user group
479             * @return long[] the groupIds of groups associated with the user group
480             */
481            @Override
482            public long[] getGroupPrimaryKeys(long userGroupId) {
483                    return userGroupPersistence.getGroupPrimaryKeys(userGroupId);
484            }
485    
486            /**
487             */
488            @Override
489            public List<UserGroup> getGroupUserGroups(long groupId) {
490                    return groupPersistence.getUserGroups(groupId);
491            }
492    
493            /**
494             */
495            @Override
496            public List<UserGroup> getGroupUserGroups(long groupId, int start, int end) {
497                    return groupPersistence.getUserGroups(groupId, start, end);
498            }
499    
500            /**
501             */
502            @Override
503            public List<UserGroup> getGroupUserGroups(long groupId, int start, int end,
504                    OrderByComparator<UserGroup> orderByComparator) {
505                    return groupPersistence.getUserGroups(groupId, start, end,
506                            orderByComparator);
507            }
508    
509            /**
510             */
511            @Override
512            public int getGroupUserGroupsCount(long groupId) {
513                    return groupPersistence.getUserGroupsSize(groupId);
514            }
515    
516            /**
517             */
518            @Override
519            public boolean hasGroupUserGroup(long groupId, long userGroupId) {
520                    return groupPersistence.containsUserGroup(groupId, userGroupId);
521            }
522    
523            /**
524             */
525            @Override
526            public boolean hasGroupUserGroups(long groupId) {
527                    return groupPersistence.containsUserGroups(groupId);
528            }
529    
530            /**
531             */
532            @Override
533            public void setGroupUserGroups(long groupId, long[] userGroupIds) {
534                    groupPersistence.setUserGroups(groupId, userGroupIds);
535            }
536    
537            /**
538             */
539            @Override
540            public void addTeamUserGroup(long teamId, long userGroupId) {
541                    teamPersistence.addUserGroup(teamId, userGroupId);
542            }
543    
544            /**
545             */
546            @Override
547            public void addTeamUserGroup(long teamId, UserGroup userGroup) {
548                    teamPersistence.addUserGroup(teamId, userGroup);
549            }
550    
551            /**
552             */
553            @Override
554            public void addTeamUserGroups(long teamId, long[] userGroupIds) {
555                    teamPersistence.addUserGroups(teamId, userGroupIds);
556            }
557    
558            /**
559             */
560            @Override
561            public void addTeamUserGroups(long teamId, List<UserGroup> UserGroups) {
562                    teamPersistence.addUserGroups(teamId, UserGroups);
563            }
564    
565            /**
566             */
567            @Override
568            public void clearTeamUserGroups(long teamId) {
569                    teamPersistence.clearUserGroups(teamId);
570            }
571    
572            /**
573             */
574            @Override
575            public void deleteTeamUserGroup(long teamId, long userGroupId) {
576                    teamPersistence.removeUserGroup(teamId, userGroupId);
577            }
578    
579            /**
580             */
581            @Override
582            public void deleteTeamUserGroup(long teamId, UserGroup userGroup) {
583                    teamPersistence.removeUserGroup(teamId, userGroup);
584            }
585    
586            /**
587             */
588            @Override
589            public void deleteTeamUserGroups(long teamId, long[] userGroupIds) {
590                    teamPersistence.removeUserGroups(teamId, userGroupIds);
591            }
592    
593            /**
594             */
595            @Override
596            public void deleteTeamUserGroups(long teamId, List<UserGroup> UserGroups) {
597                    teamPersistence.removeUserGroups(teamId, UserGroups);
598            }
599    
600            /**
601             * Returns the teamIds of the teams associated with the user group.
602             *
603             * @param userGroupId the userGroupId of the user group
604             * @return long[] the teamIds of teams associated with the user group
605             */
606            @Override
607            public long[] getTeamPrimaryKeys(long userGroupId) {
608                    return userGroupPersistence.getTeamPrimaryKeys(userGroupId);
609            }
610    
611            /**
612             */
613            @Override
614            public List<UserGroup> getTeamUserGroups(long teamId) {
615                    return teamPersistence.getUserGroups(teamId);
616            }
617    
618            /**
619             */
620            @Override
621            public List<UserGroup> getTeamUserGroups(long teamId, int start, int end) {
622                    return teamPersistence.getUserGroups(teamId, start, end);
623            }
624    
625            /**
626             */
627            @Override
628            public List<UserGroup> getTeamUserGroups(long teamId, int start, int end,
629                    OrderByComparator<UserGroup> orderByComparator) {
630                    return teamPersistence.getUserGroups(teamId, start, end,
631                            orderByComparator);
632            }
633    
634            /**
635             */
636            @Override
637            public int getTeamUserGroupsCount(long teamId) {
638                    return teamPersistence.getUserGroupsSize(teamId);
639            }
640    
641            /**
642             */
643            @Override
644            public boolean hasTeamUserGroup(long teamId, long userGroupId) {
645                    return teamPersistence.containsUserGroup(teamId, userGroupId);
646            }
647    
648            /**
649             */
650            @Override
651            public boolean hasTeamUserGroups(long teamId) {
652                    return teamPersistence.containsUserGroups(teamId);
653            }
654    
655            /**
656             */
657            @Override
658            public void setTeamUserGroups(long teamId, long[] userGroupIds) {
659                    teamPersistence.setUserGroups(teamId, userGroupIds);
660            }
661    
662            /**
663             */
664            @Override
665            public void addUserUserGroup(long userId, long userGroupId) {
666                    userPersistence.addUserGroup(userId, userGroupId);
667            }
668    
669            /**
670             */
671            @Override
672            public void addUserUserGroup(long userId, UserGroup userGroup) {
673                    userPersistence.addUserGroup(userId, userGroup);
674            }
675    
676            /**
677             */
678            @Override
679            public void addUserUserGroups(long userId, long[] userGroupIds) {
680                    userPersistence.addUserGroups(userId, userGroupIds);
681            }
682    
683            /**
684             */
685            @Override
686            public void addUserUserGroups(long userId, List<UserGroup> UserGroups) {
687                    userPersistence.addUserGroups(userId, UserGroups);
688            }
689    
690            /**
691             */
692            @Override
693            public void clearUserUserGroups(long userId) {
694                    userPersistence.clearUserGroups(userId);
695            }
696    
697            /**
698             */
699            @Override
700            public void deleteUserUserGroup(long userId, long userGroupId) {
701                    userPersistence.removeUserGroup(userId, userGroupId);
702            }
703    
704            /**
705             */
706            @Override
707            public void deleteUserUserGroup(long userId, UserGroup userGroup) {
708                    userPersistence.removeUserGroup(userId, userGroup);
709            }
710    
711            /**
712             */
713            @Override
714            public void deleteUserUserGroups(long userId, long[] userGroupIds) {
715                    userPersistence.removeUserGroups(userId, userGroupIds);
716            }
717    
718            /**
719             */
720            @Override
721            public void deleteUserUserGroups(long userId, List<UserGroup> UserGroups) {
722                    userPersistence.removeUserGroups(userId, UserGroups);
723            }
724    
725            /**
726             * Returns the userIds of the users associated with the user group.
727             *
728             * @param userGroupId the userGroupId of the user group
729             * @return long[] the userIds of users associated with the user group
730             */
731            @Override
732            public long[] getUserPrimaryKeys(long userGroupId) {
733                    return userGroupPersistence.getUserPrimaryKeys(userGroupId);
734            }
735    
736            /**
737             */
738            @Override
739            public List<UserGroup> getUserUserGroups(long userId) {
740                    return userPersistence.getUserGroups(userId);
741            }
742    
743            /**
744             */
745            @Override
746            public List<UserGroup> getUserUserGroups(long userId, int start, int end) {
747                    return userPersistence.getUserGroups(userId, start, end);
748            }
749    
750            /**
751             */
752            @Override
753            public List<UserGroup> getUserUserGroups(long userId, int start, int end,
754                    OrderByComparator<UserGroup> orderByComparator) {
755                    return userPersistence.getUserGroups(userId, start, end,
756                            orderByComparator);
757            }
758    
759            /**
760             */
761            @Override
762            public int getUserUserGroupsCount(long userId) {
763                    return userPersistence.getUserGroupsSize(userId);
764            }
765    
766            /**
767             */
768            @Override
769            public boolean hasUserUserGroup(long userId, long userGroupId) {
770                    return userPersistence.containsUserGroup(userId, userGroupId);
771            }
772    
773            /**
774             */
775            @Override
776            public boolean hasUserUserGroups(long userId) {
777                    return userPersistence.containsUserGroups(userId);
778            }
779    
780            /**
781             * @throws PortalException
782             */
783            @Override
784            public void setUserUserGroups(long userId, long[] userGroupIds)
785                    throws PortalException {
786                    userPersistence.setUserGroups(userId, userGroupIds);
787            }
788    
789            /**
790             * Returns the user group local service.
791             *
792             * @return the user group local service
793             */
794            public UserGroupLocalService getUserGroupLocalService() {
795                    return userGroupLocalService;
796            }
797    
798            /**
799             * Sets the user group local service.
800             *
801             * @param userGroupLocalService the user group local service
802             */
803            public void setUserGroupLocalService(
804                    UserGroupLocalService userGroupLocalService) {
805                    this.userGroupLocalService = userGroupLocalService;
806            }
807    
808            /**
809             * Returns the user group persistence.
810             *
811             * @return the user group persistence
812             */
813            public UserGroupPersistence getUserGroupPersistence() {
814                    return userGroupPersistence;
815            }
816    
817            /**
818             * Sets the user group persistence.
819             *
820             * @param userGroupPersistence the user group persistence
821             */
822            public void setUserGroupPersistence(
823                    UserGroupPersistence userGroupPersistence) {
824                    this.userGroupPersistence = userGroupPersistence;
825            }
826    
827            /**
828             * Returns the user group finder.
829             *
830             * @return the user group finder
831             */
832            public UserGroupFinder getUserGroupFinder() {
833                    return userGroupFinder;
834            }
835    
836            /**
837             * Sets the user group finder.
838             *
839             * @param userGroupFinder the user group finder
840             */
841            public void setUserGroupFinder(UserGroupFinder userGroupFinder) {
842                    this.userGroupFinder = userGroupFinder;
843            }
844    
845            /**
846             * Returns the counter local service.
847             *
848             * @return the counter local service
849             */
850            public com.liferay.counter.kernel.service.CounterLocalService getCounterLocalService() {
851                    return counterLocalService;
852            }
853    
854            /**
855             * Sets the counter local service.
856             *
857             * @param counterLocalService the counter local service
858             */
859            public void setCounterLocalService(
860                    com.liferay.counter.kernel.service.CounterLocalService counterLocalService) {
861                    this.counterLocalService = counterLocalService;
862            }
863    
864            /**
865             * Returns the group local service.
866             *
867             * @return the group local service
868             */
869            public com.liferay.portal.kernel.service.GroupLocalService getGroupLocalService() {
870                    return groupLocalService;
871            }
872    
873            /**
874             * Sets the group local service.
875             *
876             * @param groupLocalService the group local service
877             */
878            public void setGroupLocalService(
879                    com.liferay.portal.kernel.service.GroupLocalService groupLocalService) {
880                    this.groupLocalService = groupLocalService;
881            }
882    
883            /**
884             * Returns the group persistence.
885             *
886             * @return the group persistence
887             */
888            public GroupPersistence getGroupPersistence() {
889                    return groupPersistence;
890            }
891    
892            /**
893             * Sets the group persistence.
894             *
895             * @param groupPersistence the group persistence
896             */
897            public void setGroupPersistence(GroupPersistence groupPersistence) {
898                    this.groupPersistence = groupPersistence;
899            }
900    
901            /**
902             * Returns the group finder.
903             *
904             * @return the group finder
905             */
906            public GroupFinder getGroupFinder() {
907                    return groupFinder;
908            }
909    
910            /**
911             * Sets the group finder.
912             *
913             * @param groupFinder the group finder
914             */
915            public void setGroupFinder(GroupFinder groupFinder) {
916                    this.groupFinder = groupFinder;
917            }
918    
919            /**
920             * Returns the layout local service.
921             *
922             * @return the layout local service
923             */
924            public com.liferay.portal.kernel.service.LayoutLocalService getLayoutLocalService() {
925                    return layoutLocalService;
926            }
927    
928            /**
929             * Sets the layout local service.
930             *
931             * @param layoutLocalService the layout local service
932             */
933            public void setLayoutLocalService(
934                    com.liferay.portal.kernel.service.LayoutLocalService layoutLocalService) {
935                    this.layoutLocalService = layoutLocalService;
936            }
937    
938            /**
939             * Returns the layout persistence.
940             *
941             * @return the layout persistence
942             */
943            public LayoutPersistence getLayoutPersistence() {
944                    return layoutPersistence;
945            }
946    
947            /**
948             * Sets the layout persistence.
949             *
950             * @param layoutPersistence the layout persistence
951             */
952            public void setLayoutPersistence(LayoutPersistence layoutPersistence) {
953                    this.layoutPersistence = layoutPersistence;
954            }
955    
956            /**
957             * Returns the layout finder.
958             *
959             * @return the layout finder
960             */
961            public LayoutFinder getLayoutFinder() {
962                    return layoutFinder;
963            }
964    
965            /**
966             * Sets the layout finder.
967             *
968             * @param layoutFinder the layout finder
969             */
970            public void setLayoutFinder(LayoutFinder layoutFinder) {
971                    this.layoutFinder = layoutFinder;
972            }
973    
974            /**
975             * Returns the resource local service.
976             *
977             * @return the resource local service
978             */
979            public com.liferay.portal.kernel.service.ResourceLocalService getResourceLocalService() {
980                    return resourceLocalService;
981            }
982    
983            /**
984             * Sets the resource local service.
985             *
986             * @param resourceLocalService the resource local service
987             */
988            public void setResourceLocalService(
989                    com.liferay.portal.kernel.service.ResourceLocalService resourceLocalService) {
990                    this.resourceLocalService = resourceLocalService;
991            }
992    
993            /**
994             * Returns the team local service.
995             *
996             * @return the team local service
997             */
998            public com.liferay.portal.kernel.service.TeamLocalService getTeamLocalService() {
999                    return teamLocalService;
1000            }
1001    
1002            /**
1003             * Sets the team local service.
1004             *
1005             * @param teamLocalService the team local service
1006             */
1007            public void setTeamLocalService(
1008                    com.liferay.portal.kernel.service.TeamLocalService teamLocalService) {
1009                    this.teamLocalService = teamLocalService;
1010            }
1011    
1012            /**
1013             * Returns the team persistence.
1014             *
1015             * @return the team persistence
1016             */
1017            public TeamPersistence getTeamPersistence() {
1018                    return teamPersistence;
1019            }
1020    
1021            /**
1022             * Sets the team persistence.
1023             *
1024             * @param teamPersistence the team persistence
1025             */
1026            public void setTeamPersistence(TeamPersistence teamPersistence) {
1027                    this.teamPersistence = teamPersistence;
1028            }
1029    
1030            /**
1031             * Returns the team finder.
1032             *
1033             * @return the team finder
1034             */
1035            public TeamFinder getTeamFinder() {
1036                    return teamFinder;
1037            }
1038    
1039            /**
1040             * Sets the team finder.
1041             *
1042             * @param teamFinder the team finder
1043             */
1044            public void setTeamFinder(TeamFinder teamFinder) {
1045                    this.teamFinder = teamFinder;
1046            }
1047    
1048            /**
1049             * Returns the user local service.
1050             *
1051             * @return the user local service
1052             */
1053            public com.liferay.portal.kernel.service.UserLocalService getUserLocalService() {
1054                    return userLocalService;
1055            }
1056    
1057            /**
1058             * Sets the user local service.
1059             *
1060             * @param userLocalService the user local service
1061             */
1062            public void setUserLocalService(
1063                    com.liferay.portal.kernel.service.UserLocalService userLocalService) {
1064                    this.userLocalService = userLocalService;
1065            }
1066    
1067            /**
1068             * Returns the user persistence.
1069             *
1070             * @return the user persistence
1071             */
1072            public UserPersistence getUserPersistence() {
1073                    return userPersistence;
1074            }
1075    
1076            /**
1077             * Sets the user persistence.
1078             *
1079             * @param userPersistence the user persistence
1080             */
1081            public void setUserPersistence(UserPersistence userPersistence) {
1082                    this.userPersistence = userPersistence;
1083            }
1084    
1085            /**
1086             * Returns the user finder.
1087             *
1088             * @return the user finder
1089             */
1090            public UserFinder getUserFinder() {
1091                    return userFinder;
1092            }
1093    
1094            /**
1095             * Sets the user finder.
1096             *
1097             * @param userFinder the user finder
1098             */
1099            public void setUserFinder(UserFinder userFinder) {
1100                    this.userFinder = userFinder;
1101            }
1102    
1103            /**
1104             * Returns the expando row local service.
1105             *
1106             * @return the expando row local service
1107             */
1108            public com.liferay.expando.kernel.service.ExpandoRowLocalService getExpandoRowLocalService() {
1109                    return expandoRowLocalService;
1110            }
1111    
1112            /**
1113             * Sets the expando row local service.
1114             *
1115             * @param expandoRowLocalService the expando row local service
1116             */
1117            public void setExpandoRowLocalService(
1118                    com.liferay.expando.kernel.service.ExpandoRowLocalService expandoRowLocalService) {
1119                    this.expandoRowLocalService = expandoRowLocalService;
1120            }
1121    
1122            /**
1123             * Returns the expando row persistence.
1124             *
1125             * @return the expando row persistence
1126             */
1127            public ExpandoRowPersistence getExpandoRowPersistence() {
1128                    return expandoRowPersistence;
1129            }
1130    
1131            /**
1132             * Sets the expando row persistence.
1133             *
1134             * @param expandoRowPersistence the expando row persistence
1135             */
1136            public void setExpandoRowPersistence(
1137                    ExpandoRowPersistence expandoRowPersistence) {
1138                    this.expandoRowPersistence = expandoRowPersistence;
1139            }
1140    
1141            /**
1142             * Returns the export import local service.
1143             *
1144             * @return the export import local service
1145             */
1146            public com.liferay.exportimport.kernel.service.ExportImportLocalService getExportImportLocalService() {
1147                    return exportImportLocalService;
1148            }
1149    
1150            /**
1151             * Sets the export import local service.
1152             *
1153             * @param exportImportLocalService the export import local service
1154             */
1155            public void setExportImportLocalService(
1156                    com.liferay.exportimport.kernel.service.ExportImportLocalService exportImportLocalService) {
1157                    this.exportImportLocalService = exportImportLocalService;
1158            }
1159    
1160            /**
1161             * Returns the export import configuration local service.
1162             *
1163             * @return the export import configuration local service
1164             */
1165            public com.liferay.exportimport.kernel.service.ExportImportConfigurationLocalService getExportImportConfigurationLocalService() {
1166                    return exportImportConfigurationLocalService;
1167            }
1168    
1169            /**
1170             * Sets the export import configuration local service.
1171             *
1172             * @param exportImportConfigurationLocalService the export import configuration local service
1173             */
1174            public void setExportImportConfigurationLocalService(
1175                    com.liferay.exportimport.kernel.service.ExportImportConfigurationLocalService exportImportConfigurationLocalService) {
1176                    this.exportImportConfigurationLocalService = exportImportConfigurationLocalService;
1177            }
1178    
1179            /**
1180             * Returns the export import configuration persistence.
1181             *
1182             * @return the export import configuration persistence
1183             */
1184            public ExportImportConfigurationPersistence getExportImportConfigurationPersistence() {
1185                    return exportImportConfigurationPersistence;
1186            }
1187    
1188            /**
1189             * Sets the export import configuration persistence.
1190             *
1191             * @param exportImportConfigurationPersistence the export import configuration persistence
1192             */
1193            public void setExportImportConfigurationPersistence(
1194                    ExportImportConfigurationPersistence exportImportConfigurationPersistence) {
1195                    this.exportImportConfigurationPersistence = exportImportConfigurationPersistence;
1196            }
1197    
1198            /**
1199             * Returns the export import configuration finder.
1200             *
1201             * @return the export import configuration finder
1202             */
1203            public ExportImportConfigurationFinder getExportImportConfigurationFinder() {
1204                    return exportImportConfigurationFinder;
1205            }
1206    
1207            /**
1208             * Sets the export import configuration finder.
1209             *
1210             * @param exportImportConfigurationFinder the export import configuration finder
1211             */
1212            public void setExportImportConfigurationFinder(
1213                    ExportImportConfigurationFinder exportImportConfigurationFinder) {
1214                    this.exportImportConfigurationFinder = exportImportConfigurationFinder;
1215            }
1216    
1217            /**
1218             * Returns the user group group role local service.
1219             *
1220             * @return the user group group role local service
1221             */
1222            public com.liferay.portal.kernel.service.UserGroupGroupRoleLocalService getUserGroupGroupRoleLocalService() {
1223                    return userGroupGroupRoleLocalService;
1224            }
1225    
1226            /**
1227             * Sets the user group group role local service.
1228             *
1229             * @param userGroupGroupRoleLocalService the user group group role local service
1230             */
1231            public void setUserGroupGroupRoleLocalService(
1232                    com.liferay.portal.kernel.service.UserGroupGroupRoleLocalService userGroupGroupRoleLocalService) {
1233                    this.userGroupGroupRoleLocalService = userGroupGroupRoleLocalService;
1234            }
1235    
1236            /**
1237             * Returns the user group group role persistence.
1238             *
1239             * @return the user group group role persistence
1240             */
1241            public UserGroupGroupRolePersistence getUserGroupGroupRolePersistence() {
1242                    return userGroupGroupRolePersistence;
1243            }
1244    
1245            /**
1246             * Sets the user group group role persistence.
1247             *
1248             * @param userGroupGroupRolePersistence the user group group role persistence
1249             */
1250            public void setUserGroupGroupRolePersistence(
1251                    UserGroupGroupRolePersistence userGroupGroupRolePersistence) {
1252                    this.userGroupGroupRolePersistence = userGroupGroupRolePersistence;
1253            }
1254    
1255            /**
1256             * Returns the user group group role finder.
1257             *
1258             * @return the user group group role finder
1259             */
1260            public UserGroupGroupRoleFinder getUserGroupGroupRoleFinder() {
1261                    return userGroupGroupRoleFinder;
1262            }
1263    
1264            /**
1265             * Sets the user group group role finder.
1266             *
1267             * @param userGroupGroupRoleFinder the user group group role finder
1268             */
1269            public void setUserGroupGroupRoleFinder(
1270                    UserGroupGroupRoleFinder userGroupGroupRoleFinder) {
1271                    this.userGroupGroupRoleFinder = userGroupGroupRoleFinder;
1272            }
1273    
1274            public void afterPropertiesSet() {
1275                    persistedModelLocalServiceRegistry.register("com.liferay.portal.kernel.model.UserGroup",
1276                            userGroupLocalService);
1277            }
1278    
1279            public void destroy() {
1280                    persistedModelLocalServiceRegistry.unregister(
1281                            "com.liferay.portal.kernel.model.UserGroup");
1282            }
1283    
1284            /**
1285             * Returns the OSGi service identifier.
1286             *
1287             * @return the OSGi service identifier
1288             */
1289            @Override
1290            public String getOSGiServiceIdentifier() {
1291                    return UserGroupLocalService.class.getName();
1292            }
1293    
1294            protected Class<?> getModelClass() {
1295                    return UserGroup.class;
1296            }
1297    
1298            protected String getModelClassName() {
1299                    return UserGroup.class.getName();
1300            }
1301    
1302            /**
1303             * Performs a SQL query.
1304             *
1305             * @param sql the sql query
1306             */
1307            protected void runSQL(String sql) {
1308                    try {
1309                            DataSource dataSource = userGroupPersistence.getDataSource();
1310    
1311                            DB db = DBManagerUtil.getDB();
1312    
1313                            sql = db.buildSQL(sql);
1314                            sql = PortalUtil.transformSQL(sql);
1315    
1316                            SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
1317                                            sql, new int[0]);
1318    
1319                            sqlUpdate.update();
1320                    }
1321                    catch (Exception e) {
1322                            throw new SystemException(e);
1323                    }
1324            }
1325    
1326            @BeanReference(type = com.liferay.portal.kernel.service.UserGroupLocalService.class)
1327            protected UserGroupLocalService userGroupLocalService;
1328            @BeanReference(type = UserGroupPersistence.class)
1329            protected UserGroupPersistence userGroupPersistence;
1330            @BeanReference(type = UserGroupFinder.class)
1331            protected UserGroupFinder userGroupFinder;
1332            @BeanReference(type = com.liferay.counter.kernel.service.CounterLocalService.class)
1333            protected com.liferay.counter.kernel.service.CounterLocalService counterLocalService;
1334            @BeanReference(type = com.liferay.portal.kernel.service.GroupLocalService.class)
1335            protected com.liferay.portal.kernel.service.GroupLocalService groupLocalService;
1336            @BeanReference(type = GroupPersistence.class)
1337            protected GroupPersistence groupPersistence;
1338            @BeanReference(type = GroupFinder.class)
1339            protected GroupFinder groupFinder;
1340            @BeanReference(type = com.liferay.portal.kernel.service.LayoutLocalService.class)
1341            protected com.liferay.portal.kernel.service.LayoutLocalService layoutLocalService;
1342            @BeanReference(type = LayoutPersistence.class)
1343            protected LayoutPersistence layoutPersistence;
1344            @BeanReference(type = LayoutFinder.class)
1345            protected LayoutFinder layoutFinder;
1346            @BeanReference(type = com.liferay.portal.kernel.service.ResourceLocalService.class)
1347            protected com.liferay.portal.kernel.service.ResourceLocalService resourceLocalService;
1348            @BeanReference(type = com.liferay.portal.kernel.service.TeamLocalService.class)
1349            protected com.liferay.portal.kernel.service.TeamLocalService teamLocalService;
1350            @BeanReference(type = TeamPersistence.class)
1351            protected TeamPersistence teamPersistence;
1352            @BeanReference(type = TeamFinder.class)
1353            protected TeamFinder teamFinder;
1354            @BeanReference(type = com.liferay.portal.kernel.service.UserLocalService.class)
1355            protected com.liferay.portal.kernel.service.UserLocalService userLocalService;
1356            @BeanReference(type = UserPersistence.class)
1357            protected UserPersistence userPersistence;
1358            @BeanReference(type = UserFinder.class)
1359            protected UserFinder userFinder;
1360            @BeanReference(type = com.liferay.expando.kernel.service.ExpandoRowLocalService.class)
1361            protected com.liferay.expando.kernel.service.ExpandoRowLocalService expandoRowLocalService;
1362            @BeanReference(type = ExpandoRowPersistence.class)
1363            protected ExpandoRowPersistence expandoRowPersistence;
1364            @BeanReference(type = com.liferay.exportimport.kernel.service.ExportImportLocalService.class)
1365            protected com.liferay.exportimport.kernel.service.ExportImportLocalService exportImportLocalService;
1366            @BeanReference(type = com.liferay.exportimport.kernel.service.ExportImportConfigurationLocalService.class)
1367            protected com.liferay.exportimport.kernel.service.ExportImportConfigurationLocalService exportImportConfigurationLocalService;
1368            @BeanReference(type = ExportImportConfigurationPersistence.class)
1369            protected ExportImportConfigurationPersistence exportImportConfigurationPersistence;
1370            @BeanReference(type = ExportImportConfigurationFinder.class)
1371            protected ExportImportConfigurationFinder exportImportConfigurationFinder;
1372            @BeanReference(type = com.liferay.portal.kernel.service.UserGroupGroupRoleLocalService.class)
1373            protected com.liferay.portal.kernel.service.UserGroupGroupRoleLocalService userGroupGroupRoleLocalService;
1374            @BeanReference(type = UserGroupGroupRolePersistence.class)
1375            protected UserGroupGroupRolePersistence userGroupGroupRolePersistence;
1376            @BeanReference(type = UserGroupGroupRoleFinder.class)
1377            protected UserGroupGroupRoleFinder userGroupGroupRoleFinder;
1378            @BeanReference(type = PersistedModelLocalServiceRegistry.class)
1379            protected PersistedModelLocalServiceRegistry persistedModelLocalServiceRegistry;
1380    }