01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/mailtool/tags/sakai_2-4-1/mailtool/src/java/org/sakaiproject/tool/mailtool/UserSelector.java $
03: * $Id: UserSelector.java 27662 2007-03-22 19:44:57Z kimsooil@bu.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2006, 2007 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.tool.mailtool;
21:
22: import java.util.ArrayList;
23: import java.util.Iterator;
24: import java.util.List;
25:
26: import javax.faces.model.DataModel;
27:
28: /**
29: * UserSelector, an implementation of RecipientSelector(commented by kimsooil@bu.edu)
30: *
31: * @author sgithens
32: *
33: */
34: public class UserSelector implements RecipientSelector {
35: SelectByUserTable m_usertable = null;
36: List /* EmailGroup */m_initialgroups = null;
37:
38: public UserSelector() {
39:
40: }
41:
42: public void populate(List emailgroups) {
43: m_initialgroups = emailgroups;
44:
45: List /* EmailUser */users = new ArrayList();
46:
47: for (Iterator i = emailgroups.iterator(); i.hasNext();) {
48: EmailGroup group = (EmailGroup) i.next();
49: //users.addAll(group.getEmailusers());
50:
51: // do not add "section" and "group" emailusers
52: EmailRole role = (EmailRole) group.getEmailrole();
53: if (role.roletype.equals("role"))
54: users.addAll(group.getEmailusers());
55: }
56:
57: m_usertable = new SelectByUserTable(users);
58: }
59:
60: public List getSelectedUsers() {
61: return m_usertable.getSelectedUsers();
62: }
63:
64: public List getSelectedUsersByGroup() {
65: // TODO Auto-generated method stub
66: return null;
67: }
68:
69: /** Methods for JSP Fragment **/
70: public DataModel getDataModel() {
71: return m_usertable.getUserRows();
72: }
73:
74: }
|