@BoxResourceType(value="group") public class BoxGroup extends BoxCollaborator
Unless otherwise noted, the methods in this class can throw an unchecked BoxAPIException
(unchecked
meaning that the compiler won't force you to handle it) if an error occurs. If you wish to implement custom error
handling for errors related to the Box REST API, you should capture this exception explicitly.
Modifier and Type | Class and Description |
---|---|
class |
BoxGroup.Info
Contains information about a BoxGroup.
|
BoxCollaborator.CollaboratorType, BoxCollaborator.GroupType
Modifier and Type | Field and Description |
---|---|
static URLTemplate |
ADD_MEMBERSHIP_URL_TEMPLATE |
static URLTemplate |
COLLABORATIONS_URL_TEMPLATE |
static URLTemplate |
GROUP_URL_TEMPLATE |
static URLTemplate |
GROUPS_URL_TEMPLATE |
static URLTemplate |
MEMBERSHIPS_URL_TEMPLATE |
Constructor and Description |
---|
BoxGroup(BoxAPIConnection api,
String id)
Constructs a BoxGroup for a group with a given ID.
|
Modifier and Type | Method and Description |
---|---|
BoxGroupMembership.Info |
addMembership(BoxUser user)
Adds a member to this group with the default role.
|
BoxGroupMembership.Info |
addMembership(BoxUser user,
BoxGroupMembership.GroupRole role)
Adds a member to this group with the specified role.
|
BoxGroupMembership.Info |
addMembership(BoxUser user,
BoxGroupMembership.GroupRole role,
Map<BoxGroupMembership.Permission,Boolean> configurablePermissions)
Adds a member to this group with the specified role.
|
static BoxGroup.Info |
createGroup(BoxAPIConnection api,
String name)
Creates a new group with a specified name.
|
static BoxGroup.Info |
createGroup(BoxAPIConnection api,
String name,
String provenance,
String externalSyncIdentifier,
String description,
String invitabilityLevel,
String memberViewabilityLevel)
Creates a new group with a specified name.
|
void |
delete()
Deletes this group.
|
Iterable<BoxCollaboration.Info> |
getAllCollaborations(String... fields)
Gets information about all of the collaborations for this group.
|
static Iterable<BoxGroup.Info> |
getAllGroups(BoxAPIConnection api)
Gets an iterable of all the groups in the enterprise.
|
static Iterable<BoxGroup.Info> |
getAllGroups(BoxAPIConnection api,
String... fields)
Gets an iterable of all the groups in the enterprise.
|
static Iterable<BoxGroup.Info> |
getAllGroupsByName(BoxAPIConnection api,
String name,
String... fields)
Gets an iterable of all the groups in the enterprise that are starting with the given name string.
|
Iterable<BoxGroupMembership.Info> |
getAllMemberships(String... fields)
Gets information about all of the group memberships for this group as iterable with paging support.
|
Collection<BoxCollaboration.Info> |
getCollaborations()
Gets information about all of the collaborations for this group.
|
BoxGroup.Info |
getInfo(String... fields)
Gets information about this group.
|
Collection<BoxGroupMembership.Info> |
getMemberships()
Gets information about all of the group memberships for this group.
|
void |
updateInfo(BoxGroup.Info info)
Updates the information about this group with any info fields that have been modified locally.
|
equals, getAPI, getID, getResourceType, hashCode
public static final URLTemplate GROUPS_URL_TEMPLATE
public static final URLTemplate GROUP_URL_TEMPLATE
getInfo(String...)
public static final URLTemplate MEMBERSHIPS_URL_TEMPLATE
getMemberships()
public static final URLTemplate ADD_MEMBERSHIP_URL_TEMPLATE
addMembership(BoxUser)
public static final URLTemplate COLLABORATIONS_URL_TEMPLATE
getCollaborations()
public BoxGroup(BoxAPIConnection api, String id)
api
- the API connection to be used by the group.id
- the ID of the group.public static BoxGroup.Info createGroup(BoxAPIConnection api, String name)
api
- the API connection to be used by the group.name
- the name of the new group.public static BoxGroup.Info createGroup(BoxAPIConnection api, String name, String provenance, String externalSyncIdentifier, String description, String invitabilityLevel, String memberViewabilityLevel)
api
- the API connection to be used by the group.name
- the name of the new group.provenance
- the provenance of the new groupexternalSyncIdentifier
- the external_sync_identifier of the new groupdescription
- the description of the new groupinvitabilityLevel
- the invitibility_level of the new groupmemberViewabilityLevel
- the member_viewability_level of the new grouppublic static Iterable<BoxGroup.Info> getAllGroups(BoxAPIConnection api)
api
- the API connection to be used when retrieving the groups.public static Iterable<BoxGroup.Info> getAllGroups(BoxAPIConnection api, String... fields)
api
- the API connection to be used when retrieving the groups.fields
- the fields to retrieve.public static Iterable<BoxGroup.Info> getAllGroupsByName(BoxAPIConnection api, String name, String... fields)
api
- the API connection to be used when retrieving the groups.name
- the name prefix of the groups. If the groups need to searched by full name that has spaces,
then the parameter string should have been wrapped with "".fields
- the fields to retrieve.public BoxGroup.Info getInfo(String... fields)
fields
- the fields to retrieve.public Collection<BoxGroupMembership.Info> getMemberships()
public Iterable<BoxGroupMembership.Info> getAllMemberships(String... fields)
fields
- the fields to retrieve.public BoxGroupMembership.Info addMembership(BoxUser user)
user
- the member to be added to this group.public BoxGroupMembership.Info addMembership(BoxUser user, BoxGroupMembership.GroupRole role)
user
- the member to be added to this group.role
- the role of the user in this group. Can be null to assign the default role.public BoxGroupMembership.Info addMembership(BoxUser user, BoxGroupMembership.GroupRole role, Map<BoxGroupMembership.Permission,Boolean> configurablePermissions)
user
- the member to be added to this group.role
- the role of the user in this group. Can be null to assign the default role.configurablePermissions
- the configurable permission of the user as a group admin.
Can be null to give all group admin permissions.public Collection<BoxCollaboration.Info> getCollaborations()
public Iterable<BoxCollaboration.Info> getAllCollaborations(String... fields)
fields
- the optional fields to retrieve.public void delete()
public void updateInfo(BoxGroup.Info info)
info
- the updated info.