public class

AppsGroupsService

extends AppsPropertyService
java.lang.Object
   ↳ com.google.gdata.client.Service
     ↳ com.google.gdata.client.GoogleService
       ↳ com.google.gdata.client.appsforyourdomain.AppsForYourDomainService
         ↳ com.google.gdata.client.appsforyourdomain.AppsPropertyService
           ↳ com.google.gdata.client.appsforyourdomain.AppsGroupsService

Class Overview

Service class specializing AppsPropertyService for groups management

Summary

Constants
String APPS_PROP_GROUP_DESC
String APPS_PROP_GROUP_EMAIL
String APPS_PROP_GROUP_ID
String APPS_PROP_GROUP_MEMBER_ID
String APPS_PROP_GROUP_NAME
String APPS_PROP_GROUP_PERMISSION
String APPS_PROP_GROUP_ROLE
String BASE_URL
[Expand]
Inherited Constants
From class com.google.gdata.client.appsforyourdomain.AppsForYourDomainService
Fields
public final String baseDomainUrl
[Expand]
Inherited Fields
From class com.google.gdata.client.GoogleService
From class com.google.gdata.client.Service
Public Constructors
AppsGroupsService(String adminUser, String adminPassword, String domain, String applicationName)
Parameterized constructor to setup a Service object with user credentials.
AppsGroupsService(String domain, String applicationName)
Parameterized constructor to setup a Service object which can be used to initialize the service without obtaining a token.
Public Methods
GenericEntry addMemberToGroup(String groupId, String memberName)
Adds a new member to the group.
GenericEntry addOwnerToGroup(String groupId, String ownerName)
Adds a new member as owner to the group.
GenericEntry createGroup(String groupId, String groupName, String groupDescription, String emailPermission)
Creates a new group in the domain.
void deleteGroup(String groupId)
Deletes a group from the domain.
void deleteMemberFromGroup(String groupId, String memberName)
Removes member subscription to the group.
boolean doesEntityExist(String feedUrlSuffix)
Checks for an available feed from a given Url.
GenericFeed getNextPage(Link atomLink)
Get the next page from the atom:next link
boolean isMember(String groupId, String memberId)
Checks if an user/group is a member of the group specified.
boolean isOwner(String groupId, String email)
Checks if an user is a owner of the group specified.
void removeOwnerFromGroup(String email, String groupId)
Removes an owner from the group.
GenericFeed retreiveGroupOwners(String groupId)
Retrieves all the owners of a given Group.
GenericFeed retrieveAllGroups()
Retrieves all groups in a domain as a GenericFeed.
GenericFeed retrieveAllMembers(String groupId)
Retrieves all the members of a group as a GenericFeed.
List<GenericEntry> retrieveAllPagesOfGroups()
Retrieves all the pages of the groups feed.
GenericEntry retrieveGroup(String groupId)
Retrieves the group details.
GenericFeed retrieveGroups(String memberName, boolean directOnly)
Retrieves all groups of the given member.
GenericFeed retrievePageOfGroups(Link next)
Retrieves next page of groups in a domain as a GenericFeed.
GenericFeed retrievePageOfMembers(Link next)
Retrieves next page of members of a group as a GenericFeed.
GenericEntry updateGroup(String groupId, String groupName, String groupDescription, String emailPermission)
Updates the group properties.
[Expand]
Inherited Methods
From class com.google.gdata.client.appsforyourdomain.AppsForYourDomainService
From class com.google.gdata.client.GoogleService
From class com.google.gdata.client.Service
From class java.lang.Object
From interface com.google.gdata.client.AuthTokenFactory.TokenListener

Constants

public static final String APPS_PROP_GROUP_DESC

Constant Value: "description"

public static final String APPS_PROP_GROUP_EMAIL

Constant Value: "email"

public static final String APPS_PROP_GROUP_ID

Constant Value: "groupId"

public static final String APPS_PROP_GROUP_MEMBER_ID

Constant Value: "memberId"

public static final String APPS_PROP_GROUP_NAME

Constant Value: "groupName"

public static final String APPS_PROP_GROUP_PERMISSION

Constant Value: "emailPermission"

public static final String APPS_PROP_GROUP_ROLE

Constant Value: "role"

public static final String BASE_URL

Constant Value: "https://apps-apis.google.com/a/feeds/group/2.0/"

Fields

public final String baseDomainUrl

Public Constructors

public AppsGroupsService (String adminUser, String adminPassword, String domain, String applicationName)

Parameterized constructor to setup a Service object with user credentials.

Parameters
adminUser Administrator username
adminPassword Administrator password
domain Domain being configured
applicationName Application name consuming the API
Throws
AuthenticationException If an authentication error occurs

public AppsGroupsService (String domain, String applicationName)

Parameterized constructor to setup a Service object which can be used to initialize the service without obtaining a token. The user should explicitly authorize the service by calling either setUserCredentials or setUserToken when using this constructor.

Parameters
domain Domain being configured
applicationName Application name consuming the API
Throws
AuthenticationException If an authentication error occurs

Public Methods

public GenericEntry addMemberToGroup (String groupId, String memberName)

Adds a new member to the group. The member can either be a user/group in the domain or an arbitrary email address

Parameters
groupId Unique ID of the group
memberName Member username, group name or an email address
Returns
  • GenericEntry object with details of the newly added member
Throws
AppsForYourDomainException If a Provisioning API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public GenericEntry addOwnerToGroup (String groupId, String ownerName)

Adds a new member as owner to the group. The owner can either be user or another group. This does not add the owner to the member feed. The owners can be retrieved from the owner feed.

Parameters
groupId Unique ID of the group
ownerName Member username or group name
Returns
  • GenericEntry object with details of the newly added owner
Throws
AppsForYourDomainException If a Provisioning API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public GenericEntry createGroup (String groupId, String groupName, String groupDescription, String emailPermission)

Creates a new group in the domain.

Parameters
groupId A unique identifier for the group
groupName Name of the group
groupDescription A description for the group
emailPermission Email permission for user
Returns
  • GenericEntry object with details of the newly created group
Throws
AppsForYourDomainException If a Provisioning API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public void deleteGroup (String groupId)

Deletes a group from the domain. Deleting the group does not delete the user accounts for group members.

Parameters
groupId Unique ID of the group
Throws
AppsForYourDomainException If a Provisioning API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public void deleteMemberFromGroup (String groupId, String memberName)

Removes member subscription to the group.

Parameters
groupId Unique ID of the group
memberName Member username or group name
Throws
AppsForYourDomainException If a Provisioning API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException

public boolean doesEntityExist (String feedUrlSuffix)

Checks for an available feed from a given Url. This method is used to discover members and owners

Parameters
feedUrlSuffix The suffix of the feed URL to be investigated.
Returns
  • True if entity exists, false otherwise
Throws
AppsForYourDomainException If a Provisioning API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public GenericFeed getNextPage (Link atomLink)

Get the next page from the atom:next link

Parameters
atomLink The feed link for next page
Returns
  • A GenericFeed of entries of next page from the atom:next link
Throws
AppsForYourDomainException If a Provisioning API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public boolean isMember (String groupId, String memberId)

Checks if an user/group is a member of the group specified.

Parameters
groupId Group to be checked for
memberId Username/Group
Returns
  • True, if given entity is a member
Throws
AppsForYourDomainException If a Provisioning API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public boolean isOwner (String groupId, String email)

Checks if an user is a owner of the group specified.

Parameters
groupId Group ownership to be checked for
email Owner's email
Returns
  • True, if given entity is an owner
Throws
AppsForYourDomainException If a Provisioning API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public void removeOwnerFromGroup (String email, String groupId)

Removes an owner from the group.

Parameters
email Owner email address
groupId Unique ID of the group
Throws
AppsForYourDomainException If a Provisioning API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public GenericFeed retreiveGroupOwners (String groupId)

Retrieves all the owners of a given Group.

Parameters
groupId The unique ID of the group
Throws
AppsForYourDomainException If a Provisioning API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public GenericFeed retrieveAllGroups ()

Retrieves all groups in a domain as a GenericFeed. The client should follow the next feed link to retrieve subsequent pages.

Throws
AppsForYourDomainException If a Provisioning API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public GenericFeed retrieveAllMembers (String groupId)

Retrieves all the members of a group as a GenericFeed.

Parameters
groupId Unique ID of the group
Returns
  • List of GenericEntry objects containing member details
Throws
AppsForYourDomainException If a Provisioning API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException

public List<GenericEntry> retrieveAllPagesOfGroups ()

Retrieves all the pages of the groups feed. This method can be used by clients to retrieve a List of entries from all the pages of group feed.

Returns
  • List of GenericEntry instances
Throws
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public GenericEntry retrieveGroup (String groupId)

Retrieves the group details.

Parameters
groupId Unique ID of the group
Returns
  • GenericEntry with the details of the group.
Throws
AppsForYourDomainException If a Provisioning API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public GenericFeed retrieveGroups (String memberName, boolean directOnly)

Retrieves all groups of the given member.

Parameters
memberName Member username
directOnly If true, members with direct association only will be considered
Returns
  • List of GenericEntry with membership details.
Throws
AppsForYourDomainException If a Provisioning API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public GenericFeed retrievePageOfGroups (Link next)

Retrieves next page of groups in a domain as a GenericFeed.

Parameters
next
Throws
AppsForYourDomainException If a Provisioning API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails

public GenericFeed retrievePageOfMembers (Link next)

Retrieves next page of members of a group as a GenericFeed.

Parameters
next Atom link to the next page
Returns
  • List of GenericEntry objects containing member details
Throws
AppsForYourDomainException If a Provisioning API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException

public GenericEntry updateGroup (String groupId, String groupName, String groupDescription, String emailPermission)

Updates the group properties. When a null or empty value is sent, the field is not updated the old value is preserved. Sending all null or empty values will not update the group and will fetch the original group entry.

Parameters
groupId Unique ID of the group
groupName Name of the group. A null or empty group name will preserve the old value
groupDescription Description of the group. A null or empty value will preserve the old value
emailPermission Email permissions associated with the group. A null or empty value will preserve the old value
Returns
  • GenericEntry object with updated details of the group
Throws
AppsForYourDomainException If a Provisioning API error occurs
MalformedURLException If a URL related error occurs
IOException If a network I/O related error occurs
ServiceException If the API service fails