001 /** 002 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved. 003 * 004 * The contents of this file are subject to the terms of the Liferay Enterprise 005 * Subscription License ("License"). You may not use this file except in 006 * compliance with the License. You can obtain a copy of the License by 007 * contacting Liferay, Inc. See the License for the specific language governing 008 * permissions and limitations under the License, including but not limited to 009 * distribution rights of the Software. 010 * 011 * 012 * 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 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 /** 264 * Returns the guest or current user's layout set group, organization 265 * groups, inherited organization groups, and site groups. 266 * 267 * @return the user's layout set group, organization groups, and inherited 268 organization groups, and site groups 269 * @throws PortalException if a portal exception occurred 270 * @throws SystemException if a system exception occurred 271 */ 272 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 273 public java.util.List<com.liferay.portal.model.Group> getUserSites() 274 throws com.liferay.portal.kernel.exception.PortalException, 275 com.liferay.portal.kernel.exception.SystemException; 276 277 /** 278 * Returns the guest or current user's group "places" associated 279 * with the group entity class names, including the control panel group if 280 * the user is permitted to view the control panel. 281 * 282 * <p> 283 * <ul> <li> Class name "User" includes the user's layout set 284 * group. </li> <li> Class name "Organization" includes the user's 285 * immediate organization groups and inherited organization groups. </li> 286 * <li> Class name "Group" includes the user's immediate 287 * organization groups and site groups. </li> <li> A <code>classNames</code> 288 * value of <code>null</code> includes the user's layout set group, 289 * organization groups, inherited organization groups, and site groups. 290 * </li> </ul> 291 * </p> 292 * 293 * @param classNames the group entity class names (optionally 294 <code>null</code>). For more information see {@link 295 #getUserPlaces(String[], int)} 296 * @param max the maximum number of groups to return 297 * @return the user's group "places" 298 * @throws PortalException if a portal exception occurred 299 * @throws SystemException if a system exception occurred 300 */ 301 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 302 public java.util.List<com.liferay.portal.model.Group> getUserPlaces( 303 java.lang.String[] classNames, int max) 304 throws com.liferay.portal.kernel.exception.PortalException, 305 com.liferay.portal.kernel.exception.SystemException; 306 307 /** 308 * Returns the user's group "places" associated with the group 309 * entity class names, including the control panel group if the user is 310 * permitted to view the control panel. 311 * 312 * <p> 313 * <ul> <li> Class name "User" includes the user's layout set 314 * group. </li> <li> Class name "Organization" includes the user's 315 * immediate organization groups and inherited organization groups. </li> 316 * <li> Class name "Group" includes the user's immediate 317 * organization groups and site groups. </li> <li> A <code>classNames</code> 318 * value of <code>null</code> includes the user's layout set group, 319 * organization groups, inherited organization groups, and site groups. 320 * </li> </ul> 321 * </p> 322 * 323 * @param userId the primary key of the user 324 * @param classNames the group entity class names (optionally 325 <code>null</code>). For more information see {@link 326 #getUserPlaces(long, String[], int)} 327 * @param max the maximum number of groups to return 328 * @return the user's group "places" 329 * @throws PortalException if a portal exception occurred 330 * @throws SystemException if a system exception occurred 331 */ 332 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 333 public java.util.List<com.liferay.portal.model.Group> getUserPlaces( 334 long userId, java.lang.String[] classNames, int max) 335 throws com.liferay.portal.kernel.exception.PortalException, 336 com.liferay.portal.kernel.exception.SystemException; 337 338 /** 339 * Returns <code>true</code> if the user is associated with the group, 340 * including the user's inherited organizations and user groups. System and 341 * staged groups are not included. 342 * 343 * @param userId the primary key of the user 344 * @param groupId the primary key of the group 345 * @return <code>true</code> if the user is associated with the group; 346 <code>false</code> otherwise 347 * @throws SystemException if a system exception occurred 348 */ 349 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 350 public boolean hasUserGroup(long userId, long groupId) 351 throws com.liferay.portal.kernel.exception.SystemException; 352 353 /** 354 * Returns a name ordered range of all the site groups and organization 355 * groups that match the name and description, optionally including the 356 * user's inherited organization groups and user groups. System and staged 357 * groups are not included. 358 * 359 * <p> 360 * Useful when paginating results. Returns a maximum of <code>end - 361 * start</code> instances. <code>start</code> and <code>end</code> are not 362 * primary keys, they are indexes in the result set. Thus, <code>0</code> 363 * refers to the first result in the set. Setting both <code>start</code> 364 * and <code>end</code> to {@link 365 * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full 366 * result set. 367 * </p> 368 * 369 * @param companyId the primary key of the company 370 * @param name the group's name (optionally <code>null</code>) 371 * @param description the group's description (optionally 372 <code>null</code>) 373 * @param params the finder params (optionally <code>null</code>). To 374 include the user's inherited organizations and user groups in the 375 search, add entries having "usersGroups" and 376 "inherit" as keys mapped to the the user's ID. For more 377 information see {@link 378 com.liferay.portal.service.persistence.GroupFinder} 379 * @param start the lower bound of the range of groups to return 380 * @param end the upper bound of the range of groups to return (not 381 inclusive) 382 * @return the matching groups ordered by name 383 * @throws PortalException if a portal exception occurred 384 * @throws SystemException if a system exception occurred 385 */ 386 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 387 public java.util.List<com.liferay.portal.model.Group> search( 388 long companyId, java.lang.String name, java.lang.String description, 389 java.lang.String[] params, int start, int end) 390 throws com.liferay.portal.kernel.exception.PortalException, 391 com.liferay.portal.kernel.exception.SystemException; 392 393 /** 394 * Returns the number of groups and organization groups that match the name 395 * and description, optionally including the user's inherited organizations 396 * and user groups. System and staged groups are not included. 397 * 398 * @param companyId the primary key of the company 399 * @param name the group's name (optionally <code>null</code>) 400 * @param description the group's description (optionally 401 <code>null</code>) 402 * @param params the finder params (optionally <code>null</code>). To 403 include the user's inherited organizations and user groups in the 404 search, add entries having "usersGroups" and 405 "inherit" as keys mapped to the the user's ID. For more 406 information see {@link 407 com.liferay.portal.service.persistence.GroupFinder} 408 * @return the number of matching groups 409 * @throws SystemException if a system exception occurred 410 */ 411 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) 412 public int searchCount(long companyId, java.lang.String name, 413 java.lang.String description, java.lang.String[] params) 414 throws com.liferay.portal.kernel.exception.SystemException; 415 416 /** 417 * Sets the groups associated with the role, removing and adding 418 * associations as necessary. 419 * 420 * @param roleId the primary key of the role 421 * @param groupIds the primary keys of the groups 422 * @throws PortalException if the user did not have permission to update 423 update the role 424 * @throws SystemException if a system exception occurred 425 */ 426 public void setRoleGroups(long roleId, long[] groupIds) 427 throws com.liferay.portal.kernel.exception.PortalException, 428 com.liferay.portal.kernel.exception.SystemException; 429 430 /** 431 * Removes the groups from the role. 432 * 433 * @param roleId the primary key of the role 434 * @param groupIds the primary keys of the groups 435 * @throws PortalException if the user did not have permission to update the 436 role 437 * @throws SystemException if a system exception occurred 438 */ 439 public void unsetRoleGroups(long roleId, long[] groupIds) 440 throws com.liferay.portal.kernel.exception.PortalException, 441 com.liferay.portal.kernel.exception.SystemException; 442 443 /** 444 * Updates the group's friendly URL. 445 * 446 * @param groupId the primary key of the group 447 * @param friendlyURL the group's new friendlyURL (optionally 448 <code>null</code>) 449 * @return the group 450 * @throws PortalException if the user did not have permission to update the 451 group, if a group with the primary key could not be found, or if 452 a valid friendly URL could not be created for the group 453 * @throws SystemException if a system exception occurred 454 */ 455 public com.liferay.portal.model.Group updateFriendlyURL(long groupId, 456 java.lang.String friendlyURL) 457 throws com.liferay.portal.kernel.exception.PortalException, 458 com.liferay.portal.kernel.exception.SystemException; 459 460 /** 461 * Updates the group's type settings. 462 * 463 * @param groupId the primary key of the group 464 * @param typeSettings the group's new type settings (optionally 465 <code>null</code>) 466 * @return the group 467 * @throws PortalException if the user did not have permission to update the 468 group or if a group with the primary key could not be found 469 * @throws SystemException if a system exception occurred 470 */ 471 public com.liferay.portal.model.Group updateGroup(long groupId, 472 java.lang.String typeSettings) 473 throws com.liferay.portal.kernel.exception.PortalException, 474 com.liferay.portal.kernel.exception.SystemException; 475 476 /** 477 * Updates the group. 478 * 479 * @param groupId the primary key of the group 480 * @param name the group's new name 481 * @param description the group's new description (optionally 482 <code>null</code>) 483 * @param type the group's new type. For more information see {@link 484 com.liferay.portal.model.GroupConstants} 485 * @param friendlyURL the group's new friendlyURL (optionally 486 <code>null</code>) 487 * @param active whether the group is active 488 * @param serviceContext the service context to be applied (optionally 489 <code>null</code>). Can specify the group's replacement asset 490 category IDs and replacement asset tag names 491 * @return the group 492 * @throws PortalException if the user did not have permission to update the 493 group, if a group with the primary key could not be found, if the 494 friendly URL was invalid or could one not be created 495 * @throws SystemException if a system exception occurred 496 */ 497 public com.liferay.portal.model.Group updateGroup(long groupId, 498 java.lang.String name, java.lang.String description, int type, 499 java.lang.String friendlyURL, boolean active, 500 com.liferay.portal.service.ServiceContext serviceContext) 501 throws com.liferay.portal.kernel.exception.PortalException, 502 com.liferay.portal.kernel.exception.SystemException; 503 }