com.bea.netuix.servlets.manager.communities
Class CommunityUserContext

java.lang.Object
  extended by com.bea.netuix.servlets.manager.communities.CommunityUserContext

public final class CommunityUserContext
extends Object

The CommunityUserContext serves as a cache container and accessor for community member information (community-specific user information shared across all communities) for a HttpSession and provides access to community API's out of scope of a specific CommunityContext object (methods not dealing with the currently authenticated principal and community creation). The CommunityUserContext may have at most one CommunityMember object in scope, if the authenticated principal for the supplied HttpServletRequest object has a CommunityMember record. If no user is logged in, or if the user does not have a CommunityMember record, no CommunityMember object is kept in scope.

The CommunityUserContext and CommunityContext objects can perform caching of CommunityMember and CommunityMembership objects associated with the authenticated principal (currently logged-in user). By default, if a HttpSession exists for the request, the caching is scoped at the session level. If no session exists for the request, the default caching scope is at the request level. The caching scope for the CommunityUserContext (and all associated CommunityContext objects) associated with a session or request can be explicitly set through a call to setCacheScope(). Caching can even be turned off completely, although this may result in a significant performance penalty.

As long as the CommunityUserContext and CommunityContext objects are used to create, update / modify, or remove CommunityMember and CommunityMembership objects, the cache will remain consistent and correct. There are a few circumstances which will render the cache incorrect:

If any of these circumstances apply and having a stale cache is unacceptable, the invalidateCache() method can be called to flush the cache when necessary or caching can be turned off completely. In addition, the CommunityMemberManager EJB may be used in place of the CommunityContext and CommunityUserContext objects to get around all caching.

For normal usage, the performance benefits gained by having this information cached far outweigh problems of a stale cache.

The overview of community functionality contains a description of the community framework.

See Also
CommunityContext, CommunityInvitationContext, CommunityRedirectionHelper, CommunityInvitationHelper, ICommunityManager, ICommunityMemberManager

Field Summary
static int CACHE_SCOPE_NO_CACHE
          Constant value for use with the setCacheScope() method indicating that caching should be not be performed at all.
static int CACHE_SCOPE_REQUEST
          Constant value for use with the setCacheScope() method indicating that caching should be scoped at the HttpRequest level.
static int CACHE_SCOPE_SESSION
          Constant value for use with the setCacheScope() method indicating that caching should be scoped at the HttpSession level.
 
Method Summary
 void activateMember()
          Activates the CommunityMember associated with this CommunityUserContext globally for all Communities.
 void activateMember(CommunityMemberId id)
          Activates the specified CommunityMember globally for all Communities.
 void activateMembership(CommunityMemberId mId, CommunityDefinitionId cId)
          Activates a CommunityMembership in the specified CommunityDefinition, making a disabled member able to use the community once again.
 void addMembershipCapability(CommunityMemberId mId, CommunityDefinitionId cId, MembershipCapability capability)
          Adds a capability to the CommunityMembership specified.
protected  Object clone()
          Throws CloneNotSupportedException, as cloning of CommunityUserContext objects is not allowed.
 CommunityDefinition createCommunity(CommunityDefinition communityDefinition)
          Creates a community from a streamed desktop or template as specified by the CommunityDesktop member of the input CommunityDefinition.
 CommunityDefinition createCommunityFromTemplate(CommunityDefinitionId communityId, LocalizationResource templateLocalizationResource, PortalPath portalPath, DesktopPath desktopPath, LocalizationResource desktopLocalizationResource)
          Creates a community from a community template.
 CommunityDefinition createCommunityTemplate(CommunityDefinition communityDefinition)
          Creates a community template from an existing streamed desktop or a template as specified by the CommunityDesktop member of the input CommunityDefinition.
 CommunityDefinition createCommunityTemplate(CommunityDefinitionId communityId, LocalizationResource templateLocalizationResource, PortalPath portalPath, DesktopPath desktopPath, boolean isGlobal)
          Creates a template from an existing community.
 CommunityMember createMember(boolean active, boolean external)
          Creates a new CommunityMember for the user associated with this CommunityUserContext.
 CommunityMember createMember(CommunityMember info)
          Creates a new CommunityMember based on the contents of the info parameter.
 CommunityMember createMember(String username, boolean active, boolean external)
          Creates a new CommunityMember for the specified user.
 CommunityMembership createMembership(CommunityMemberId mId, CommunityDefinitionId cId)
          Creates a CommunityMembership for the specified CommunityMember in the specified CommunityDefinition.
 CommunityMembership createMembership(CommunityMemberId mId, Invitation invitation)
          Creates a CommunityMembership for the specified CommunityMember from the specified Invitation.
 void deleteCommunity(CommunityDefinitionId communityId, boolean deleteResources)
          Deletes the specified community.
 void deleteCommunityWithCascade(CommunityDefinitionId communityId)
          Deletes a community and all related non-customized and customized resources.
 void disableMember()
          Disables the CommunityMember associated with this CommunityUserContext object globally for all Communities.
 void disableMember(CommunityMemberId id)
          Disables a CommunityMember globally for all Communities.
 void disableMembership(CommunityMemberId mId, CommunityDefinitionId cId)
          Disables a CommunityMembership.
 boolean equals(Object o)
           
 SortableFilterablePagedResult<String> getAllCommunityAssociates(MemberCriteria criteria, int pageSize)
          Retrieves a paginated collection of all WLS user IDs of individuals belonging to the same communities the specified user also belongs to.
 int getCacheScope()
          Returns the cache scope used for this CommunityUserContext and all associated CommunityContext objects.
 SortableFilterablePagedResult<CommunityDefinition> getCommunitiesPaged(CommunitySearchCriteria searchCriteria, int pageSize)
          Returns a paginated list of CommunityDefinitions hosted in the web application.
 CommunityDefinition getCommunity(CommunityDefinitionId communityId)
          Retrieves the CommunityDefinition for the specified community.
 CommunityDefinition getCommunity(CommunityURI uri)
          Retrieves the CommunityDefinition for the specified community.
 CommunityDefinition getCommunity(String portalPath, String desktopPath)
          Retrieves the CommunityDefinition for the specified community.
 CommunityContext getCommunityContext()
          Retrieves the "default" CommunityContext object if it is appropriate.
 CommunityContext getCommunityContext(CommunityDefinition community)
          Returns the CommunityContext object associated with the specified CommunityDefinition.
 CommunityContext getCommunityContext(CommunityDefinitionId communityId)
          Returns the CommunityContext object associated with the specified CommunityDefinitionId.
 CommunityContext getCommunityContext(CommunityMembership membership)
          Returns the CommunityContext object associated with the specified CommunityMembership for the currently authenticated principal.
 CommunityContext getCommunityContext(CommunityURI communityUri)
          Returns the CommunityContext object associated with the specified community.
 CommunityInvitationHelper getCommunityInvitationHelper()
          Retrieves the CommunityInvitationHelper object.
 SortableFilterablePagedResult<CommunityMembership> getCommunityMemberships(CommunityMembershipCriteria criteria, int pageSize)
          Returns a paginated set of all CommunityMembership objects for the specified community that meet the specified criteria.
static CommunityUserContext getCommunityUserContext(javax.servlet.http.HttpServletRequest request)
          A convenience method for returning the CommunityUserContext object associated with the specified Request.
 CommunityMember getMember()
          Retrieves the CommunityMember object populated with information for the community member currently logged in.
 CommunityMember getMember(CommunityMemberId id)
          Retrieves a CommunityMember object populated with information for the CommunityMember specified by member id.
 CommunityMember getMember(String userId)
          Retrieves a CommunityMember object populated with information for the CommunityMember specified by user id.
 SortableFilterablePagedResult<CommunityMembership> getMemberCommunityMemberships(MemberMembershipCriteria criteria, int pageSize)
          Returns a paginated set of all CommunityMembership objects for a specified user or the currently authenticated user that meet the specified criteria.
 MemberMembershipCriteria getMemberMembershipCriteria()
          Returns a MemberMembershipCriteria object for the currently authenticated user.
 CommunityMembership getMembership(CommunityMemberId mId, CommunityDefinitionId cId)
          Returns the CommmunityMembership information for a CommunityMember, if they have a membership in the specified community.
 CommunityMembership getMembership(String username, CommunityDefinitionId cId)
          Returns the CommmunityMembership information for a user, if they have a membership in the specified community.
 MessagingAddress getMessagingAddress(CommunityMemberId id, MessagingAddressType addrType, String name)
          Gets a MessagingAddress of a particular type and name for the specified CommunityMember.
 MessagingAddress getMessagingAddress(MessagingAddressType addrType, String name)
          Gets a MessagingAddress of a particular type and name for the CommunityMember associated with this CommunityUserContext.
 Collection<MessagingAddress> getMessagingAddresses(CommunityMemberId id, MessagingAddressType addrType)
          Gets all MessagingAddresses of a particular type for the specified CommunityMember.
 Collection<MessagingAddress> getMessagingAddresses(MessagingAddressType addrType)
          Gets all MessagingAddresses of a particular type for the CommunityMember associated with this CommunityUserContext.
 MessagingAddress getPrimaryMessagingAddress(CommunityMember member, MessagingAddressType addrType)
          Gets the primary MessagingAddress of a particular type for the CommunityMember associated with this CommunityUserContext.
 void invalidateCache()
          Invalidates the internal cache used by the CommunityUserContext object.
 void removeMember()
          Removes the CommunityMember associated with this CommunityUserContext globally for all Communities.
 void removeMember(CommunityMemberId id)
          Removes the specified CommunityMember globally for all Communities.
 void removeMembership(CommunityMemberId mId, CommunityDefinitionId cId)
          Deletes a CommunityMembership for a CommunityMember in a specified CommunityDefinition.
 void removeMembershipCapability(CommunityMemberId mId, CommunityDefinitionId cId, MembershipCapability capability)
          Removes a capability from the CommunityMembership specified.
 void setCacheScope(int newCacheScope)
          Sets the cache scope level for the CommunityUserContext.
 void setMessagingAddress(MessagingAddress m, String name)
          Sets the value of a MessagingAddress.
 void setPrimaryMessagingAddress(MessagingAddress m)
          Sets the value of a the primary MessagingAddress.
 String toString()
           
 CommunityDefinition updateCommunity(CommunityDefinitionId communityId, CommunityDefinition communityDefinition)
          Deprecated This method does not invoke CommunityCallback classes registered with the community if the community is activated or deactivated through this call. Use updateCommunity(com.bea.netuix.application.identifier.CommunityDefinitionId, com.bea.netuix.application.definition.CommunityDefinition, boolean) instead.
 CommunityDefinition updateCommunity(CommunityDefinitionId communityId, CommunityDefinition communityDefinition, boolean invokeCallbackClass)
          Updates the specified community's CommunityDefinition.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CACHE_SCOPE_SESSION

public static final int CACHE_SCOPE_SESSION
Constant value for use with the setCacheScope() method indicating that caching should be scoped at the HttpSession level.

See Also
Constants Summary

CACHE_SCOPE_REQUEST

public static final int CACHE_SCOPE_REQUEST
Constant value for use with the setCacheScope() method indicating that caching should be scoped at the HttpRequest level.

See Also
Constants Summary

CACHE_SCOPE_NO_CACHE

public static final int CACHE_SCOPE_NO_CACHE
Constant value for use with the setCacheScope() method indicating that caching should be not be performed at all.

See Also
Constants Summary
Method Detail

getCommunityUserContext

public static CommunityUserContext getCommunityUserContext(javax.servlet.http.HttpServletRequest request)
A convenience method for returning the CommunityUserContext object associated with the specified Request. The CommunityUserContext is always available, even if no user is logged in or the user does not have a CommunityMember object. This method should be called every time a CommunityUserContext is needed, and the returned value should never be cached or kept as a reference, since the context object maintains a reference to the request and will be invalid on subsequent requests. This method is optimized internally to only create a new context object once per request, so there is no performance benefit to maintaing references to the return value in any case.

Parameters
request - the HttpServletRequest.
Returns
the CommunityUserContext object associated with the request.

getCommunityContext

public CommunityContext getCommunityContext()
Retrieves the "default" CommunityContext object if it is appropriate. This is the CommunityContext appropriate for the Desktop viewed by the Request associated with this CommunityUserContext.

Returns
the "default" (desktop-associated) CommunityContext object associated with the request, or null if the desktop associated with the request is not a community desktop.

getCommunityContext

public CommunityContext getCommunityContext(CommunityURI communityUri)
Returns the CommunityContext object associated with the specified community.

Parameters
communityUri - the URI for the community.
Returns
the appropriate CommunityContext object, or null if no community with the specified URI exists.

getCommunityContext

public CommunityContext getCommunityContext(CommunityDefinition community)
Returns the CommunityContext object associated with the specified CommunityDefinition. This may be useful for obtaining a CommunityContext if the CommunityDefinition has already been retrieved through a call from a method returning only CommunityDefintion objects, such as the getCommunities() method.

Parameters
community - the community.
Returns
the appropriate CommunityContext object.

getCommunityContext

public CommunityContext getCommunityContext(CommunityDefinitionId communityId)
Returns the CommunityContext object associated with the specified CommunityDefinitionId.

Parameters
communityId - the community ID.
Returns
the appropriate CommunityContext object.

getCommunityContext

public CommunityContext getCommunityContext(CommunityMembership membership)
Returns the CommunityContext object associated with the specified CommunityMembership for the currently authenticated principal. This may be useful for obtaining a CommunityContext if the CommunityMembership has already been retrieved through a call from a method returning only CommunityMembership objects, such as the getAllMemberCommunityMemberships() method. CommunityContext objects can only be obtained for the currently authenticated principal (user) or, if no authenticated principal exists for the request, the anonymous user. Since the anonymous user cannot have a membership in a community, this method will only return a CommunityContext if the specified membership is for the currently authenticated principal in the request.

Parameters
membership - the membership to obtain the CommunityContext for. This membership must be for the authenticated principal in the request; if the membership is for any other user, this methos will return null.
Returns
the appropriate CommunityContext object, or null if no appropriate CommunityContext exists.

setCacheScope

public void setCacheScope(int newCacheScope)
Sets the cache scope level for the CommunityUserContext. If a session exists for the request associated with this CommunityUserContext, the cache scope level set by this call is stored in the session so that other requests on the session will have a CommunityUserContext with the same cache scope.

Specifying a cache scope of CACHE_SCOPE_SESSION will force creation of a session if one does not already exist for the request.

Specifying a cache scope of CACHE_SCOPE_NO_CACHE will force database hits for most operations and will therefore result in a very large performance penalty.

Parameters
newCacheScope - one of the CACHE_SCOPE_ constants indicating the cache scope to use for this CommunityUserContext.
Throws
IllegalArgumentException - if the specified cache scope is invalid.
See Also
invalidateCache()

invalidateCache

public void invalidateCache()
Invalidates the internal cache used by the CommunityUserContext object. The CommunityUserContext and CommunityContext objects perform caching of CommunityMember and CommunityMembership objects associated with the authenticated principal (currently logged-in user) in the scope of the HttpSession. As long as the CommunityUserContext and CommunityContext objects are used to create, update / modify, or remove CommunityMember and CommunityMembership objects, the cache will remain consistent and correct for the scope of the HttpSession. There are a few circumstances which will render the cache incorrect:
  • Concurrent direct use of the CommunityManager and CommunityMemberManager APIs to create, update or remove CommunityMember and CommunityMembership objects for the authenticated principal
  • Concurrent modification to CommunityMember and CommunityMembership ojects belonging to the authenticated principal for this session by any means in another HttpSession
If any of these circumstances apply, the invalidateCache() method should be called, or caching should be turned off.

For normal usage, the performance benefits gained by having this information cached far outweigh problems of a stale cache, but if the possibility of a stale cache is unacceptable, the invalidateCache() method may be used to force all cached values to be flushed and re-obtained as needed, or the CommunityManager and CommunityMemberManager EJBs may be used in place of the CommunityContext and CommunityUserContext objects.


getCacheScope

public int getCacheScope()
Returns the cache scope used for this CommunityUserContext and all associated CommunityContext objects.

Returns
one of the CACHE_SCOPE constants indicating the cache scope currently in use.

getCommunitiesPaged

public SortableFilterablePagedResult<CommunityDefinition> getCommunitiesPaged(CommunitySearchCriteria searchCriteria,
                                                                              int pageSize)
                                                                       throws RemoteException
Returns a paginated list of CommunityDefinitions hosted in the web application. The returned PagedResult is sortable on "DESCRIPTION", "TEMPLATE_ID" and "COMMUNITY_DEFINITION_ID". Additionally, the PagedResult is also sortable on "TITLE" if localize is set to true on the input SearchCriteria. The returned PagedResult is filterable on "TITLE" and "DESCRIPTION", using these filter methods:
  • FilterMethod.UNFILTERED
  • FilterMethod.BEGINS_WITH
  • FilterMethod.ENDS_WITH
  • FilterMethod.CONTAINS
  • FilterMethod.EQUALS

Parameters
searchCriteria - criteria to be used to narrow the communities returned by this search.
pageSize - the number of communities to return per page
Returns
a SortableFilterablePagedResult of CommunityDefinitions
Throws
RemoteException

createCommunity

public CommunityDefinition createCommunity(CommunityDefinition communityDefinition)
                                    throws IllegalArgumentException,
                                           ObjectNotFoundException,
                                           NotEntitledException,
                                           MissingDataException,
                                           DuplicateObjectException,
                                           UnsupportedOperationException,
                                           CommunityCallbackException,
                                           RemoteException
Creates a community from a streamed desktop or template as specified by the CommunityDesktop member of the input CommunityDefinition. If the template specifies a community an UnSupportedOperationException is thrown directing the user to use createCommunityFromTemplate. This is to avoid confusion between what specification to use for the new community - the one in the input CommunityDefinition or the one in the community that the template points to.

Parameters
communityDefinition - a CommunityDefinition object that holds all information about the community to be created except for the CommunityDefinitionId
Returns
newly created CommunityDefinition with CommunityDefinitionId populated
Throws
IllegalArgumentException - if input CommunityDefinition has incorrect information
ObjectNotFoundException - if desktop specified by input arguments does not exist
NotEntitledException - if current user does not have permission to create a new community
MissingDataException - if input CommunityDefinition or the desktop it points to is missing information
DuplicateObjectException - if desktop matching portal path and desktop path in CommunityDefinition already exists
UnsupportedOperationException - see method doc above
CommunityCallbackException - if an error occurs when making a community callback
RemoteException

createCommunityFromTemplate

public CommunityDefinition createCommunityFromTemplate(CommunityDefinitionId communityId,
                                                       LocalizationResource templateLocalizationResource,
                                                       PortalPath portalPath,
                                                       DesktopPath desktopPath,
                                                       LocalizationResource desktopLocalizationResource)
                                                throws ObjectNotFoundException,
                                                       IllegalArgumentException,
                                                       NotEntitledException,
                                                       MissingDataException,
                                                       DuplicateObjectException,
                                                       CommunityCallbackException,
                                                       RemoteException
Creates a community from a community template.

Parameters
communityId - CommunityDefinitionId of the community template
templateLocalizationResource - optional LocalizationResource for template. If null LocalizationResource from template community will be used
portalPath - portal path for the new desktop to be created
desktopPath - desktop path for the new desktop to be created * @param desktopLocalizationResource optional LocalizationResource to be associated with desktop
Returns
newly created CommunityDefinition
Throws
ObjectNotFoundException - if specified community template does not exist
IllegalArgumentException - if community specified is not a community template
NotEntitledException - if current user does not have permission to create a new community
MissingDataException - if input CommunityDefinition or the desktop it points to is missing information
DuplicateObjectException - if desktop matching input portal path and desktop path already exists
CommunityCallbackException - if an error occurs when making a community callback
RemoteException

createCommunityTemplate

public CommunityDefinition createCommunityTemplate(CommunityDefinition communityDefinition)
                                            throws ObjectNotFoundException,
                                                   NotEntitledException,
                                                   MissingDataException,
                                                   DuplicateObjectException,
                                                   UnsupportedOperationException,
                                                   CommunityCallbackException,
                                                   RemoteException
Creates a community template from an existing streamed desktop or a template as specified by the CommunityDesktop member of the input CommunityDefinition.

Parameters
communityDefinition - a CommunityDefinition object that holds all information about the community template to be created except for the CommunityDefinitionId
Returns
newly created CommunityDefition template with a populated CommunityDefinitionId
Throws
ObjectNotFoundException - if input desktop or template does not exist
NotEntitledException - if current user does not have permission to create a template
MissingDataException - if input CommunityDefinition or the desktop it points to is missing information
DuplicateObjectException - if desktop matching input portal path and desktop path already exists
CommunityCallbackException - if an error occurs when making a community callback
RemoteException
UnsupportedOperationException

createCommunityTemplate

public CommunityDefinition createCommunityTemplate(CommunityDefinitionId communityId,
                                                   LocalizationResource templateLocalizationResource,
                                                   PortalPath portalPath,
                                                   DesktopPath desktopPath,
                                                   boolean isGlobal)
                                            throws ObjectNotFoundException,
                                                   NotEntitledException,
                                                   MissingDataException,
                                                   DuplicateObjectException,
                                                   CommunityCallbackException,
                                                   RemoteException
Creates a template from an existing community.

Parameters
communityId - CommunityDefinitionId of the community to use to create a template
templateLocalizationResource - optional LocalizationResource for template. If null LocalizationResource from template community will be used
portalPath - portal path for the new desktop to be created
desktopPath - desktop path for the new desktop to be created
isGlobal - true if the template should be marked global
Returns
newly created CommunityDefinition with the isTemplate attribute set to true
Throws
ObjectNotFoundException - if a CommunityDefinition matching input CommunityDefinitionId does not exist
NotEntitledException - if current user does not have permission to create a community template
MissingDataException - if input CommunityDefinition or the desktop it points to is missing information
DuplicateObjectException - if desktop matching input portal path and desktop path already exists
CommunityCallbackException - if an error occurs when making a community callback
RemoteException

updateCommunity

@Deprecated
public CommunityDefinition updateCommunity(CommunityDefinitionId communityId,
                                                      CommunityDefinition communityDefinition)
                                    throws ObjectNotFoundException,
                                           NotEntitledException,
                                           IllegalOperationException,
                                           ObjectInUseException,
                                           RemoteException
Deprecated This method does not invoke CommunityCallback classes registered with the community if the community is activated or deactivated through this call. Use updateCommunity(com.bea.netuix.application.identifier.CommunityDefinitionId, com.bea.netuix.application.definition.CommunityDefinition, boolean) instead.

Updates the specified community's CommunityDefinition.

Parameters
communityId - CommunityDefinitionId of community to be updated
communityDefinition - community definition with updated attributes
Returns
updated CommunityDefinition
Throws
ObjectNotFoundException - if community to be updated does not exist
NotEntitledException - if current user does not have permission to update this community
IllegalOperationException - if part of or all of the update is illegal based on the current state of the community for e.g. if the update tries to set expirationDate on or activate a community that is marked as a template
ObjectInUseException - if the update tries to point the community to a desktop that is already in use by another community
RemoteException

updateCommunity

public CommunityDefinition updateCommunity(CommunityDefinitionId communityId,
                                           CommunityDefinition communityDefinition,
                                           boolean invokeCallbackClass)
                                    throws ObjectNotFoundException,
                                           NotEntitledException,
                                           IllegalOperationException,
                                           ObjectInUseException,
                                           RemoteException,
                                           CommunityCallbackException
Updates the specified community's CommunityDefinition.

Parameters
communityId - CommunityDefinitionId of community to be updated
communityDefinition - community definition with updated attributes
invokeCallbackClass - if true and the community is activated or deactivated by this call, invokes the appropriate methods on the CommunityCallback object associated with the community, if one exists. If false, no callback call is made.
Returns
updated CommunityDefinition
Throws
ObjectNotFoundException - if community to be updated does not exist
NotEntitledException - if current user does not have permission to update this community
IllegalOperationException - if part of or all of the update is illegal based on the current state of the community for e.g. if the update tries to set expirationDate on or activate a community that is marked as a template
ObjectInUseException - if the update tries to point the community to a desktop that is already in use by another community
RemoteException
CommunityCallbackException - if an error occurs while making a callback

getCommunity

public CommunityDefinition getCommunity(String portalPath,
                                        String desktopPath)
                                 throws RemoteException
Retrieves the CommunityDefinition for the specified community. Returns null if the specified community does not exist, or if the user is not entitled to see the community. The return for this method is not cached by the CommunityUserContext, although CommunityDefinition objects are cached at a lower level.

Parameters
portalPath - the portal path for the community.
desktopPath - the desktop path for the community.
Returns
the matching CommunityDefinition object for the community specified, or null if the community does not exist or if the user is not entitled to see the community.
Throws
RemoteException

getCommunity

public CommunityDefinition getCommunity(CommunityURI uri)
                                 throws RemoteException
Retrieves the CommunityDefinition for the specified community. Returns null if the specified community does not exist, or if the user is not entitled to see the community. The return for this method is not cached by the CommunityUserContext, although CommunityDefinition objects are cached at a lower level.

Parameters
uri - the URI for the community.
Returns
the matching CommunityDefinition object for the community specified, or null if the community does not exist or if the user is not entitled to see the community.
Throws
RemoteException

getCommunity

public CommunityDefinition getCommunity(CommunityDefinitionId communityId)
                                 throws RemoteException
Retrieves the CommunityDefinition for the specified community. Returns null if the specified community does not exist, or if the user is not entitled to see the community. The return for this method is not cached by the CommunityUserContext, although CommunityDefinition objects are cached at a lower level.

Parameters
communityId - the community ID for the community.
Returns
the matching CommunityDefinition object for the community specified, or null if the community does not exist or if the user is not entitled to see the community.
Throws
RemoteException

deleteCommunity

public void deleteCommunity(CommunityDefinitionId communityId,
                            boolean deleteResources)
                     throws ObjectNotFoundException,
                            NotEntitledException,
                            RemoteException,
                            IllegalOperationException,
                            CommunityCallbackException,
                            ObjectInUseException
Deletes the specified community.

Parameters
communityId - CommunityDefinitionId of the community to be deleted
deleteResources - if true deletes resources related to the community if the community is the only one using them, if false - deletes the community only. If this is set to true and there exist other users of underlying resources, this method only deletes the community
Throws
ObjectNotFoundException - if community to be deleted does not exist
NotEntitledException - if current user does not have permission to delete this community
IllegalOperationException - if this community is a template
CommunityCallbackException - if an error occurs when making a community callback
RemoteException
ObjectInUseException

deleteCommunityWithCascade

public void deleteCommunityWithCascade(CommunityDefinitionId communityId)
                                throws ObjectNotFoundException,
                                       NotEntitledException,
                                       IllegalOperationException,
                                       CommunityCallbackException,
                                       RemoteException
Deletes a community and all related non-customized and customized resources.

Parameters
communityId - CommunityDefinitionId of the community to be deleted
Throws
ObjectNotFoundException - if community to be deleted does not exist
NotEntitledException - if current user does not have permission to delete this community
IllegalOperationException - if this community is a template
CommunityCallbackException - if an error occurs when making a community callback
RemoteException

getMember

public CommunityMember getMember()
Retrieves the CommunityMember object populated with information for the community member currently logged in. If there is no WLS user currently logged in, or if the user is not a community member, null is returned. If caching is enabled for this CommunityUserContext, the return for this method is cached.

Returns
the CommunityMember object for the currently-logged-in WLS user, or null if the user is not a community member or if no user is logged in.

createMember

public CommunityMember createMember(boolean active,
                                    boolean external)
                             throws RemoteException,
                                    DuplicateObjectException,
                                    NotEntitledException
Creates a new CommunityMember for the user associated with this CommunityUserContext. If caching is enabled for this CommunityUserContext, the return for this method is cached.

Parameters
active - true if the CommunityMember should be created with active status.
external - the external flag for the new CommunityMember, which may be useful for tracking purposes in some situations but is not used in the framework.
Returns
the newly created CommunityMember object
Throws
DuplicateObjectException - if a CommunityMember already exists for the currently-logged-in user.
NotEntitledException - if no user is currently logged in.
RemoteException

createMember

public CommunityMember createMember(String username,
                                    boolean active,
                                    boolean external)
                             throws RemoteException,
                                    DuplicateObjectException,
                                    NotEntitledException
Creates a new CommunityMember for the specified user. If caching is enabled for this CommunityUserContext, the return for this method is cached.

Parameters
username - the WLS user name to create a member object for.
active - true if the CommunityMember should be created with active status.
external - the external flag for the new CommunityMember, which may be useful for tracking purposes in some situations but is not used in the framework.
Returns
the newly created CommunityMember object
Throws
DuplicateObjectException - if a CommunityMember already exists for the specified user.
NotEntitledException - if no user is currently logged in.
RemoteException

createMember

public CommunityMember createMember(CommunityMember info)
                             throws DuplicateObjectException,
                                    RemoteException,
                                    NotEntitledException
Creates a new CommunityMember based on the contents of the info parameter. This can be used to create a member record for a user other than the currently logged in user.

Parameters
info - a set of information on which to base the creation of the new CommunityMember
Returns
a CommunityMember object populated with values corresponding to the new CommunityMember
Throws
DuplicateObjectException - if a member record already exists for the WLS user specified in the CommunityMember object.
NotEntitledException - if no user is currently logged in.
RemoteException

getMember

public CommunityMember getMember(String userId)
                          throws RemoteException,
                                 NotEntitledException
Retrieves a CommunityMember object populated with information for the CommunityMember specified by user id. This is useful for retrieving a CommunityMember object for a user other than the one currently logged in.

Parameters
userId - the WLS user id of the CommunityMember to look up.
Returns
a CommunityMember object populated with information for the specified CommunityMember if they exist, otherwise null
Throws
NotEntitledException - If no user is currently logged in.
RemoteException

getMember

public CommunityMember getMember(CommunityMemberId id)
                          throws RemoteException,
                                 NotEntitledException
Retrieves a CommunityMember object populated with information for the CommunityMember specified by member id. This is useful for retrieving a CommunityMember object for a user other than the one currently logged in.

Parameters
id - the CommunityMemberId of the CommunityMember to look up.
Returns
a CommunityMember object populated with information for the specified CommunityMember if they exist, otherwise null
Throws
NotEntitledException - If no user is currently logged in.
RemoteException

disableMember

public void disableMember()
                   throws ObjectNotFoundException,
                          RemoteException
Disables the CommunityMember associated with this CommunityUserContext object globally for all Communities.

Throws
ObjectNotFoundException - if no member record exists for the currently-logged-in user or if no user is currently logged in.
RemoteException

disableMember

public void disableMember(CommunityMemberId id)
                   throws ObjectNotFoundException,
                          RemoteException,
                          NotEntitledException
Disables a CommunityMember globally for all Communities.

Parameters
id - the id of the CommunityMember to disable.
Throws
NotEntitledException - If no user is currently logged in.
ObjectNotFoundException - if the specified member does not exist in the database.
RemoteException

activateMember

public void activateMember()
                    throws ObjectNotFoundException,
                           RemoteException
Activates the CommunityMember associated with this CommunityUserContext globally for all Communities.

Throws
ObjectNotFoundException - if no member record exists for the currently-logged-in user or if no user is currently logged in.
RemoteException

activateMember

public void activateMember(CommunityMemberId id)
                    throws ObjectNotFoundException,
                           RemoteException,
                           NotEntitledException
Activates the specified CommunityMember globally for all Communities.

Parameters
id - the id of the CommunityMember to activate.
Throws
NotEntitledException - If no user is currently logged in.
ObjectNotFoundException - if the specified member does not exist in the database.
RemoteException

removeMember

public void removeMember()
                  throws ObjectNotFoundException,
                         RemoteException
Removes the CommunityMember associated with this CommunityUserContext globally for all Communities.

Throws
ObjectNotFoundException - if no member record exists for the currently-logged-in user or if no user is currently logged in.
RemoteException

removeMember

public void removeMember(CommunityMemberId id)
                  throws ObjectNotFoundException,
                         RemoteException,
                         NotEntitledException
Removes the specified CommunityMember globally for all Communities.

Parameters
id - the id of the CommunityMember to remove.
Throws
NotEntitledException - If no user is currently logged in.
ObjectNotFoundException - if the specified member does not exist in the database.
RemoteException

createMembership

public CommunityMembership createMembership(CommunityMemberId mId,
                                            CommunityDefinitionId cId)
                                     throws DuplicateObjectException,
                                            NotEntitledException,
                                            RemoteException
Creates a CommunityMembership for the specified CommunityMember in the specified CommunityDefinition. Invitations may contain information about community capabilities to grant to the new membership, so when an invitation exists, the other form of this method (which takes an Invitation object) should be used.

Parameters
mId - the id of the CommunityMember to create a membership for.
cId - the id of the CommunityDefinition
Returns
a CommunityMembership object containing the new membership information.
Throws
DuplicateObjectException - if a membership already exists for the specified member and community.
NotEntitledException - If no user is currently logged in.
RemoteException
See Also
CommunityContext if creating a membership for the currently logged-in user.

createMembership

public CommunityMembership createMembership(CommunityMemberId mId,
                                            Invitation invitation)
                                     throws IllegalArgumentException,
                                            DuplicateObjectException,
                                            NotEntitledException,
                                            RemoteException
Creates a CommunityMembership for the specified CommunityMember from the specified Invitation. Invitations may contain information about community capabilities to grant to the new membership, so when an invitation exists, it should be used.

Parameters
mId - the id of the CommunityMember to create a membership for.
invitation - the inviation to use when creating a membership.
Returns
a CommunityMembership object containing the new membership information.
Throws
IllegalArgumentException - if the invitation does not have "sent" status or if the invitation is not for the specified member.
DuplicateObjectException - if a membership already exists for the specified member and community.
NotEntitledException - If no user is currently logged in.
RemoteException
See Also
CommunityContext if creating a membership for the currently logged-in user.

removeMembership

public void removeMembership(CommunityMemberId mId,
                             CommunityDefinitionId cId)
                      throws NotEntitledException,
                             ObjectNotFoundException,
                             RemoteException
Deletes a CommunityMembership for a CommunityMember in a specified CommunityDefinition.

Parameters
mId - the id of the CommunityMember
cId - the id of the CommunityDefinition
Throws
RemoteException
NotEntitledException - If no user is currently logged in.
ObjectNotFoundException - if no membership for the specified community and member exists.
See Also
CommunityContext if deleting a membership for the currently logged-in user.

disableMembership

public void disableMembership(CommunityMemberId mId,
                              CommunityDefinitionId cId)
                       throws NotEntitledException,
                              ObjectNotFoundException,
                              RemoteException
Disables a CommunityMembership.

Parameters
mId - the id of the CommunityMember
cId - the id of the CommunityDefinition
Throws
RemoteException
NotEntitledException - If no user is currently logged in.
ObjectNotFoundException - if no membership for the specified community and member exists.
See Also
CommunityContext if disabling a membership for the currently logged-in user.

activateMembership

public void activateMembership(CommunityMemberId mId,
                               CommunityDefinitionId cId)
                        throws NotEntitledException,
                               RemoteException,
                               ObjectNotFoundException
Activates a CommunityMembership in the specified CommunityDefinition, making a disabled member able to use the community once again.

Parameters
mId - the id of the CommunityMember
cId - the id of the CommunityDefinition
Throws
RemoteException
NotEntitledException - If no user is currently logged in.
ObjectNotFoundException - if no membership for the specified community and member exists.
See Also
CommunityContext if activating a membership for the currently logged-in user.

getMembership

public CommunityMembership getMembership(CommunityMemberId mId,
                                         CommunityDefinitionId cId)
                                  throws NotEntitledException,
                                         RemoteException
Returns the CommmunityMembership information for a CommunityMember, if they have a membership in the specified community.

Parameters
mId - the id of the CommunityMember
cId - the id of the CommunityDefinition
Returns
a CommunityMembership object populated with membership information for the specified CommunityMember, if it exists, otherwise null.
Throws
RemoteException
NotEntitledException - If no user is currently logged in.
See Also
CommunityContext if getting the membership information for the currently logged-in user.

getMembership

public CommunityMembership getMembership(String username,
                                         CommunityDefinitionId cId)
                                  throws NotEntitledException,
                                         RemoteException
Returns the CommmunityMembership information for a user, if they have a membership in the specified community.

Parameters
username - the WLS username of the user
cId - the id of the CommunityDefinition
Returns
a CommunityMembership object populated with membership information for the specified user, if it exists, otherwise null.
Throws
RemoteException
NotEntitledException - If no user is currently logged in.
See Also
CommunityContext if getting the membership information for the currently logged-in user.

getMemberMembershipCriteria

public MemberMembershipCriteria getMemberMembershipCriteria()
                                                     throws NotEntitledException
Returns a MemberMembershipCriteria object for the currently authenticated user. This object can then be customized to specify which memberships should be included in search results from the getMemberCommunityMemberships() method.

Returns
a MemberMembershipCriteria object for the currently authenticated user.
Throws
NotEntitledException - if no user is logged in.
See Also
MemberMembershipCriteria, getMemberCommunityMemberships(MemberMembershipCriteria,int)

getMemberCommunityMemberships

public SortableFilterablePagedResult<CommunityMembership> getMemberCommunityMemberships(MemberMembershipCriteria criteria,
                                                                                        int pageSize)
                                                                                 throws RemoteException,
                                                                                        NotEntitledException
Returns a paginated set of all CommunityMembership objects for a specified user or the currently authenticated user that meet the specified criteria.

If the returned SortableFilterablePagedResult is re-filtered using the reFilter() method, the filter specified is used in addition to the original filter criteria specified in the MemberMembershipCriteria object. If the filter criteria specified in the reFilter() method conflicts with a criteria specified in the original MemberMembershipCriteria object, the newly specified filter criteria is used in place of the original MemberMembershipCriteria for that field only; all other field criteria specified in the MemberMembershipCriteria object will still be used as filter criteria. The returned PagedResult is sortable by "USERNAME", "MEMBER_IS_ACTIVE", "MEMBER_IS_EXTERNAL", "MEMBERSHIP_IS_ACTIVE", "LAST_ACCESS_DATE" and "JOIN_DATE". The returned PagedResult is filterable by "USERNAME", using these filter methods:

  • FilterMethod.UNFILTERED
  • FilterMethod.BEGINS_WITH
  • FilterMethod.ENDS_WITH
  • FilterMethod.CONTAINS
  • FilterMethod.EQUALS

Parameters
criteria - the criteria CommunityMemberships must match to be returned. If null, a MemberMembershipCriteria object is created specifying the currently authenticated user. Also see the getMemberMembershipCriteria() method to get a MemberMembershipCriteria object for the currently authenticated user.
pageSize - the number of membership objects to return per result page.
Returns
a paginated collection of all memberships for the specified user that meet the specified criteria. Note that this method may return memberships in communities which are in multiple different web applications unless web application name is specified in the search criteria.
Throws
RemoteException
NotEntitledException - if no user is logged in.
See Also
MemberMembershipCriteria

getCommunityMemberships

public SortableFilterablePagedResult<CommunityMembership> getCommunityMemberships(CommunityMembershipCriteria criteria,
                                                                                  int pageSize)
                                                                           throws RemoteException,
                                                                                  NotEntitledException
Returns a paginated set of all CommunityMembership objects for the specified community that meet the specified criteria.

If the returned SortableFilterablePagedResult is re-filtered using the reFilter() method, the filter specified is used in addition to the original filter criteria specified in the CommunityMembershipCriteria object. If the filter criteria specified in the reFilter() method conflicts with a criteria specified in the original CommunityMembershipCriteria object, the newly specified filter criteria is used in place of the original CommunityMembershipCriteria for that field only; all other field criteria specified in the CommunityMembershipCriteria object will still be used as filter criteria. The returned PagedResult is sortable by "USERNAME", "MEMBER_IS_ACTIVE", "MEMBER_IS_EXTERNAL", "MEMBERSHIP_IS_ACTIVE", "LAST_ACCESS_DATE" and "JOIN_DATE". The returned PagedResult is filterable by "USERNAME", using these filter methods:

  • FilterMethod.UNFILTERED
  • FilterMethod.BEGINS_WITH
  • FilterMethod.ENDS_WITH
  • FilterMethod.CONTAINS
  • FilterMethod.EQUALS

Parameters
criteria - the criteria CommunityMemberships must match to be returned.
pageSize - the number of membership objects to return per result page.
Returns
a paginated collection of all memberships for the specified community that meet the specified criteria.
Throws
RemoteException
NotEntitledException - if no user is logged in.
See Also
CommunityContext.getCommunityMembershipCriteria(), CommunityMembershipCriteria

getAllCommunityAssociates

public SortableFilterablePagedResult<String> getAllCommunityAssociates(MemberCriteria criteria,
                                                                       int pageSize)
                                                                throws RemoteException,
                                                                       NotEntitledException
Retrieves a paginated collection of all WLS user IDs of individuals belonging to the same communities the specified user also belongs to. The returned PagedResult can be sorted and filtered "USERNAME" using filter methods:
  • FilterMethod.BEGINS_WITH
  • FilterMethod.ENDS_WITH
  • FilterMethod.CONTAINS
  • FilterMethod.EQUALS

Parameters
criteria - the specification of the user to do the search for. If null, the currently authenticated user is used.
pageSize - the number of usernames to return per result page.
Returns
A collection of String WLS user IDs which is the merged community membership list for all communities the specified user belongs to. A WLS user ID will only be included once, even if the user has a membership in multiple communities to which the specified user also belongs.
Throws
RemoteException
NotEntitledException - if no user is logged in or the currently authenticated user has no member record (and cannot therefore be a member of any community).

addMembershipCapability

public void addMembershipCapability(CommunityMemberId mId,
                                    CommunityDefinitionId cId,
                                    MembershipCapability capability)
                             throws RemoteException,
                                    NotEntitledException,
                                    IllegalArgumentException,
                                    ObjectNotFoundException
Adds a capability to the CommunityMembership specified.

Parameters
mId - the id of the CommunityMember whose membership is to be modified.
cId - the id of the Community for the membership.
capability - the capability to add to the membership
Throws
RemoteException
NotEntitledException - if no user is logged in.
IllegalArgumentException - if the capability specified is not valid.
ObjectNotFoundException - if the specified community membership does not exist.

removeMembershipCapability

public void removeMembershipCapability(CommunityMemberId mId,
                                       CommunityDefinitionId cId,
                                       MembershipCapability capability)
                                throws RemoteException,
                                       NotEntitledException,
                                       IllegalArgumentException,
                                       ObjectNotFoundException
Removes a capability from the CommunityMembership specified.

Parameters
mId - the id of the CommunityMember whose membership is to be modified.
cId - the id of the Community for the membership.
capability - the capability to remove from the membership
Throws
RemoteException
NotEntitledException - if no user is logged in.
IllegalArgumentException - if the capability specified is not valid.
ObjectNotFoundException - if the specified community membership does not exist.

getMessagingAddress

public MessagingAddress getMessagingAddress(MessagingAddressType addrType,
                                            String name)
                                     throws RemoteException
Gets a MessagingAddress of a particular type and name for the CommunityMember associated with this CommunityUserContext.

Parameters
addrType - the type of MessagingAddress
name - the name of the MessagingAddress mapping to use
Returns
a MessagingAddress of the specified type if it exists, otherwise null. Null is also returned if there is no CommunityMember associated with this CommunityUserContext.
Throws
RemoteException

getMessagingAddress

public MessagingAddress getMessagingAddress(CommunityMemberId id,
                                            MessagingAddressType addrType,
                                            String name)
                                     throws NotEntitledException,
                                            RemoteException
Gets a MessagingAddress of a particular type and name for the specified CommunityMember.

Parameters
id - the id of the CommunityMember
addrType - the type of MessagingAddress
name - the name of the MessagingAddress mapping to use
Returns
a MessagingAddress of the specified type, if it exists, otherwise null. Null is also returned if the specified member does not exist.
Throws
NotEntitledException - if no user is logged in.
RemoteException

getPrimaryMessagingAddress

public MessagingAddress getPrimaryMessagingAddress(CommunityMember member,
                                                   MessagingAddressType addrType)
                                            throws RemoteException
Gets the primary MessagingAddress of a particular type for the CommunityMember associated with this CommunityUserContext.

Parameters
addrType - the type of MessagingAddress
Returns
a MessagingAddress of the specified type if it exists, otherwise null. Null is also returned if there is no CommunityMember associated with this CommunityUserContext.
Throws
RemoteException

getMessagingAddresses

public Collection<MessagingAddress> getMessagingAddresses(MessagingAddressType addrType)
                                                   throws RemoteException
Gets all MessagingAddresses of a particular type for the CommunityMember associated with this CommunityUserContext.

Parameters
addrType - the type of MessagingAddress. If this parameter is less than zero, MessagingAddresses of all types will be returned.
Returns
a Collection of MessagingAddress objects of the specified type for the user associated with this CommunityUserContext, if they exist, otherwise an empty Collection. An empty collection is also returned if there is no CommunityMember associated with this CommunityUserContext
Throws
RemoteException

getMessagingAddresses

public Collection<MessagingAddress> getMessagingAddresses(CommunityMemberId id,
                                                          MessagingAddressType addrType)
                                                   throws NotEntitledException,
                                                          RemoteException
Gets all MessagingAddresses of a particular type for the specified CommunityMember.

Parameters
id - the id of the CommunityMember
addrType - the type of MessagingAddress. If this parameter is less than zero, MessagingAddresses of all types will be returned.
Returns
a Collection of MessagingAddress objects of the specified type for the specified CommunityMember, if they exist, otherwise an empty Collection.
Throws
NotEntitledException - if no user is logged in.
RemoteException

setMessagingAddress

public void setMessagingAddress(MessagingAddress m,
                                String name)
                         throws PropertyValidationException,
                                NotEntitledException,
                                RemoteException
Sets the value of a MessagingAddress.

Parameters
m - a MessagingAddress populated with update values.
name - the MessagingAddress mapping used to specify the MessagingAddress to update.
Throws
PropertyValidationException - if the format of the MessagingAddress is not allowed by the mapped User Profile property.
NotEntitledException - if no user is logged in.
RemoteException

setPrimaryMessagingAddress

public void setPrimaryMessagingAddress(MessagingAddress m)
                                throws PropertyValidationException,
                                       NotEntitledException,
                                       RemoteException
Sets the value of a the primary MessagingAddress.

Parameters
m - a MessagingAddress populated with update values.
Throws
PropertyValidationException - if the format of the MessagingAddress is not allowed by the mapped primary User Profile property.
NotEntitledException - if no user is logged in.
RemoteException

getCommunityInvitationHelper

public CommunityInvitationHelper getCommunityInvitationHelper()
Retrieves the CommunityInvitationHelper object.

Returns
the CommunityInvitationHelper object.

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

clone

protected final Object clone()
                      throws CloneNotSupportedException
Throws CloneNotSupportedException, as cloning of CommunityUserContext objects is not allowed.

Overrides:
clone in class Object
Throws
CloneNotSupportedException


Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.