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.kernel.service; 016 017 import aQute.bnd.annotation.ProviderType; 018 019 import com.liferay.portal.kernel.exception.PortalException; 020 import com.liferay.portal.kernel.exception.SystemException; 021 import com.liferay.portal.kernel.jsonwebservice.JSONWebService; 022 import com.liferay.portal.kernel.model.Group; 023 import com.liferay.portal.kernel.model.Organization; 024 import com.liferay.portal.kernel.model.Portlet; 025 import com.liferay.portal.kernel.model.UserGroup; 026 import com.liferay.portal.kernel.security.access.control.AccessControlled; 027 import com.liferay.portal.kernel.transaction.Isolation; 028 import com.liferay.portal.kernel.transaction.Propagation; 029 import com.liferay.portal.kernel.transaction.Transactional; 030 import com.liferay.portal.kernel.util.OrderByComparator; 031 032 import java.util.Collection; 033 import java.util.LinkedHashMap; 034 import java.util.List; 035 import java.util.Locale; 036 import java.util.Map; 037 038 /** 039 * Provides the remote service interface for Group. Methods of this 040 * service are expected to have security checks based on the propagated JAAS 041 * credentials because this service can be accessed remotely. 042 * 043 * @author Brian Wing Shun Chan 044 * @see GroupServiceUtil 045 * @see com.liferay.portal.service.base.GroupServiceBaseImpl 046 * @see com.liferay.portal.service.impl.GroupServiceImpl 047 * @generated 048 */ 049 @AccessControlled 050 @JSONWebService 051 @ProviderType 052 @Transactional(isolation = Isolation.PORTAL, rollbackFor = { 053 PortalException.class, SystemException.class}) 054 public interface GroupService extends BaseService { 055 /* 056 * NOTE FOR DEVELOPERS: 057 * 058 * Never modify or reference this interface directly. Always use {@link GroupServiceUtil} to access the group remote service. Add custom service methods to {@link com.liferay.portal.service.impl.GroupServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface. 059 */ 060 061 /** 062 * Adds a group. 063 * 064 * @param parentGroupId the primary key of the parent group 065 * @param liveGroupId the primary key of the live group 066 * @param name the entity's name 067 * @param description the group's description (optionally 068 <code>null</code>) 069 * @param type the group's type. For more information see {@link 070 GroupConstants}. 071 * @param manualMembership whether manual membership is allowed for the 072 group 073 * @param membershipRestriction the group's membership restriction. For 074 more information see {@link GroupConstants}. 075 * @param friendlyURL the group's friendlyURL (optionally 076 <code>null</code>) 077 * @param site whether the group is to be associated with a main site 078 * @param active whether the group is active 079 * @param serviceContext the service context to be applied (optionally 080 <code>null</code>). Can set the asset category IDs and asset 081 tag names for the group, and can set whether the group is for 082 staging 083 * @return the group 084 * @throws PortalException if a portal exception occurred 085 * @deprecated As of 7.0.0, replaced by {@link #addGroup(long, long, Map, 086 Map, int, boolean, int, String, boolean, boolean, 087 ServiceContext)} 088 */ 089 @java.lang.Deprecated 090 public Group addGroup(long parentGroupId, long liveGroupId, 091 java.lang.String name, java.lang.String description, int type, 092 boolean manualMembership, int membershipRestriction, 093 java.lang.String friendlyURL, boolean site, boolean active, 094 com.liferay.portal.kernel.service.ServiceContext serviceContext) 095 throws PortalException; 096 097 public Group addGroup(long parentGroupId, long liveGroupId, 098 Map<Locale, java.lang.String> nameMap, 099 Map<Locale, java.lang.String> descriptionMap, int type, 100 boolean manualMembership, int membershipRestriction, 101 java.lang.String friendlyURL, boolean site, boolean active, 102 com.liferay.portal.kernel.service.ServiceContext serviceContext) 103 throws PortalException; 104 105 public Group addGroup(long parentGroupId, long liveGroupId, 106 Map<Locale, java.lang.String> nameMap, 107 Map<Locale, java.lang.String> descriptionMap, int type, 108 boolean manualMembership, int membershipRestriction, 109 java.lang.String friendlyURL, boolean site, boolean inheritContent, 110 boolean active, 111 com.liferay.portal.kernel.service.ServiceContext serviceContext) 112 throws PortalException; 113 114 /** 115 * Adds the groups to the role. 116 * 117 * @param roleId the primary key of the role 118 * @param groupIds the primary keys of the groups 119 * @throws PortalException if a portal exception occurred 120 */ 121 public void addRoleGroups(long roleId, long[] groupIds) 122 throws PortalException; 123 124 /** 125 * Checks that the current user is permitted to use the group for Remote 126 * Staging. 127 * 128 * @param groupId the primary key of the group 129 * @throws PortalException if a portal exception occurred 130 */ 131 public void checkRemoteStagingGroup(long groupId) throws PortalException; 132 133 /** 134 * Deletes the group. 135 * 136 * <p> 137 * The group is unstaged and its assets and resources including layouts, 138 * membership requests, subscriptions, teams, blogs, bookmarks, calendar 139 * events, image gallery, journals, message boards, polls, shopping related 140 * entities, and wikis are also deleted. 141 * </p> 142 * 143 * @param groupId the primary key of the group 144 * @throws PortalException if a portal exception occurred 145 */ 146 public void deleteGroup(long groupId) throws PortalException; 147 148 public void disableStaging(long groupId) throws PortalException; 149 150 public void enableStaging(long groupId) throws PortalException; 151 152 /** 153 * Returns the company group. 154 * 155 * @param companyId the primary key of the company 156 * @return the group associated with the company 157 * @throws PortalException if a portal exception occurred 158 */ 159 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 160 public Group getCompanyGroup(long companyId) throws PortalException; 161 162 /** 163 * Returns the group with the name. 164 * 165 * @param companyId the primary key of the company 166 * @param groupKey the group key 167 * @return the group with the group key 168 * @throws PortalException if a portal exception occurred 169 */ 170 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 171 public Group getGroup(long companyId, java.lang.String groupKey) 172 throws PortalException; 173 174 /** 175 * Returns the group with the primary key. 176 * 177 * @param groupId the primary key of the group 178 * @return the group with the primary key 179 * @throws PortalException if a portal exception occurred 180 */ 181 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 182 public Group getGroup(long groupId) throws PortalException; 183 184 /** 185 * Returns the group's display URL. 186 * 187 * @param groupId the primary key of the group 188 * @param privateLayout whether the layout set is private to the group 189 * @param secureConnection whether the generated URL uses a secure 190 connection 191 * @return the group's display URL 192 * @throws PortalException if a group with the primary key could not be 193 found or if a portal exception occurred 194 */ 195 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 196 public java.lang.String getGroupDisplayURL(long groupId, 197 boolean privateLayout, boolean secureConnection) 198 throws PortalException; 199 200 /** 201 * Returns all the groups that are direct children of the parent group. 202 * 203 * @param companyId the primary key of the company 204 * @param parentGroupId the primary key of the parent group 205 * @param site whether the group is to be associated with a main site 206 * @return the matching groups, or <code>null</code> if no matches were 207 found 208 * @throws PortalException if a portal exception occurred 209 */ 210 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 211 public List<Group> getGroups(long companyId, long parentGroupId, 212 boolean site) throws PortalException; 213 214 /** 215 * Returns a range of all the site groups for which the user has control 216 * panel access. 217 * 218 * @param portlets the portlets to manage 219 * @param max the upper bound of the range of groups to consider (not 220 inclusive) 221 * @return the range of site groups for which the user has Control Panel 222 access 223 * @throws PortalException if a portal exception occurred 224 */ 225 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 226 public List<Group> getManageableSiteGroups(Collection<Portlet> portlets, 227 int max) throws PortalException; 228 229 /** 230 * Returns the OSGi service identifier. 231 * 232 * @return the OSGi service identifier 233 */ 234 public java.lang.String getOSGiServiceIdentifier(); 235 236 /** 237 * Returns the groups associated with the organizations. 238 * 239 * @param organizations the organizations 240 * @return the groups associated with the organizations 241 * @throws PortalException if a portal exception occurred 242 */ 243 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 244 public List<Group> getOrganizationsGroups(List<Organization> organizations) 245 throws PortalException; 246 247 /** 248 * Returns the group directly associated with the user. 249 * 250 * @param companyId the primary key of the company 251 * @param userId the primary key of the user 252 * @return the group directly associated with the user 253 * @throws PortalException if a portal exception occurred 254 */ 255 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 256 public Group getUserGroup(long companyId, long userId) 257 throws PortalException; 258 259 /** 260 * Returns the groups associated with the user groups. 261 * 262 * @param userGroups the user groups 263 * @return the groups associated with the user groups 264 * @throws PortalException if a portal exception occurred 265 */ 266 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 267 public List<Group> getUserGroupsGroups(List<UserGroup> userGroups) 268 throws PortalException; 269 270 /** 271 * Returns the range of all groups associated with the user's organization 272 * groups, including the ancestors of the organization groups, unless portal 273 * property <code>organizations.membership.strict</code> is set to 274 * <code>true</code>. 275 * 276 * <p> 277 * Useful when paginating results. Returns a maximum of <code>end - 278 * start</code> instances. <code>start</code> and <code>end</code> are not 279 * primary keys, they are indexes in the result set. Thus, <code>0</code> 280 * refers to the first result in the set. Setting both <code>start</code> 281 * and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full 282 * result set. 283 * </p> 284 * 285 * @param userId the primary key of the user 286 * @param start the lower bound of the range of groups to consider 287 * @param end the upper bound of the range of groups to consider (not 288 inclusive) 289 * @return the range of groups associated with the user's organizations 290 * @throws PortalException if a portal exception occurred 291 */ 292 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 293 public List<Group> getUserOrganizationsGroups(long userId, int start, 294 int end) throws PortalException; 295 296 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 297 public List<Group> getUserSitesGroups() throws PortalException; 298 299 /** 300 * Returns the guest or current user's groups "sites" associated 301 * with the group entity class names, including the Control Panel group if 302 * the user is permitted to view the Control Panel. 303 * 304 * <ul> 305 * <li> 306 * Class name "User" includes the user's layout set 307 * group. 308 * </li> 309 * <li> 310 * Class name "Organization" includes the user's 311 * immediate organization groups and inherited organization groups. 312 * </li> 313 * <li> 314 * Class name "Group" includes the user's immediate 315 * organization groups and site groups. 316 * </li> 317 * <li> 318 * A <code>classNames</code> 319 * value of <code>null</code> includes the user's layout set group, 320 * organization groups, inherited organization groups, and site groups. 321 * </li> 322 * </ul> 323 * 324 * @param classNames the group entity class names (optionally 325 <code>null</code>). For more information see {@link 326 #getUserSitesGroups(long, String[], int)}. 327 * @param max the maximum number of groups to return 328 * @return the user's groups "sites" 329 * @throws PortalException if a portal exception occurred 330 */ 331 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 332 public List<Group> getUserSitesGroups(java.lang.String[] classNames, int max) 333 throws PortalException; 334 335 /** 336 * Returns the user's groups "sites" associated with the group 337 * entity class names, including the Control Panel group if the user is 338 * permitted to view the Control Panel. 339 * 340 * <ul> 341 * <li> 342 * Class name "User" includes the user's layout set 343 * group. 344 * </li> 345 * <li> 346 * Class name "Organization" includes the user's 347 * immediate organization groups and inherited organization groups. 348 * </li> 349 * <li> 350 * Class name "Group" includes the user's immediate 351 * organization groups and site groups. 352 * </li> 353 * <li> 354 * A <code>classNames</code> 355 * value of <code>null</code> includes the user's layout set group, 356 * organization groups, inherited organization groups, and site groups. 357 * </li> 358 * </ul> 359 * 360 * @param userId the primary key of the user 361 * @param classNames the group entity class names (optionally 362 <code>null</code>). For more information see {@link 363 #getUserSitesGroups(long, String[], int)}. 364 * @param max the maximum number of groups to return 365 * @return the user's groups "sites" 366 * @throws PortalException if a portal exception occurred 367 */ 368 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 369 public List<Group> getUserSitesGroups(long userId, 370 java.lang.String[] classNames, int max) throws PortalException; 371 372 /** 373 * Returns the number of the guest or current user's groups 374 * "sites" associated with the group entity class names, including 375 * the Control Panel group if the user is permitted to view the Control 376 * Panel. 377 * 378 * @return the number of user's groups "sites" 379 * @throws PortalException if a portal exception occurred 380 */ 381 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 382 public int getUserSitesGroupsCount() throws PortalException; 383 384 /** 385 * Returns <code>true</code> if the user is associated with the group, 386 * including the user's inherited organizations and user groups. System and 387 * staged groups are not included. 388 * 389 * @param userId the primary key of the user 390 * @param groupId the primary key of the group 391 * @return <code>true</code> if the user is associated with the group; 392 <code>false</code> otherwise 393 * @throws PortalException if a portal exception occurred 394 */ 395 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 396 public boolean hasUserGroup(long userId, long groupId) 397 throws PortalException; 398 399 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 400 public List<Group> search(long companyId, long[] classNameIds, 401 java.lang.String keywords, 402 LinkedHashMap<java.lang.String, java.lang.Object> params, int start, 403 int end, OrderByComparator<Group> obc) throws PortalException; 404 405 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 406 public List<Group> search(long companyId, long[] classNameIds, 407 java.lang.String name, java.lang.String description, 408 LinkedHashMap<java.lang.String, java.lang.Object> params, 409 boolean andOperator, int start, int end, OrderByComparator<Group> obc) 410 throws PortalException; 411 412 /** 413 * Returns an ordered range of all the site groups and organization groups 414 * that match the name and description, optionally including the user's 415 * inherited organization groups and user groups. System and staged groups 416 * are not included. 417 * 418 * <p> 419 * Useful when paginating results. Returns a maximum of <code>end - 420 * start</code> instances. <code>start</code> and <code>end</code> are not 421 * primary keys, they are indexes in the result set. Thus, <code>0</code> 422 * refers to the first result in the set. Setting both <code>start</code> 423 * and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full 424 * result set. 425 * </p> 426 * 427 * @param companyId the primary key of the company 428 * @param name the group's name (optionally <code>null</code>) 429 * @param description the group's description (optionally 430 <code>null</code>) 431 * @param params the finder params (optionally <code>null</code>). To 432 include the user's inherited organizations and user groups in the 433 search, add entries having "usersGroups" and 434 "inherit" as keys mapped to the the user's ID. For more 435 information see {@link 436 com.liferay.portal.kernel.service.persistence.GroupFinder}. 437 * @param start the lower bound of the range of groups to return 438 * @param end the upper bound of the range of groups to return (not 439 inclusive) 440 * @return the matching groups ordered by name 441 * @throws PortalException if a portal exception occurred 442 */ 443 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 444 public List<Group> search(long companyId, java.lang.String name, 445 java.lang.String description, java.lang.String[] params, int start, 446 int end) throws PortalException; 447 448 /** 449 * Returns the number of groups and organization groups that match the name 450 * and description, optionally including the user's inherited organizations 451 * and user groups. System and staged groups are not included. 452 * 453 * @param companyId the primary key of the company 454 * @param name the group's name (optionally <code>null</code>) 455 * @param description the group's description (optionally 456 <code>null</code>) 457 * @param params the finder params (optionally <code>null</code>). To 458 include the user's inherited organizations and user groups in the 459 search, add entries having "usersGroups" and 460 "inherit" as keys mapped to the the user's ID. For more 461 information see {@link 462 com.liferay.portal.kernel.service.persistence.GroupFinder}. 463 * @return the number of matching groups 464 */ 465 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 466 public int searchCount(long companyId, java.lang.String name, 467 java.lang.String description, java.lang.String[] params); 468 469 /** 470 * Sets the groups associated with the role, removing and adding 471 * associations as necessary. 472 * 473 * @param roleId the primary key of the role 474 * @param groupIds the primary keys of the groups 475 * @throws PortalException if a portal exception occurred 476 */ 477 public void setRoleGroups(long roleId, long[] groupIds) 478 throws PortalException; 479 480 /** 481 * Removes the groups from the role. 482 * 483 * @param roleId the primary key of the role 484 * @param groupIds the primary keys of the groups 485 * @throws PortalException if a portal exception occurred 486 */ 487 public void unsetRoleGroups(long roleId, long[] groupIds) 488 throws PortalException; 489 490 /** 491 * Updates the group's friendly URL. 492 * 493 * @param groupId the primary key of the group 494 * @param friendlyURL the group's new friendlyURL (optionally 495 <code>null</code>) 496 * @return the group 497 * @throws PortalException if a portal exception occurred 498 */ 499 public Group updateFriendlyURL(long groupId, java.lang.String friendlyURL) 500 throws PortalException; 501 502 /** 503 * Updates the group. 504 * 505 * @param groupId the primary key of the group 506 * @param parentGroupId the primary key of the parent group 507 * @param name the group's name 508 * @param description the group's new description (optionally 509 <code>null</code>) 510 * @param type the group's new type. For more information see {@link 511 GroupConstants}. 512 * @param manualMembership whether manual membership is allowed for the 513 group 514 * @param membershipRestriction the group's membership restriction. For 515 more information see {@link GroupConstants}. 516 * @param friendlyURL the group's new friendlyURL (optionally 517 <code>null</code>) 518 * @param inheritContent whether to inherit content from the parent 519 group 520 * @param active whether the group is active 521 * @param serviceContext the service context to be applied (optionally 522 <code>null</code>). Can set the asset category IDs and asset 523 tag names for the group. 524 * @return the group 525 * @throws PortalException if a portal exception occurred 526 * @deprecated As of 7.0.0, replaced by {@link #updateGroup(long, long, Map, 527 Map, int, boolean, int, String, boolean, boolean, 528 ServiceContext)} 529 */ 530 @java.lang.Deprecated 531 public Group updateGroup(long groupId, long parentGroupId, 532 java.lang.String name, java.lang.String description, int type, 533 boolean manualMembership, int membershipRestriction, 534 java.lang.String friendlyURL, boolean inheritContent, boolean active, 535 com.liferay.portal.kernel.service.ServiceContext serviceContext) 536 throws PortalException; 537 538 public Group updateGroup(long groupId, long parentGroupId, 539 Map<Locale, java.lang.String> nameMap, 540 Map<Locale, java.lang.String> descriptionMap, int type, 541 boolean manualMembership, int membershipRestriction, 542 java.lang.String friendlyURL, boolean inheritContent, boolean active, 543 com.liferay.portal.kernel.service.ServiceContext serviceContext) 544 throws PortalException; 545 546 /** 547 * Updates the group's type settings. 548 * 549 * @param groupId the primary key of the group 550 * @param typeSettings the group's new type settings (optionally 551 <code>null</code>) 552 * @return the group 553 * @throws PortalException if a portal exception occurred 554 */ 555 public Group updateGroup(long groupId, java.lang.String typeSettings) 556 throws PortalException; 557 558 public void updateStagedPortlets(long groupId, 559 Map<java.lang.String, java.lang.String> stagedPortletIds) 560 throws PortalException; 561 }