001 /*
002 *
003 * $Revision: 13085 $ $Date: 2008-02-06 18:27:24 +0100 (Mi, 06 Feb 2008) $
004 *
005 * This file is part of *** M y C o R e ***
006 * See http://www.mycore.de/ for details.
007 *
008 * This program is free software; you can use it, redistribute it
009 * and / or modify it under the terms of the GNU General Public License
010 * (GPL) as published by the Free Software Foundation; either version 2
011 * of the License or (at your option) any later version.
012 *
013 * This program is distributed in the hope that it will be useful, but
014 * WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016 * GNU General Public License for more details.
017 *
018 * You should have received a copy of the GNU General Public License
019 * along with this program, in a file called gpl.txt or license.txt.
020 * If not, write to the Free Software Foundation Inc.,
021 * 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA
022 */
023
024 package org.mycore.user;
025
026 import java.util.List;
027
028 import org.mycore.common.MCRException;
029
030 /**
031 * The purpose of this interface is to make the choice of the persistence layer
032 * configurable. Any concrete database-class which stores MyCoRe user, group and
033 * privilege information must implement this interface. Which database actually
034 * will be used can then be configured by reading the value
035 * <code>MCR.Persistence.User.Store.Class</code> from mycore.properties.
036 *
037 * @author Detlev Degenhardt
038 * @version $Revision: 13085 $ $Date: 2008-02-06 18:27:24 +0100 (Mi, 06 Feb 2008) $
039 */
040 public interface MCRUserStore {
041 /**
042 * This method creates a MyCoRe user object in the persistent datastore.
043 *
044 * @param newUser
045 * the new user object to be stored
046 */
047 public void createUser(MCRUser newUser) throws MCRException;
048
049 /**
050 * This method creates a MyCoRe group object in the persistent datastore.
051 *
052 * @param newGroup
053 * the new group object to be stored
054 */
055 public void createGroup(MCRGroup newGroup) throws MCRException;
056
057 /**
058 * This method deletes a MyCoRe user object in the persistent datastore.
059 *
060 * @param delUserID
061 * a String representing the MyCoRe user object which is to be
062 * deleted
063 */
064 public void deleteUser(String delUserID) throws MCRException;
065
066 /**
067 * This method deletes a MyCoRe group object in the persistent datastore.
068 *
069 * @param delGroupID
070 * a String representing the MyCoRe group object which is to be
071 * deleted
072 */
073 public void deleteGroup(String delGroupID) throws MCRException;
074
075 /**
076 * This method tests if a MyCoRe user object is available in the persistent
077 * datastore.
078 *
079 * @param userID
080 * a String representing the MyCoRe user object which is to be
081 * looked for
082 */
083 public boolean existsUser(String userID) throws MCRException;
084
085 /**
086 * This method tests if a MyCoRe user object is available in the persistent
087 * datastore. The numerical userID is taken into account, too.
088 *
089 * @param numID
090 * (int) numerical userID of the MyCoRe user object
091 * @param userID
092 * a String representing the MyCoRe user object which is to be
093 * looked for
094 */
095 public boolean existsUser(int numID, String userID) throws MCRException;
096
097 /**
098 * This method tests if a MyCoRe group object is available in the persistent
099 * datastore.
100 *
101 * @param groupID
102 * a String representing the MyCoRe group object which is to be
103 * looked for
104 */
105 public boolean existsGroup(String groupID) throws MCRException;
106
107 /**
108 * This method gets all user IDs and returns them as a ArrayList of strings.
109 *
110 * @return ArrayList of strings including the user IDs of the system
111 */
112 public List<String> getAllUserIDs() throws MCRException;
113
114 /**
115 * This method gets all group IDs and returns them as a ArrayList of
116 * strings.
117 *
118 * @return ArrayList of strings including the group IDs of the system
119 */
120 public List<String> getAllGroupIDs() throws MCRException;
121
122 /**
123 * This method returns the maximum value of the numerical user IDs
124 *
125 * @return maximum value of the numerical user IDs
126 */
127 public int getMaxUserNumID() throws MCRException;
128
129 /**
130 * This method gets all group IDs where a given user ID can manage the group
131 * (i.e. is in the administrator user IDs list) as a ArrayList of strings.
132 *
133 * @param userID
134 * a String representing the administrative user
135 * @return ArrayList of strings including the group IDs of the system which
136 * have userID in their administrators list
137 */
138 public List<String> getGroupIDsWithAdminUser(String userID) throws MCRException;
139
140 /**
141 * This method gets all user IDs with a given primary group and returns them
142 * as a ArrayList of strings.
143 *
144 * @param groupID
145 * a String representing a primary Group
146 * @return ArrayList of strings including the user IDs of the system which
147 * have groupID as primary group
148 */
149 public List<String> getUserIDsWithPrimaryGroup(String groupID) throws MCRException;
150
151 /**
152 * This method retrieves a MyCoRe user object from the persistent datastore.
153 *
154 * @param userID
155 * a String representing the MyCoRe user object which is to be
156 * retrieved
157 * @return the requested user object
158 */
159 public MCRUser retrieveUser(String userID) throws MCRException;
160
161 /**
162 * This method retrieves a MyCoRe group object from the persistent
163 * datastore.
164 *
165 * @param groupID
166 * a String representing the MyCoRe group object which is to be
167 * retrieved
168 * @return the requested group object
169 */
170 public MCRGroup retrieveGroup(String groupID) throws MCRException;
171
172 /**
173 * This method updates a MyCoRe group object in the persistent datastore.
174 *
175 * @param group
176 * the group to be updated
177 */
178 public void updateGroup(MCRGroup group) throws MCRException;
179
180
181 /**
182 * This method updates a MyCoRe user object in the persistent datastore.
183 *
184 * @param user
185 * the user to be updated
186 */
187 public void updateUser(MCRUser user) throws MCRException;
188 }