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