Google Data APIs Client Library (1.41.1)



com.google.gdata.client.appsforyourdomain
Class AppsGroupsService

java.lang.Object
  extended by com.google.gdata.client.Service
      extended by com.google.gdata.client.GoogleService
          extended by com.google.gdata.client.appsforyourdomain.AppsForYourDomainService
              extended by com.google.gdata.client.appsforyourdomain.AppsPropertyService
                  extended by com.google.gdata.client.appsforyourdomain.AppsGroupsService
All Implemented Interfaces:
AuthTokenFactory.TokenListener

public class AppsGroupsService
extends AppsPropertyService

Service class specializing AppsPropertyService for groups management


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gdata.client.GoogleService
GoogleService.AccountDeletedException, GoogleService.AccountDisabledException, GoogleService.CaptchaRequiredException, GoogleService.InvalidCredentialsException, GoogleService.NotVerifiedException, GoogleService.ServiceUnavailableException, GoogleService.SessionExpiredException, GoogleService.TermsNotAgreedException
 
Nested classes/interfaces inherited from class com.google.gdata.client.Service
Service.ClientInputProperties, Service.ClientOutputProperties, Service.ClientStreamProperties, Service.GDataRequest, Service.GDataRequestFactory, Service.Versions
 
Field Summary
static java.lang.String APPS_PROP_GROUP_DESC
           
static java.lang.String APPS_PROP_GROUP_EMAIL
           
static java.lang.String APPS_PROP_GROUP_ID
           
static java.lang.String APPS_PROP_GROUP_MEMBER_ID
           
static java.lang.String APPS_PROP_GROUP_NAME
           
static java.lang.String APPS_PROP_GROUP_PERMISSION
           
static java.lang.String APPS_PROP_GROUP_ROLE
           
static java.lang.String BASE_URL
           
 java.lang.String baseDomainUrl
           
 
Fields inherited from class com.google.gdata.client.appsforyourdomain.AppsForYourDomainService
APPS_SERVICE, DOMAIN_NAME, HTTPS_PROTOCOL
 
Fields inherited from class com.google.gdata.client.Service
connectTimeout, extProfile, metadataRegistry, requestFactory
 
Constructor Summary
AppsGroupsService(java.lang.String adminUser, java.lang.String adminPassword, java.lang.String domain, java.lang.String applicationName)
          Parameterized constructor to setup a Service object with user credentials.
 
Method Summary
 GenericEntry addMemberToGroup(java.lang.String groupId, java.lang.String memberName)
          Adds a new member to the group.
 GenericEntry addOwnerToGroup(java.lang.String groupId, java.lang.String ownerName)
          Adds a new member as owner to the group.
 GenericEntry createGroup(java.lang.String groupId, java.lang.String groupName, java.lang.String groupDescription, java.lang.String emailPermission)
          Creates a new group in the domain.
 void deleteGroup(java.lang.String groupId)
          Deletes a group from the domain.
 void deleteMemberFromGroup(java.lang.String groupId, java.lang.String memberName)
          Removes member subscription to the group.
 boolean doesEntityExist(java.lang.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(java.lang.String groupId, java.lang.String memberId)
          Checks if an user/group is a member of the group specified.
 boolean isOwner(java.lang.String groupId, java.lang.String email)
          Checks if an user is a owner of the group specified.
 GenericFeed retreiveGroupOwners(java.lang.String groupId)
          Retrieves all the owners of a given Group.
 GenericFeed retrieveAllGroups()
          Retrieves all groups in a domain as a GenericFeed.
 GenericFeed retrieveAllMembers(java.lang.String groupId)
          Retrieves all the members of a group as a GenericFeed.
 GenericEntry retrieveGroup(java.lang.String groupId)
          Retrieves the group details.
 GenericFeed retrieveGroups(java.lang.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(java.lang.String groupId, java.lang.String groupName, java.lang.String groupDescription, java.lang.String emailPermission)
          Updates the group properties.
 
Methods inherited from class com.google.gdata.client.appsforyourdomain.AppsForYourDomainService
delete, getEntry, getEntry, getFeed, getFeed, insert, query, update
 
Methods inherited from class com.google.gdata.client.GoogleService
addCookie, batch, createRequest, createRequest, delete, getAuthToken, getAuthTokenFactory, getCookieManager, getCookies, getEntry, getFeed, getFeed, getFeed, handleRedirectException, handlesCookies, handleSessionExpiredException, makePostRequest, setAuthSubToken, setAuthSubToken, setAuthTokenFactory, setCookieManager, setHandlesCookies, setOAuthCredentials, setUserCredentials, setUserCredentials, setUserCredentials, setUserCredentials, setUserToken, tokenChanged
 
Methods inherited from class com.google.gdata.client.Service
classOf, createBatchRequest, createDeleteRequest, createEntryRequest, createFeedRequest, createFeedRequest, createInsertRequest, createLinkQueryRequest, createPatchRequest, createUpdateRequest, delete, delete, endVersionScope, getAltRegistry, getContentType, getDefaultAltRegistry, getExtensionProfile, getFeed, getMetadataRegistry, getProtocolVersion, getRequestFactory, getSchema, getServiceVersion, getStreamFromLink, getVersion, initServiceVersion, introspect, parseResponseData, parseResponseData, patch, patch, query, query, setAcceptLanguage, setAltRegistry, setConnectTimeout, setContentType, setExtensionProfile, setHeader, setOAuthProxyHeaders, setPrivateHeader, setProtocolVersion, setReadTimeout, setRequestFactory, setTimeouts, startVersionScope, update, useSsl, writeRequestData, writeRequestData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE_URL

public static final java.lang.String BASE_URL
See Also:
Constant Field Values

baseDomainUrl

public final java.lang.String baseDomainUrl

APPS_PROP_GROUP_ID

public static final java.lang.String APPS_PROP_GROUP_ID
See Also:
Constant Field Values

APPS_PROP_GROUP_NAME

public static final java.lang.String APPS_PROP_GROUP_NAME
See Also:
Constant Field Values

APPS_PROP_GROUP_DESC

public static final java.lang.String APPS_PROP_GROUP_DESC
See Also:
Constant Field Values

APPS_PROP_GROUP_PERMISSION

public static final java.lang.String APPS_PROP_GROUP_PERMISSION
See Also:
Constant Field Values

APPS_PROP_GROUP_MEMBER_ID

public static final java.lang.String APPS_PROP_GROUP_MEMBER_ID
See Also:
Constant Field Values

APPS_PROP_GROUP_ROLE

public static final java.lang.String APPS_PROP_GROUP_ROLE
See Also:
Constant Field Values

APPS_PROP_GROUP_EMAIL

public static final java.lang.String APPS_PROP_GROUP_EMAIL
See Also:
Constant Field Values
Constructor Detail

AppsGroupsService

public AppsGroupsService(java.lang.String adminUser,
                         java.lang.String adminPassword,
                         java.lang.String domain,
                         java.lang.String applicationName)
                  throws AuthenticationException
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
Method Detail

getNextPage

public GenericFeed getNextPage(Link atomLink)
                        throws AppsForYourDomainException,
                               java.net.MalformedURLException,
                               java.io.IOException,
                               ServiceException
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
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

doesEntityExist

public boolean doesEntityExist(java.lang.String feedUrlSuffix)
                        throws AppsForYourDomainException,
                               java.net.MalformedURLException,
                               java.io.IOException,
                               ServiceException
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
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

isMember

public boolean isMember(java.lang.String groupId,
                        java.lang.String memberId)
                 throws AppsForYourDomainException,
                        java.net.MalformedURLException,
                        java.io.IOException,
                        ServiceException
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
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

isOwner

public boolean isOwner(java.lang.String groupId,
                       java.lang.String email)
                throws AppsForYourDomainException,
                       java.net.MalformedURLException,
                       java.io.IOException,
                       ServiceException
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
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

createGroup

public GenericEntry createGroup(java.lang.String groupId,
                                java.lang.String groupName,
                                java.lang.String groupDescription,
                                java.lang.String emailPermission)
                         throws AppsForYourDomainException,
                                java.net.MalformedURLException,
                                java.io.IOException,
                                ServiceException
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
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

updateGroup

public GenericEntry updateGroup(java.lang.String groupId,
                                java.lang.String groupName,
                                java.lang.String groupDescription,
                                java.lang.String emailPermission)
                         throws AppsForYourDomainException,
                                java.net.MalformedURLException,
                                java.io.IOException,
                                ServiceException
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
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

deleteGroup

public void deleteGroup(java.lang.String groupId)
                 throws AppsForYourDomainException,
                        java.net.MalformedURLException,
                        java.io.IOException,
                        ServiceException
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
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

retrieveGroup

public GenericEntry retrieveGroup(java.lang.String groupId)
                           throws AppsForYourDomainException,
                                  java.net.MalformedURLException,
                                  java.io.IOException,
                                  ServiceException
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
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

addMemberToGroup

public GenericEntry addMemberToGroup(java.lang.String groupId,
                                     java.lang.String memberName)
                              throws AppsForYourDomainException,
                                     java.net.MalformedURLException,
                                     java.io.IOException,
                                     ServiceException
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
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

deleteMemberFromGroup

public void deleteMemberFromGroup(java.lang.String groupId,
                                  java.lang.String memberName)
                           throws AppsForYourDomainException,
                                  java.net.MalformedURLException,
                                  java.io.IOException,
                                  ServiceException
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
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException

retrieveAllMembers

public GenericFeed retrieveAllMembers(java.lang.String groupId)
                               throws AppsForYourDomainException,
                                      java.net.MalformedURLException,
                                      java.io.IOException,
                                      ServiceException
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
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException

retrievePageOfMembers

public GenericFeed retrievePageOfMembers(Link next)
                                  throws AppsForYourDomainException,
                                         java.net.MalformedURLException,
                                         java.io.IOException,
                                         ServiceException
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
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException

addOwnerToGroup

public GenericEntry addOwnerToGroup(java.lang.String groupId,
                                    java.lang.String ownerName)
                             throws AppsForYourDomainException,
                                    java.net.MalformedURLException,
                                    java.io.IOException,
                                    ServiceException
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
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

retrieveAllGroups

public GenericFeed retrieveAllGroups()
                              throws AppsForYourDomainException,
                                     java.net.MalformedURLException,
                                     java.io.IOException,
                                     ServiceException
Retrieves all groups in a domain as a GenericFeed.

Throws:
AppsForYourDomainException - If a Provisioning API error occurs
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

retrievePageOfGroups

public GenericFeed retrievePageOfGroups(Link next)
                                 throws AppsForYourDomainException,
                                        java.net.MalformedURLException,
                                        java.io.IOException,
                                        ServiceException
Retrieves next page of groups in a domain as a GenericFeed.

Throws:
AppsForYourDomainException - If a Provisioning API error occurs
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

retrieveGroups

public GenericFeed retrieveGroups(java.lang.String memberName,
                                  boolean directOnly)
                           throws AppsForYourDomainException,
                                  java.net.MalformedURLException,
                                  java.io.IOException,
                                  ServiceException
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
java.net.MalformedURLException - If a URL related error occurs
java.io.IOException - If a network I/O related error occurs
ServiceException - If the API service fails

retreiveGroupOwners

public GenericFeed retreiveGroupOwners(java.lang.String groupId)
                                throws AppsForYourDomainException,
                                       java.net.MalformedURLException,
                                       java.io.IOException,
                                       ServiceException
Retrieves all the owners of a given Group.

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