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