|
Oracle Fusion Middleware Java API for Oracle WebLogic Portal 10g Release 3 (10.3.2) E14255-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.bea.netuix.servlets.manager.communities.CommunityContext
public final class CommunityContext
The CommunityContext object serves as a cache container and accessor for community and membership information for a HttpSession
. Each CommunityContext
object instance has exactly one community in scope, in the form of a CommunityDefinition
object. If the authenticated principal (logged-in user) for the HttpRequest
has a membership in the community, the CommunityContext
also contains the membership information in the form of a CommunityMembership
object. <p/> CommunityContext
s can be accessed for the "default" community (the one associated with the Desktop
currently being viewed, if any) but may also be retrieved for any CommunityDefinition
within the webapp. <p/> The caching scope used within a CommunityContext
is controlled by the underlying CommunityUserContext
object. There are cases where the cache can become stale; these are discussed along with remedies in the documentation for CommunityUserContext
. <p/>The overview of community functionality contains a description of the community framework.
CommunityUserContext
, CommunityInvitationContext
, CommunityRedirectionHelper
, CommunityInvitationHelper
, ICommunityManager
, ICommunityMemberManager
Method Summary | |
---|---|
void |
activateCommunity(Date expirationDate) Sets the state of the community associated with this CommunityContext to ACTIVE for the specified time. |
void |
activateMembership() Activates the CommunityMembership associated with this CommunityContext . |
void |
addMembershipCapability(MembershipCapability capability) Adds a capability to the CommunityMembership associated with this CommunityContext . |
void |
checkPermissions(javax.servlet.http.HttpServletResponse response, boolean updateAccess) Checks to see if the currently-logged-in (or not logged-in) individual is allowed to access the community in this CommunityContext , and if so, automatically updates the membership's last access date if appropriate. |
protected Object |
clone() Throws CloneNotSupportedException, as cloning of CommunityContext objects is not allowed. |
CommunityMembership |
createMembership() Creates a CommunityMembership for the authenticated principal in the current Request object for the community associated with this CommunityContext . |
CommunityMembership |
createMembership(Invitation invitation) Creates a CommunityMembership for the authenticated principal in the current Request object for the specified Invitation . |
void |
deactivateCommunity() Sets the state of the community associated with this CommunityContext to INACTIVE. |
void |
disableMembership() Disables the CommunityMembership associated with this CommunityContext . |
void |
disablePersonalPages() Disables members from adding personal pages to the community associated with this CommunityContext . |
void |
enablePersonalPages() Enables members to add personal pages to the community associated with this CommunityContext . |
boolean |
equals(Object o) |
CommunityDefinition |
getCommunity() Retrieves the CommunityDefinition for the community associated with this CommunityContext . |
static CommunityContext |
getCommunityContext(javax.servlet.http.HttpServletRequest request) A convenience method for returning the "default" CommunityContext object associated with the specified Request. |
static CommunityContext |
getCommunityContext(javax.servlet.http.HttpServletRequest request, CommunityDefinition community) Returns the CommunityContext object associated with the specified request and CommunityDefinition . |
static CommunityContext |
getCommunityContext(javax.servlet.http.HttpServletRequest request, CommunityDefinitionId communityId) Returns the CommunityContext object associated with the specified request and CommunityDefinitionId . |
static CommunityContext |
getCommunityContext(javax.servlet.http.HttpServletRequest request, CommunityMembership membership) Returns the CommunityContext object associated with the specified request and CommunityMembership for the currently authenticated principal. |
static CommunityContext |
getCommunityContext(javax.servlet.http.HttpServletRequest request, CommunityURI communityUri) Returns the CommunityContext object associated with the specified request and community. |
CommunityInvitationContext |
getCommunityInvitationContext() Returns the CommunityInvitationContext object for this community. |
CommunityMembershipCriteria |
getCommunityMembershipCriteria() Returns a CommunityMembershipCriteria object for the community represented by this CommunityContext. |
static GenericURL |
getCommunityURL(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, CommunityURI community) Returns a URL to the specified community, if the URL can be determined. |
CommunityUserContext |
getCommunityUserContext() Returns the CommunityUserContext object backing this CommunityContext . |
CommunityMembership |
getMembership() Retrieves the CommunityMembership object assicated with this CommunityContext object, if a membership exists. |
int |
hashCode() |
boolean |
isCommunityInAdminMode() |
boolean |
isMembershipActive() Determines if the member and membership records associated with the authenticated principal (logged-in user) and this CommunityContext object are active or disabled. |
void |
removeMembership() Destroys the CommunityMembership associated with this CommunityContext . |
void |
removeMembershipCapability(MembershipCapability capability) Removes a capability from the CommunityMembership associated with this CommunityContext . |
void |
setCommunityExpirationDate(Date expirationDate) Sets the expiration date for the community associated with this CommunityContext . |
String |
toString() |
CommunityDefinition |
updateCommunity(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.definition.CommunityDefinition, boolean) instead. |
CommunityDefinition |
updateCommunity(CommunityDefinition communityDefinition, boolean invokeCallbackClass) Updates the CommunityDefinition for the community associated with this CommunityContext . |
long |
updateLastAccessDate() Updates the last access date for the membership associated with this CommunityContext to the current time. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static CommunityContext getCommunityContext(javax.servlet.http.HttpServletRequest request)
CommunityContext
object associated with the specified Request. This is the CommunityContext
appropriate for the Desktop viewed by the Request. This method should be called every time a CommunityContext
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.request
- the HttpServletRequest
.CommunityContext
object associated with the request, or null
if the desktop associated with the request is not a community desktop.public static CommunityContext getCommunityContext(javax.servlet.http.HttpServletRequest request, CommunityURI communityUri)
CommunityContext
object associated with the specified request and community. This method should be called every time a CommunityContext
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.request
- the HttpServletRequest
.communityUri
- the URI for the community.CommunityContext
object, or null
if no community with the specified URI exists.public static CommunityContext getCommunityContext(javax.servlet.http.HttpServletRequest request, CommunityDefinition community)
CommunityContext
object associated with the specified request and 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 CommunityUserContext.getCommunities()
method. This method should be called every time a CommunityContext
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.request
- the HttpServletRequest
.community
- the community.CommunityContext
object.public static CommunityContext getCommunityContext(javax.servlet.http.HttpServletRequest request, CommunityDefinitionId communityId)
CommunityContext
object associated with the specified request and CommunityDefinitionId
. This method should be called every time a CommunityContext
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.request
- the HttpServletRequest
.communityId
- the community ID.CommunityContext
object.public static CommunityContext getCommunityContext(javax.servlet.http.HttpServletRequest request, CommunityMembership membership)
CommunityContext
object associated with the specified request and 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 CommunityUserContext.getCommunityMembership()
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. This method should be called every time a CommunityContext
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.request
- the HttpServletRequest
.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
.CommunityContext
object, or null
if no appropriate CommunityContext
exists.public static GenericURL getCommunityURL(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, CommunityURI community)
null
will be returned.request
- the request object.response
- the response object.community
- the community to get a URL to.null
will be returned.public CommunityUserContext getCommunityUserContext()
CommunityUserContext
object backing this CommunityContext
.CommunityUserContext
object backing this CommunityContext
.public void checkPermissions(javax.servlet.http.HttpServletResponse response, boolean updateAccess) throws CommunityAccessRedirectionException
CommunityContext
, and if so, automatically updates the membership's last access date if appropriate. This method is automatically called by the framework for the "default" community (associated with the currently-viewed desktop) and does not need to be called in this case. When accessing community information outside of a community desktop (or accesssing information for a different community) this method should be called by the application to determine if the user has rights to access the community information. <p/> This method throws a CommunityAccessRedirectionException
if the authenticated principal (or lack thereof) is not allowed to view the community associated with this CommunityContext
. The exception contains information on what access violation occured and where the user can be redirected to to see the community error page or the community registration page. For portlets using community information outside of the community desktop, this information can be used to display "access denied" type error messages or offer a link to the community registration page without actually affecting a redirect. <p/> Note that this method may not throw an exception even if the member or membership is disabled, if the community is public. Therefore, the isMembershipActive()
method can be used to ensure the membership and member records are not disabled. <p/> If the user has permission to view the community, and the community has access tracking enabled, the membership's last access date is updated if it is the first attempt at access for this community in this HttpSession and the updateAccess argument is true. In some cases, access rights may need to be ascertained without the application qualifying it as a full "access" to the community; this parameter allows control over this feature. Note that the updateLastAccessDate()
method may be used to force updating at any time. <p/> The logic implemented by this method is:
response
- the response object.updateAccess
- indicates whether or not the last access date for the membership should be updated to reflect this access. See method description for a full discussion of this.CommunityAccessRedirectionException
- if the authenticated principal (or lack thereof) is not allowed to view the currently viewed community. The exception contains information on what access violation occured and where the user can be redirected to to see an explanitory error page or the community registration page.isMembershipActive()
public boolean isMembershipActive()
CommunityContext
object are active or disabled. Note that it is possible to have an active membership and member record but to also have the community disabled; for this reason this method is not equivalent to the checkPermissions() method.true
if both the CommunityMember
and CommunityMembership
associated with this CommunityContext
are active; false
if the member or membership record does not exist or are disabled.checkPermissions(javax.servlet.http.HttpServletResponse, boolean)
public CommunityInvitationContext getCommunityInvitationContext()
public CommunityDefinition getCommunity()
CommunityDefinition
for the community associated with this CommunityContext
. This method returns a new clone of the CommunityDefinition
.CommunityDefinition
object for the community associated with this CommunityContext
public CommunityMembership getMembership()
CommunityMembership
object assicated with this CommunityContext
object, if a membership exists.CommunityMembership
object for the currently-logged-in user for the community associated with this CommunityContext
object, or null if no such membership exists.public boolean isCommunityInAdminMode()
@Deprecated
public CommunityDefinition updateCommunity(CommunityDefinition communityDefinition)
throws ObjectNotFoundException,
NotEntitledException,
IllegalOperationException,
ObjectInUseException,
RemoteException
updateCommunity(com.bea.netuix.application.definition.CommunityDefinition, boolean)
instead.CommunityDefinition
for the community associated with this CommunityContext
.communityDefinition
- community definition with updated attributesCommunityDefinition
ObjectNotFoundException
- if community to be updated does not existNotEntitledException
- if current user does not have permission to update this communityIllegalOperationException
- 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 templateObjectInUseException
- if the update tries to point the community to a desktop that is already in use by another communityRemoteException
public CommunityDefinition updateCommunity(CommunityDefinition communityDefinition, boolean invokeCallbackClass) throws ObjectNotFoundException, NotEntitledException, IllegalOperationException, ObjectInUseException, RemoteException, CommunityCallbackException
CommunityDefinition
for the community associated with this CommunityContext
.communityDefinition
- community definition with updated attributesinvokeCallbackClass
- 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.CommunityDefinition
ObjectNotFoundException
- if community to be updated does not existNotEntitledException
- if current user does not have permission to update this communityIllegalOperationException
- 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 templateObjectInUseException
- if the update tries to point the community to a desktop that is already in use by another communityCommunityCallbackException
- if a callback class registered with the community is invoked and throws an exceptionRemoteException
public void activateCommunity(Date expirationDate) throws ObjectNotFoundException, NotEntitledException, IllegalOperationException, IllegalArgumentException, CommunityCallbackException, RemoteException
CommunityContext
to ACTIVE for the specified time. A community in the ACTIVE state can accept new members, supports updates and addition of new content.expirationDate
- The new expiration date for the community, or null if the community should not expire.ObjectNotFoundException
- if community to be activated does not existNotEntitledException
- if current user does not have permission to activate this communityIllegalOperationException
- if this community is a templateIllegalArgumentException
- if the supplied expirationDate is in the pastCommunityCallbackException
- if an error occurs when making a community callbackRemoteException
public void deactivateCommunity() throws IllegalArgumentException, ObjectNotFoundException, NotEntitledException, CommunityCallbackException, RemoteException
CommunityContext
to INACTIVE. A community in the INACTIVE state does not support any interaction excepting that with certain priviledged users.ObjectNotFoundException
- if community to be deactivated does not existNotEntitledException
- if current user does not have permission to deactivate this communityCommunityCallbackException
- if an error occurs when making a community callbackRemoteException
IllegalArgumentException
public void setCommunityExpirationDate(Date expirationDate) throws IllegalArgumentException, ObjectNotFoundException, NotEntitledException, IllegalOperationException, RemoteException
CommunityContext
. The community is put into the INACTIVE state once this date has passed. Setting a new expiration date on a community resets the original expiration date and the community stays active until the new expiration date.expirationDate
- The new expiration date.IllegalArgumentException
- If the expirationDate
is before current dateObjectNotFoundException
- if specified community does not existNotEntitledException
- if current user does not have permission to set the expirationDate for this communityIllegalOperationException
- if this community is a templateRemoteException
public void enablePersonalPages() throws ObjectNotFoundException, NotEntitledException, RemoteException
CommunityContext
.ObjectNotFoundException
- if specified community does not existNotEntitledException
- if current user does not have permission to perform this operationRemoteException
public void disablePersonalPages() throws ObjectNotFoundException, NotEntitledException, RemoteException
CommunityContext
.ObjectNotFoundException
- if specified community does not existNotEntitledException
- if current user does not have permission to perform this operationRemoteException
public CommunityMembership createMembership() throws RemoteException, NotEntitledException, DuplicateObjectException
CommunityMembership
for the authenticated principal in the current Request object for the community associated with this CommunityContext
. 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. If a community member record does not exist, it is created with default values active=true
and external=false
. If no user is logged in, a NotEntitledException
is thrown.CommunityMembership
object containing membership information.RemoteException
NotEntitledException
- if there is no user logged in.DuplicateObjectException
- if a membership already exists for the specified member and community.public CommunityMembership createMembership(Invitation invitation) throws IllegalArgumentException, RemoteException, NotEntitledException, DuplicateObjectException
CommunityMembership
for the authenticated principal in the current Request object for the specified Invitation
. If a community member record does not exist for the currently authenticated user, one is created with default values active=true
and external=false
. If no user is logged in, a NotEntitledException
is thrown. Note that the invitation specified may be for a community other than the community associated with this CommunityContext; in that case a membership will be created in the correct community but will not be reflected in this CommunityContext.CommunityMembership
object containing membership information.IllegalArgumentException
- if the invitation does not have "sent" status or if the invitation is not for the currently logged-in user.RemoteException
NotEntitledException
- if there is no user logged in.DuplicateObjectException
- if a membership already exists for the specified member and community.public void removeMembership() throws RemoteException, ObjectNotFoundException
CommunityMembership
associated with this CommunityContext
.RemoteException
ObjectNotFoundException
- if there is no CommunityMembership
associated with this community.public void disableMembership() throws RemoteException, ObjectNotFoundException
CommunityMembership
associated with this CommunityContext
.RemoteException
ObjectNotFoundException
- if no membership exists for this CommunityContext
.public void activateMembership() throws RemoteException, ObjectNotFoundException
CommunityMembership
associated with this CommunityContext
.RemoteException
ObjectNotFoundException
- if there is no CommunityMembership
associated with this community.public long updateLastAccessDate() throws ObjectNotFoundException, RemoteException
CommunityContext
to the current time.ObjectNotFoundException
- if no membership is associated with this CommunityContext
object or if no user is currently logged in.RemoteException
public void addMembershipCapability(MembershipCapability capability) throws RemoteException, ObjectNotFoundException, IllegalArgumentException
CommunityMembership
associated with this CommunityContext
.capability
- the capability to add to the membershipRemoteException
ObjectNotFoundException
- if there is no CommunityMembership
associated with this CommunityContext
IllegalArgumentException
- if the capability specified is not valid.public void removeMembershipCapability(MembershipCapability capability) throws RemoteException, ObjectNotFoundException, IllegalArgumentException
CommunityMembership
associated with this CommunityContext
.capability
- the capability to remove from the membershipRemoteException
ObjectNotFoundException
- if there is no CommunityMembership
associated with this CommunityContext
IllegalArgumentException
- if the capability specified is not valid.public CommunityMembershipCriteria getCommunityMembershipCriteria()
CommunityMembershipCriteria
, CommunityUserContext.getCommunityMemberships(CommunityMembershipCriteria,int)
public String toString()
toString
in class Object
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
protected final Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
|
Oracle Fusion Middleware Java API for Oracle WebLogic Portal 10g Release 3 (10.3.2) E14255-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2010, Oracle. All rights reserved.