org.mycore.backend.hibernate
Class MCRHIBUserStore

java.lang.Object
  extended by org.mycore.backend.hibernate.MCRHIBUserStore
All Implemented Interfaces:
MCRUserStore

public class MCRHIBUserStore
extends Object
implements MCRUserStore

This class implements the interface MCRUserStore - flushmode is configured to COMMIT !

Version:
$Revision: 14987 $ $Date: 2009-03-20 22:10:57 +0100 (Fri, 20 Mar 2009) $
Author:
Matthias Kramm, Heiko Helmbrecht

Field Summary
(package private) static Logger logger
           
 
Constructor Summary
MCRHIBUserStore()
          The constructor reads the names of the SQL tables which hold the user information data from mycore.properties.
 
Method Summary
 void createGroup(MCRGroup newGroup)
          This method creates a MyCoRe group object in the persistent datastore.
 void createUser(MCRUser newUser)
          This method creates a MyCoRe user object in the persistent datastore.
 void createUserTables()
           
 void deleteGroup(String delGroupID)
          This method deletes a MyCoRe group object in the persistent datastore.
 void deleteUser(String delUserID)
          This method deletes a MyCoRe user object from the persistent datastore.
 boolean existsGroup(String groupID)
          This method tests if a MyCoRe group object is available in the persistent datastore.
 boolean existsUser(int numID, String userID)
          This method tests if a MyCoRe user object is available in the persistent datastore.
 boolean existsUser(String userID)
          This method tests if a MyCoRe user object is available in the persistent datastore.
 List<String> getAllGroupIDs()
          This method gets all group IDs and returns them as a ArrayList of strings.
 List<String> getAllUserIDs()
          This method gets all user IDs and returns them as a ArrayList of strings.
 List<String> getGroupIDsWithAdminUser(String userID)
          This method gets all group IDs where a given user ID can manage the group (i.e.
 int getMaxUserNumID()
          This method returns the maximum value of the numerical user IDs
 List<String> getUserIDsWithPrimaryGroup(String groupID)
          This method gets all user IDs with a given primary group and returns them as a ArrayList of strings.
 MCRGroup retrieveGroup(String groupID)
          This method retrieves a MyCoRe group object from the persistent datastore.
 MCRUser retrieveUser(String userID)
          This method retrieves a MyCoRe user object from the persistent datastore.
 void updateGroup(MCRGroup group)
          This method updates a MyCoRe group object in the persistent datastore.
 void updateUser(MCRUser updUser)
          This method updates a MyCoRe user object in the persistent datastore.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static Logger logger
Constructor Detail

MCRHIBUserStore

public MCRHIBUserStore()
The constructor reads the names of the SQL tables which hold the user information data from mycore.properties.

Method Detail

createUser

public void createUser(MCRUser newUser)
                throws MCRException
This method creates a MyCoRe user object in the persistent datastore.

Specified by:
createUser in interface MCRUserStore
Parameters:
newUser - the new user object to be stored
Throws:
MCRException

deleteUser

public void deleteUser(String delUserID)
                throws MCRException
This method deletes a MyCoRe user object from the persistent datastore.

Specified by:
deleteUser in interface MCRUserStore
Parameters:
delUserID - a String representing the MyCoRe user object which is to be deleted
Throws:
MCRException

existsUser

public boolean existsUser(String userID)
                   throws MCRException
This method tests if a MyCoRe user object is available in the persistent datastore.

Specified by:
existsUser in interface MCRUserStore
Parameters:
userID - a String representing the MyCoRe user object which is to be looked for
Throws:
MCRException

existsUser

public boolean existsUser(int numID,
                          String userID)
                   throws MCRException
This method tests if a MyCoRe user object is available in the persistent datastore. The numerical userID is taken into account, too.

Specified by:
existsUser in interface MCRUserStore
Parameters:
numID - (int) numerical userID of the MyCoRe user object
userID - a String representing the MyCoRe user object which is to be looked for
Throws:
MCRException

retrieveUser

public MCRUser retrieveUser(String userID)
                     throws MCRException
This method retrieves a MyCoRe user object from the persistent datastore.

Specified by:
retrieveUser in interface MCRUserStore
Parameters:
userID - a String representing the MyCoRe user object which is to be retrieved
Returns:
the requested user object
Throws:
MCRException

updateUser

public void updateUser(MCRUser updUser)
                throws MCRException
This method updates a MyCoRe user object in the persistent datastore.

Specified by:
updateUser in interface MCRUserStore
Parameters:
updUser - the user to be updated
Throws:
MCRException

getAllUserIDs

public List<String> getAllUserIDs()
                           throws MCRException
This method gets all user IDs and returns them as a ArrayList of strings.

Specified by:
getAllUserIDs in interface MCRUserStore
Returns:
ArrayList of strings including the user IDs of the system
Throws:
MCRException

getMaxUserNumID

public int getMaxUserNumID()
                    throws MCRException
This method returns the maximum value of the numerical user IDs

Specified by:
getMaxUserNumID in interface MCRUserStore
Returns:
maximum value of the numerical user IDs
Throws:
MCRException

createGroup

public void createGroup(MCRGroup newGroup)
                 throws MCRException
This method creates a MyCoRe group object in the persistent datastore.

Specified by:
createGroup in interface MCRUserStore
Parameters:
newGroup - the new group object to be stored
Throws:
MCRException

existsGroup

public boolean existsGroup(String groupID)
                    throws MCRException
This method tests if a MyCoRe group object is available in the persistent datastore.

Specified by:
existsGroup in interface MCRUserStore
Parameters:
groupID - a String representing the MyCoRe group object which is to be looked for
Throws:
MCRException

deleteGroup

public void deleteGroup(String delGroupID)
                 throws MCRException
This method deletes a MyCoRe group object in the persistent datastore.

Specified by:
deleteGroup in interface MCRUserStore
Parameters:
delGroupID - a String representing the MyCoRe group object which is to be deleted
Throws:
MCRException

getAllGroupIDs

public List<String> getAllGroupIDs()
                            throws MCRException
This method gets all group IDs and returns them as a ArrayList of strings.

Specified by:
getAllGroupIDs in interface MCRUserStore
Returns:
ArrayList of strings including the group IDs of the system
Throws:
MCRException

getGroupIDsWithAdminUser

public List<String> getGroupIDsWithAdminUser(String userID)
                                      throws MCRException
This method gets all group IDs where a given user ID can manage the group (i.e. is in the administrator user IDs list) as a ArrayList of strings.

Specified by:
getGroupIDsWithAdminUser in interface MCRUserStore
Parameters:
userID - a String representing the administrative user
Returns:
ArrayList of strings including the group IDs of the system which have userID in their administrators list
Throws:
MCRException

getUserIDsWithPrimaryGroup

public List<String> getUserIDsWithPrimaryGroup(String groupID)
                                        throws MCRException
This method gets all user IDs with a given primary group and returns them as a ArrayList of strings.

Specified by:
getUserIDsWithPrimaryGroup in interface MCRUserStore
Parameters:
groupID - a String representing a primary Group
Returns:
ArrayList of strings including the user IDs of the system which have groupID as primary group
Throws:
MCRException

updateGroup

public void updateGroup(MCRGroup group)
                 throws MCRException
This method updates a MyCoRe group object in the persistent datastore.

Specified by:
updateGroup in interface MCRUserStore
Parameters:
group - the group to be updated
Throws:
MCRException

retrieveGroup

public MCRGroup retrieveGroup(String groupID)
                       throws MCRException
This method retrieves a MyCoRe group object from the persistent datastore.

Specified by:
retrieveGroup in interface MCRUserStore
Parameters:
groupID - a String representing the MyCoRe group object which is to be retrieved
Returns:
the requested group object
Throws:
MCRException

createUserTables

public void createUserTables()