com.opensymphony.user.provider.ofbiz
Class OFBizAccessProvider

java.lang.Object
  extended bycom.opensymphony.user.provider.ofbiz.OFBizAbstractProvider
      extended bycom.opensymphony.user.provider.ofbiz.OFBizAccessProvider
All Implemented Interfaces:
AccessProvider, java.io.Serializable, UserProvider

public class OFBizAccessProvider
extends OFBizAbstractProvider
implements AccessProvider

The access provider which stores groups and memberships in the OFBiz Entity Engine. Takes same properties as OFBizAbstractProvider with four additions: groupEntity - the name of the OFBiz group entity (default: "OSGroup") groupSequence - the name of the sequence used to generate group IDs (default: "OSGroup") membershipEntity - the name of the OFBiz membership entity (default: "OSMembership") membershipSequence - the name of the sequence used to generate membership IDs (default: "OSMembership")

Author:
Victor Salaman, Mike Cannon-Brookes $Revision: 1.1.1.1 $
See Also:
Serialized Form

Field Summary
protected  java.lang.String groupEntity
           
protected  java.util.List groupsCache
           
protected  java.lang.String groupSequence
           
protected  java.util.Map groupUsersCache
           
protected  java.lang.String membershipEntity
           
protected  java.lang.String membershipSequence
           
protected  java.util.Map userGroupsCache
           
 
Fields inherited from class com.opensymphony.user.provider.ofbiz.OFBizAbstractProvider
delegator, exclusiveAccess, nameCache, userEntity
 
Constructor Summary
OFBizAccessProvider()
           
 
Method Summary
 boolean addToGroup(java.lang.String userName, java.lang.String groupName)
          Add user to group.
 boolean create(java.lang.String name)
          Create new Entity with given name.
 void flushCaches()
          Flush the providers caches - if it is caching.
 boolean handles(java.lang.String name)
          Determine whether this UserProvider implementation is responsible for handling this Entity.
 boolean inGroup(java.lang.String userName, java.lang.String groupName)
          Find out whether given user is member of given group.
 boolean init(java.util.Properties properties)
          Called by UserManager before any other method.
 java.util.List list()
          Returns List of names (Strings) of all Entities that can be accessed by this UserProvider If this UserProvider cannot retrieve a list of names, null is to be returned.
 java.util.List listGroupsContainingUser(java.lang.String userName)
          List all groups that contain a user.
 java.util.List listUsersInGroup(java.lang.String groupName)
          List all users that are contained within a group.
 boolean load(java.lang.String name, Entity.Accessor accessor)
          Load Entity.
 boolean remove(java.lang.String name)
          Remove Entity with given name.
 boolean removeFromGroup(java.lang.String userName, java.lang.String groupName)
          Remove user from group.
 
Methods inherited from class com.opensymphony.user.provider.ofbiz.OFBizAbstractProvider
clearAllCache, clearUserCache, findUser, getDelegator, store
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.opensymphony.user.provider.UserProvider
store
 

Field Detail

groupsCache

protected java.util.List groupsCache

groupUsersCache

protected java.util.Map groupUsersCache

userGroupsCache

protected java.util.Map userGroupsCache

groupEntity

protected java.lang.String groupEntity

groupSequence

protected java.lang.String groupSequence

membershipEntity

protected java.lang.String membershipEntity

membershipSequence

protected java.lang.String membershipSequence
Constructor Detail

OFBizAccessProvider

public OFBizAccessProvider()
Method Detail

addToGroup

public boolean addToGroup(java.lang.String userName,
                          java.lang.String groupName)
Description copied from interface: AccessProvider
Add user to group.

Specified by:
addToGroup in interface AccessProvider
Returns:
Whether user was successfully added to group.

create

public boolean create(java.lang.String name)
Description copied from interface: UserProvider
Create new Entity with given name.

Specified by:
create in interface UserProvider
Overrides:
create in class OFBizAbstractProvider

flushCaches

public void flushCaches()
Description copied from interface: UserProvider
Flush the providers caches - if it is caching. Providers may implement their own caching strategies. This method merely indicates to the provider that it should flush it's caches now.

Specified by:
flushCaches in interface UserProvider
Overrides:
flushCaches in class OFBizAbstractProvider

handles

public boolean handles(java.lang.String name)
Description copied from interface: UserProvider
Determine whether this UserProvider implementation is responsible for handling this Entity.

Specified by:
handles in interface UserProvider

inGroup

public boolean inGroup(java.lang.String userName,
                       java.lang.String groupName)
Description copied from interface: AccessProvider
Find out whether given user is member of given group.

Specified by:
inGroup in interface AccessProvider
Returns:
Whether user is member of group.

init

public boolean init(java.util.Properties properties)
Description copied from interface: UserProvider
Called by UserManager before any other method. Allows for UserProvider specific initialization.

Specified by:
init in interface UserProvider
Overrides:
init in class OFBizAbstractProvider

list

public java.util.List list()
Description copied from interface: UserProvider
Returns List of names (Strings) of all Entities that can be accessed by this UserProvider If this UserProvider cannot retrieve a list of names, null is to be returned. If there are no current Entities stored by this provider, an empty List is to be returned. The order of names returned can be determined by the UserProvider (it may or may not be relevant). This List should be immutable.

Specified by:
list in interface UserProvider
Overrides:
list in class OFBizAbstractProvider

listGroupsContainingUser

public java.util.List listGroupsContainingUser(java.lang.String userName)
Description copied from interface: AccessProvider
List all groups that contain a user.

Specified by:
listGroupsContainingUser in interface AccessProvider
Returns:
List containing Strings of groupnames. If no groups found, empty list should be returned. If feature not supported by UserProvider, null shall be returned. This List should be immutable.

listUsersInGroup

public java.util.List listUsersInGroup(java.lang.String groupName)
Description copied from interface: AccessProvider
List all users that are contained within a group.

Specified by:
listUsersInGroup in interface AccessProvider
Returns:
List containing Strings of usernames. If no users found, empty list should be returned. If feature not supported by UserProvider, null shall be returned. This List should be immutable.

load

public boolean load(java.lang.String name,
                    Entity.Accessor accessor)
Description copied from interface: UserProvider
Load Entity.

Specified by:
load in interface UserProvider
Overrides:
load in class OFBizAbstractProvider

remove

public boolean remove(java.lang.String name)
Description copied from interface: UserProvider
Remove Entity with given name.

Specified by:
remove in interface UserProvider
Overrides:
remove in class OFBizAbstractProvider

removeFromGroup

public boolean removeFromGroup(java.lang.String userName,
                               java.lang.String groupName)
Description copied from interface: AccessProvider
Remove user from group.

Specified by:
removeFromGroup in interface AccessProvider
Returns:
Whether user was successfully removed from group.

See www.opensymphony.com for more information.