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