📄 staffmodule.java
字号:
/* CRMS, customer relationship management system Copyright (C) 2003 Service To Youth Council This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information contact the SYC ICT department on GPL@syc.net.au 98 Kermode Street North Adelaide South Australia SA 5006 +61 (0)8 8367 0755 *//* * StaffModule.java * * Created on 29 April 2003, 09:36 */package crms.module;import crms.dao.*;import org.apache.log4j.*;import crms.util.*;import crms.vo.*;import java.util.*;/** * * @author dmurphy */public class StaffModule { Logger logger = Logger.getLogger(StaffModule.class); // Command keys for this module public static String PREFIX = "staff."; public static String STAFF_SHOW_ALL = "staff.showall"; public static String STAFF_MEMBER_GET = "staff.get"; public static String STAFF_SEARCH_FORM = "staff.search.form"; public static String STAFF_SEARCH_SUBMIT = "staff.search.submit"; public static String STAFF_AUTO_LIST = "staff.auto.list"; public static String STAFF_LIST_COMPANY = "staff.list.company"; // Attributes for the command public static String PARAM_STAFF_FIRSTNAME = "firstname"; public static String PARAM_STAFF_UID = "uid"; public static String PARAM_STAFF_LASTNAME = "lastname"; public static String PARAM_STAFF_LOCATION = "location"; public static String PARAM_STAFF_DEPARTMENT = "department"; public static String PARAM_STAFF_COMPANY = "company"; private LDAPDAO ldapDAO = LDAPDAOFactory.getInstance().getLDAPDAO(); private PermissionDAO permissionDAO = DAOFactory.getInstance().getPermissionDAO(); /** Creates a new instance of CallModule */ public StaffModule() { } public ServerResponse processCommand(ServerCommand command) throws Exception { ServerResponse sr = new ServerResponse(); String user = command.getUser(); if (command.getKey().toLowerCase().equals(STAFF_SEARCH_FORM)) { List depts = ldapDAO.getDepartments(); depts.add(0, Department.ALL_DEPARTMENTS); sr.addPart("departments", depts); List locations = ldapDAO.getLocations(); locations.add(0, Site.ALL_SITES); sr.addPart("locations", locations); } else if (command.getKey().toLowerCase().equals(STAFF_SEARCH_SUBMIT)) { StaffMember sm = new StaffMember(); sm.setUID((String)command.getParameterValue(PARAM_STAFF_UID)); sm.setDepartment((String)command.getParameterValue(PARAM_STAFF_DEPARTMENT)); sm.setFirstName((String)command.getParameterValue(PARAM_STAFF_FIRSTNAME)); sm.setLastName((String)command.getParameterValue(PARAM_STAFF_LASTNAME)); sm.setLocation((String)command.getParameterValue(PARAM_STAFF_LOCATION)); ArrayList staffList = (ArrayList) ldapDAO.searchStaff(sm); // If it is requested to not include this, don't /*if (includeall == null || includeall.equals("0") == false) { staffList.add(0, StaffMember.ALL_STAFF); }*/ sr.addPart("staff", staffList); } else if (command.getKey().toLowerCase().equals(STAFF_LIST_COMPANY)) { int companyID = ((Integer)command.getParameterValue(PARAM_STAFF_COMPANY)).intValue(); List staffIDList = permissionDAO.getStaffListForCompany(companyID); List staffList = new ArrayList(); Iterator i = staffIDList.iterator(); while (i.hasNext()) { String uid = (String)i.next(); StaffMember sm = ldapDAO.getUser(uid); staffList.add(sm); } sr.addPart("staff", staffList); } else if (command.getKey().toLowerCase().equals(STAFF_AUTO_LIST)) { logger.debug("Preparing an auto complete list from LDAP"); List UIDs = ldapDAO.listUIDs(); sr.addPart("uids", UIDs); // return an ArrayList of userid's to compare against } return sr; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -