KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ofbiz > shark > user > PartyUserGroupMgr


1 /*
2  * $Id: PartyUserGroupMgr.java 5462 2005-08-05 18:35:48Z jonesde $
3  *
4  * Copyright (c) 2001-2005 The Open For Business Project - www.ofbiz.org
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
21  * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
22  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  */

25 package org.ofbiz.shark.user;
26
27 import java.util.List JavaDoc;
28 import java.util.ArrayList JavaDoc;
29 import java.util.Iterator JavaDoc;
30
31 import org.ofbiz.entity.GenericDelegator;
32 import org.ofbiz.entity.GenericEntityException;
33 import org.ofbiz.entity.GenericValue;
34 import org.ofbiz.shark.container.SharkContainer;
35 import org.ofbiz.base.util.UtilMisc;
36
37 import org.enhydra.shark.api.internal.usergroup.UserGroupManager;
38 import org.enhydra.shark.api.internal.working.CallbackUtilities;
39 import org.enhydra.shark.api.RootException;
40 import org.enhydra.shark.api.UserTransaction;
41
42 /**
43  *
44  * @author <a HREF="mailto:jaz@ofbiz.org">Andy Zeneski</a>
45  * @version $Rev: 5462 $
46  * @since 3.3
47  */

48 public class PartyUserGroupMgr implements UserGroupManager {
49
50     public static final String JavaDoc module = PartyUserGroupMgr.class.getName();
51     protected CallbackUtilities callBack = null;
52     protected GenericDelegator delegator = null;
53
54     public void configure(CallbackUtilities cb) throws RootException {
55         this.delegator = SharkContainer.getDelegator();
56         this.callBack = cb;
57     }
58
59     public List JavaDoc getAllGroupnames(UserTransaction trans) throws RootException {
60         return null; // TODO: Implement Me!
61
}
62
63     public List JavaDoc getAllUsers(UserTransaction trans) throws RootException {
64         List JavaDoc userLogins = null;
65         List JavaDoc allUsers = null;
66         try {
67             userLogins = delegator.findAll("UserLogin", UtilMisc.toList("userLoginId"));
68         } catch (GenericEntityException e) {
69             throw new RootException(e);
70         }
71
72         if (userLogins != null) {
73             allUsers = new ArrayList JavaDoc();
74             Iterator JavaDoc i = userLogins.iterator();
75             while (i.hasNext()) {
76                 GenericValue userLogin = (GenericValue) i.next();
77                 allUsers.add(userLogin.getString("userLoginId"));
78             }
79         }
80         return allUsers;
81     }
82
83     public List JavaDoc getAllUsers(UserTransaction trans, String JavaDoc groupName) throws RootException {
84         // TODO: Implement Me!
85
return this.getAllUsers(trans);
86     }
87
88     public List JavaDoc getAllUsers(UserTransaction trans, List JavaDoc groupNames) throws RootException {
89         // TODO: Implement Me!
90
return null; // TODO: Implement Me!
91
}
92
93     public List JavaDoc getAllImmediateUsers(UserTransaction trans, String JavaDoc groupName) throws RootException {
94         // TODO: Implement Me!
95
return this.getAllUsers(trans);
96     }
97
98     public List JavaDoc getAllSubgroups(UserTransaction trans, String JavaDoc groupName) throws RootException {
99         // TODO: Implement Me!
100
return null;
101     }
102
103     public List JavaDoc getAllSubgroups(UserTransaction trans, List JavaDoc groupNames) throws RootException {
104         // TODO: Implement Me!
105
return null;
106     }
107
108     public List JavaDoc getAllImmediateSubgroups(UserTransaction trans, String JavaDoc groupName) throws RootException {
109         // TODO: Implement Me!
110
return null;
111     }
112
113     public void createGroup(UserTransaction trans, String JavaDoc s, String JavaDoc s1) throws RootException {
114         throw new RootException("PartyUserGroupMgr does not implement create/update/remove methods. Use the party manager instead!");
115     }
116
117     public void removeGroup(UserTransaction trans, String JavaDoc groupName) throws RootException {
118         throw new RootException("PartyUserGroupMgr does not implement create/update/remove methods. Use the party manager instead!");
119     }
120
121     public boolean doesGroupExist(UserTransaction trans, String JavaDoc groupName) throws RootException {
122         return false; // TODO: Implement Me!
123
}
124
125     public boolean doesGroupBelongToGroup(UserTransaction trans, String JavaDoc groupName, String JavaDoc subGroupName) throws RootException {
126         return false; // TODO: Implement Me!
127
}
128
129     public void updateGroup(UserTransaction trans, String JavaDoc s, String JavaDoc s1) throws RootException {
130         throw new RootException("PartyUserGroupMgr does not implement create/update/remove methods. Use the party manager instead!");
131     }
132
133     public void addGroupToGroup(UserTransaction trans, String JavaDoc s, String JavaDoc s1) throws RootException {
134         throw new RootException("PartyUserGroupMgr does not implement create/update/remove methods. Use the party manager instead!");
135     }
136
137     public void removeGroupFromGroup(UserTransaction trans, String JavaDoc s, String JavaDoc s1) throws RootException {
138         throw new RootException("PartyUserGroupMgr does not implement create/update/remove methods. Use the party manager instead!");
139     }
140
141     public void removeGroupTree(UserTransaction trans, String JavaDoc s) throws RootException {
142         throw new RootException("PartyUserGroupMgr does not implement create/update/remove methods. Use the party manager instead!");
143     }
144
145     public void removeUsersFromGroupTree(UserTransaction trans, String JavaDoc s) throws RootException {
146         throw new RootException("PartyUserGroupMgr does not implement create/update/remove methods. Use the party manager instead!");
147     }
148
149     public void moveGroup(UserTransaction trans, String JavaDoc s, String JavaDoc s1, String JavaDoc s2) throws RootException {
150         throw new RootException("PartyUserGroupMgr does not implement create/update/remove methods. Use the party manager instead!");
151     }
152
153     public String JavaDoc getGroupDescription(UserTransaction trans, String JavaDoc s) throws RootException {
154         throw new RootException("PartyUserGroupMgr does not implement create/update/remove methods. Use the party manager instead!");
155     }
156
157     public void addUserToGroup(UserTransaction trans, String JavaDoc s, String JavaDoc s1) throws RootException {
158         throw new RootException("PartyUserGroupMgr does not implement create/update/remove methods. Use the party manager instead!");
159     }
160
161     public void removeUserFromGroup(UserTransaction trans, String JavaDoc s, String JavaDoc s1) throws RootException {
162         throw new RootException("PartyUserGroupMgr does not implement create/update/remove methods. Use the party manager instead!");
163     }
164
165     public void moveUser(UserTransaction trans, String JavaDoc s, String JavaDoc s1, String JavaDoc s2) throws RootException {
166         throw new RootException("PartyUserGroupMgr does not implement create/update/remove methods. Use the party manager instead!");
167     }
168
169     public boolean doesUserBelongToGroup(UserTransaction trans, String JavaDoc groupName, String JavaDoc username) throws RootException {
170         return false; // TODO: Implement Me!
171
}
172
173     public void createUser(UserTransaction trans, String JavaDoc groupName, String JavaDoc username, String JavaDoc password, String JavaDoc firstname, String JavaDoc lastname, String JavaDoc email) throws RootException {
174         throw new RootException("PartyUserGroupMgr does not implement create/update/remove methods. Use the party manager instead!");
175     }
176
177     public void updateUser(UserTransaction trans, String JavaDoc username, String JavaDoc firstname, String JavaDoc lastname, String JavaDoc email) throws RootException {
178         throw new RootException("PartyUserGroupMgr does not implement create/update/remove methods. Use the party manager instead!");
179     }
180
181     public void removeUser(UserTransaction trans, String JavaDoc username) throws RootException {
182         throw new RootException("PartyUserGroupMgr does not implement create/update/remove methods. Use the party manager instead!");
183     }
184
185     public boolean doesUserExist(UserTransaction trans, String JavaDoc username) throws RootException {
186         GenericValue userLogin = this.getUserLogin(username);
187         return (userLogin != null);
188     }
189
190     public void setPassword(UserTransaction trans, String JavaDoc username, String JavaDoc password) throws RootException {
191         throw new RootException("PartyUserGroupMgr does not implement create/update/remove methods. Use the party manager instead!");
192     }
193
194     public String JavaDoc getUserRealName(UserTransaction trans, String JavaDoc username) throws RootException {
195         return username;
196     }
197
198     public String JavaDoc getUserFirstName(UserTransaction trans, String JavaDoc username) throws RootException {
199         return username;
200     }
201
202     public String JavaDoc getUserLastName(UserTransaction trans, String JavaDoc username) throws RootException {
203         return username;
204     }
205
206     public String JavaDoc getUserEMailAddress(UserTransaction trans, String JavaDoc username) throws RootException {
207         return username;
208     }
209
210     protected GenericValue getUserLogin(String JavaDoc username) throws RootException {
211         GenericValue userLogin = null;
212         try {
213             userLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", username));
214         } catch (GenericEntityException e) {
215             throw new RootException(e);
216         }
217         return userLogin;
218     }
219 }
220
Popular Tags