001 /** 002 * Copyright (c) 2000-2011 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 specify the group's asset category IDs, 062 asset tag names, and 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 specify the group's asset category IDs, 090 asset tag names, and 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 111 the 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 130 the group or its assets or resources, if a group with the 131 primary key could not be found, or if the group was a system 132 group 133 * @throws SystemException if a system exception occurred 134 */ 135 public void deleteGroup(long groupId) 136 throws com.liferay.portal.kernel.exception.PortalException, 137 com.liferay.portal.kernel.exception.SystemException; 138 139 /** 140 * Returns the group with the primary key. 141 * 142 * @param groupId the primary key of the group 143 * @return the group with the primary key 144 * @throws PortalException if a group with the primary key could not be 145 found 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 160 * @throws SystemException if a system exception occurred 161 */ 162 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 163 public com.liferay.portal.model.Group getGroup(long companyId, 164 java.lang.String name) 165 throws com.liferay.portal.kernel.exception.PortalException, 166 com.liferay.portal.kernel.exception.SystemException; 167 168 /** 169 * Returns a range of all the site groups for which the user has control 170 * panel access. 171 * 172 * @param portlets the portlets to manage 173 * @param max the upper bound of the range of groups to consider (not 174 inclusive) 175 * @return the range of site groups for which the user has control panel 176 access 177 * @throws PortalException if a portal exception occurred 178 * @throws SystemException if a system exception occurred 179 */ 180 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 181 public java.util.List<com.liferay.portal.model.Group> getManageableSites( 182 java.util.Collection<com.liferay.portal.model.Portlet> portlets, int max) 183 throws com.liferay.portal.kernel.exception.PortalException, 184 com.liferay.portal.kernel.exception.SystemException; 185 186 /** 187 * Returns the groups associated with the organizations. 188 * 189 * @param organizations the organizations 190 * @return the groups associated with the organizations 191 */ 192 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 193 public java.util.List<com.liferay.portal.model.Group> getOrganizationsGroups( 194 java.util.List<com.liferay.portal.model.Organization> organizations); 195 196 /** 197 * Returns the group associated with the user. 198 * 199 * @param companyId the primary key of the company 200 * @param userId the primary key of the user 201 * @return the group associated with the user 202 * @throws PortalException if a matching group could not be found 203 * @throws SystemException if a system exception occurred 204 */ 205 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 206 public com.liferay.portal.model.Group getUserGroup(long companyId, 207 long userId) 208 throws com.liferay.portal.kernel.exception.PortalException, 209 com.liferay.portal.kernel.exception.SystemException; 210 211 /** 212 * Returns the groups associated with the user groups. 213 * 214 * @param userGroups the user groups 215 * @return the groups associated with the user groups 216 * @throws PortalException if any one of the user group's group could not 217 be found 218 * @throws SystemException if a system exception occurred 219 */ 220 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 221 public java.util.List<com.liferay.portal.model.Group> getUserGroupsGroups( 222 java.util.List<com.liferay.portal.model.UserGroup> userGroups) 223 throws com.liferay.portal.kernel.exception.PortalException, 224 com.liferay.portal.kernel.exception.SystemException; 225 226 /** 227 * Returns the range of all groups associated with the user's organization 228 * groups, including the ancestors of the organization groups, unless 229 * portal property <code>organizations.membership.strict</code> is set to 230 * <code>true</code>. 231 * 232 * <p> 233 * Useful when paginating results. Returns a maximum of <code>end - 234 * start</code> instances. <code>start</code> and <code>end</code> are not 235 * primary keys, they are indexes in the result set. Thus, <code>0</code> 236 * refers to the first result in the set. Setting both <code>start</code> 237 * and <code>end</code> to {@link 238 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the 239 * full result set. 240 * </p> 241 * 242 * @param userId the primary key of the user 243 * @param start the lower bound of the range of groups to consider 244 * @param end the upper bound of the range of groups to consider (not 245 inclusive) 246 * @return the range of groups associated with the user's organizations 247 * @throws PortalException if a user with the primary key could not be 248 found or if another portal exception occurred 249 * @throws SystemException if a system exception occurred 250 */ 251 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 252 public java.util.List<com.liferay.portal.model.Group> getUserOrganizationsGroups( 253 long userId, int start, int end) 254 throws com.liferay.portal.kernel.exception.PortalException, 255 com.liferay.portal.kernel.exception.SystemException; 256 257 /** 258 * Returns the guest or current user's layout set group, organization 259 * groups, inherited organization groups, and site groups. 260 * 261 * @return the user's layout set group, organization groups, and inherited 262 organization groups, and site groups 263 * @throws PortalException if a portal exception occurred 264 * @throws SystemException if a system exception occurred 265 */ 266 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 267 public java.util.List<com.liferay.portal.model.Group> getUserSites() 268 throws com.liferay.portal.kernel.exception.PortalException, 269 com.liferay.portal.kernel.exception.SystemException; 270 271 /** 272 * Returns the guest or current user's group "places" associated 273 * with the group entity class names, including the control panel group if 274 * the user is permitted to view the control panel. 275 * 276 * <p> 277 * <ul> <li> Class name "User" includes the user's layout set 278 * group. </li> <li> Class name "Organization" includes the 279 * user's immediate organization groups and inherited organization groups. 280 * </li> <li> Class name "Group" includes the user's immediate 281 * organization groups and site groups. </li> <li> A 282 * <code>classNames</code> value of <code>null</code> includes the user's 283 * layout set group, organization groups, inherited organization groups, 284 * and site groups. </li> </ul> 285 * </p> 286 * 287 * @param classNames the group entity class names (optionally 288 <code>null</code>). For more information see {@link 289 #getUserPlaces(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 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 user's group "places" associated with the group 303 * entity class names, including the control panel group if the user is 304 * 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 309 * user's immediate organization groups and inherited organization groups. 310 * </li> <li> Class name "Group" includes the user's immediate 311 * organization groups and site groups. </li> <li> A 312 * <code>classNames</code> value of <code>null</code> includes the user's 313 * layout set group, organization groups, inherited organization groups, 314 * and site groups. </li> </ul> 315 * </p> 316 * 317 * @param userId the primary key of the user 318 * @param classNames the group entity class names (optionally 319 <code>null</code>). For more information see {@link 320 #getUserPlaces(long, String[], int)} 321 * @param max the maximum number of groups to return 322 * @return the user's group "places" 323 * @throws PortalException if a portal exception occurred 324 * @throws SystemException if a system exception occurred 325 */ 326 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 327 public java.util.List<com.liferay.portal.model.Group> getUserPlaces( 328 long userId, java.lang.String[] classNames, int max) 329 throws com.liferay.portal.kernel.exception.PortalException, 330 com.liferay.portal.kernel.exception.SystemException; 331 332 /** 333 * Returns <code>true</code> if the user is associated with the group, 334 * including the user's inherited organizations and user groups. System and 335 * staged groups are not included. 336 * 337 * @param userId the primary key of the user 338 * @param groupId the primary key of the group 339 * @return <code>true</code> if the user is associated with the group; 340 <code>false</code> otherwise 341 * @throws SystemException if a system exception occurred 342 */ 343 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 344 public boolean hasUserGroup(long userId, long groupId) 345 throws com.liferay.portal.kernel.exception.SystemException; 346 347 /** 348 * Returns a name ordered range of all the site groups and organization 349 * groups that match the name and description, optionally including the 350 * user's inherited organization groups and user groups. System and staged 351 * groups are not included. 352 * 353 * <p> 354 * Useful when paginating results. Returns a maximum of <code>end - 355 * start</code> instances. <code>start</code> and <code>end</code> are not 356 * primary keys, they are indexes in the result set. Thus, <code>0</code> 357 * refers to the first result in the set. Setting both <code>start</code> 358 * and <code>end</code> to {@link 359 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the 360 * full result set. 361 * </p> 362 * 363 * @param companyId the primary key of the company 364 * @param name the group's name (optionally <code>null</code>) 365 * @param description the group's description (optionally 366 <code>null</code>) 367 * @param params the finder params (optionally <code>null</code>). To 368 include the user's inherited organizations and user groups in 369 the search, add entries having "usersGroups" and 370 "inherit" as keys mapped to the the user's ID. For 371 more information see {@link 372 com.liferay.portal.service.persistence.GroupFinder} 373 * @param start the lower bound of the range of groups to return 374 * @param end the upper bound of the range of groups to return (not 375 inclusive) 376 * @return the matching groups ordered by name 377 * @throws SystemException if a system exception occurred 378 */ 379 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 380 public java.util.List<com.liferay.portal.model.Group> search( 381 long companyId, java.lang.String name, java.lang.String description, 382 java.lang.String[] params, int start, int end) 383 throws com.liferay.portal.kernel.exception.SystemException; 384 385 /** 386 * Returns the number of groups and organization groups that match the name 387 * and description, optionally including the user's inherited organizations 388 * and user groups. System and staged groups are not included. 389 * 390 * @param companyId the primary key of the company 391 * @param name the group's name (optionally <code>null</code>) 392 * @param description the group's description (optionally 393 <code>null</code>) 394 * @param params the finder params (optionally <code>null</code>). To 395 include the user's inherited organizations and user groups in 396 the search, add entries having "usersGroups" and 397 "inherit" as keys mapped to the the user's ID. For 398 more information see {@link 399 com.liferay.portal.service.persistence.GroupFinder} 400 * @return the number of matching groups 401 * @throws SystemException if a system exception occurred 402 */ 403 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 404 public int searchCount(long companyId, java.lang.String name, 405 java.lang.String description, java.lang.String[] params) 406 throws com.liferay.portal.kernel.exception.SystemException; 407 408 /** 409 * Sets the groups associated with the role, removing and adding 410 * associations as necessary. 411 * 412 * @param roleId the primary key of the role 413 * @param groupIds the primary keys of the groups 414 * @throws PortalException if the user did not have permission to update 415 update the role 416 * @throws SystemException if a system exception occurred 417 */ 418 public void setRoleGroups(long roleId, long[] groupIds) 419 throws com.liferay.portal.kernel.exception.PortalException, 420 com.liferay.portal.kernel.exception.SystemException; 421 422 /** 423 * Removes the groups from the role. 424 * 425 * @param roleId the primary key of the role 426 * @param groupIds the primary keys of the groups 427 * @throws PortalException if the user did not have permission to update 428 the role 429 * @throws SystemException if a system exception occurred 430 */ 431 public void unsetRoleGroups(long roleId, long[] groupIds) 432 throws com.liferay.portal.kernel.exception.PortalException, 433 com.liferay.portal.kernel.exception.SystemException; 434 435 /** 436 * Updates the group's friendly URL. 437 * 438 * @param groupId the primary key of the group 439 * @param friendlyURL the group's new friendlyURL (optionally 440 <code>null</code>) 441 * @return the group 442 * @throws PortalException if the user did not have permission to update 443 the group, if a group with the primary key could not be found, 444 or if a valid friendly URL could not be created for the group 445 * @throws SystemException if a system exception occurred 446 */ 447 public com.liferay.portal.model.Group updateFriendlyURL(long groupId, 448 java.lang.String friendlyURL) 449 throws com.liferay.portal.kernel.exception.PortalException, 450 com.liferay.portal.kernel.exception.SystemException; 451 452 /** 453 * Updates the group's type settings. 454 * 455 * @param groupId the primary key of the group 456 * @param typeSettings the group's new type settings (optionally 457 <code>null</code>) 458 * @return the group 459 * @throws PortalException if the user did not have permission to update 460 the group or if a group with the primary key could not be found 461 * @throws SystemException if a system exception occurred 462 */ 463 public com.liferay.portal.model.Group updateGroup(long groupId, 464 java.lang.String typeSettings) 465 throws com.liferay.portal.kernel.exception.PortalException, 466 com.liferay.portal.kernel.exception.SystemException; 467 468 /** 469 * Updates the group. 470 * 471 * @param groupId the primary key of the group 472 * @param name the group's new name 473 * @param description the group's new description (optionally 474 <code>null</code>) 475 * @param type the group's new type. For more information see {@link 476 com.liferay.portal.model.GroupConstants} 477 * @param friendlyURL the group's new friendlyURL (optionally 478 <code>null</code>) 479 * @param active whether the group is active 480 * @param serviceContext the service context to be applied (optionally 481 <code>null</code>). Can specify the group's replacement asset 482 category IDs and replacement asset tag names 483 * @return the group 484 * @throws PortalException if the user did not have permission to update 485 the group, if a group with the primary key could not be found, 486 if the friendly URL was invalid or could one not be created 487 * @throws SystemException if a system exception occurred 488 */ 489 public com.liferay.portal.model.Group updateGroup(long groupId, 490 java.lang.String name, java.lang.String description, int type, 491 java.lang.String friendlyURL, boolean active, 492 com.liferay.portal.service.ServiceContext serviceContext) 493 throws com.liferay.portal.kernel.exception.PortalException, 494 com.liferay.portal.kernel.exception.SystemException; 495 }