@SuppressWarnings("unchecked") @Override public List<Person> searchForPersons(String keyword) { String filter = "(&(samAccountType=805306368)(|(sn=" + keyword + "*)(givenname=" + keyword + "*)(mail=" + keyword + "*)))"; logger.debug("filter:" + filter); List<Person> persons = (List<Person>) ldapTemplate.search("", filter, new PersonAttributesMapper()); persons.remove(null); if (logger.isTraceEnabled()) { for (Person p : persons) { if (p != null) { logger.trace("username: "******"; sap:" + p.getSap()); } } } return persons; }
@Override public String populateEpicDesc(String xmlData) { List<User> piUserLst = formService.getUsersByKeywordAndSearchField( "Principal Investigator", xmlData, UserSearchField.ROLE); List<User> emrStudyContactUserLst = formService.getUsersByKeywordAndSearchField( "EMR Study Contact", xmlData, UserSearchField.RESPONSIBILITY); String epicDescription = ""; if (piUserLst.size() > 0) { epicDescription += String.format("Principal Investigator: "); for (User user : piUserLst) { Person person = user.getPerson(); epicDescription += String.format( "Name: " + person.getFullname() + " Department: " + person.getDepartment() + " Email: " + person.getEmail() + " Phone: " + person.getWorkphone() + "%n"); } } if (emrStudyContactUserLst.size() > 0) { epicDescription += String.format(" EMR Study Contact: "); for (User user : emrStudyContactUserLst) { Person person = user.getPerson(); epicDescription += String.format( "Name: " + person.getFullname() + " Department: " + person.getDepartment() + " Email: " + person.getEmail() + " Phone: " + person.getWorkphone() + "%n"); } } return epicDescription; }
public Object mapFromAttributes(Attributes attrs) throws NamingException { String sap = getAttribute("employeenumber", attrs); Person p = new Person(); p.setSap(sap); p.setFirstname(getAttribute("givenname", attrs)); p.setLastname(getAttribute("sn", attrs)); p.setMiddlename(getAttribute("initials", attrs)); p.setEmail(getAttribute("mail", attrs)); p.setWorkphone(getAttribute("telephonenumber", attrs)); p.setDepartment(getAttribute("department", attrs)); p.setJobTitle(getAttribute("title", attrs)); p.setStreetAddress(getAttribute("streetAddress", attrs)); p.setState(getAttribute("st", attrs)); p.setZipCode(getAttribute("postalCode", attrs)); return p; }
public Object mapFromAttributes(Attributes attrs) throws NamingException { Person p = null; if (getAttribute("samaccountname", attrs) != null) { try { p = personDao.getPersonByUsername(getAttribute("samaccountname", attrs)); } catch (Exception ex) { } } String username = getAttribute("samaccountname", attrs); String sap = getAttribute("employeenumber", attrs); if (username == null || username .trim() .isEmpty()) { // || sap == null || sap.trim().isEmpty()){ // @NOTE: a lot of students // don't have sap either, might have to check ldap for this... return null; // no point to return this... } if (p == null) { p = new Person(); p.setUsername(username); p.setSap(sap); p.setFirstname(getAttribute("givenname", attrs)); p.setLastname(getAttribute("sn", attrs)); p.setMiddlename(getAttribute("initials", attrs)); p.setEmail(getAttribute("mail", attrs)); p.setWorkphone(getAttribute("telephonenumber", attrs)); p.setDepartment(getAttribute("department", attrs)); p.setJobTitle(getAttribute("title", attrs)); p.setStreetAddress(getAttribute("streetAddress", attrs)); p.setState(getAttribute("st", attrs)); p.setZipCode(getAttribute("postalCode", attrs)); } return p; }