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