List of usage examples for org.apache.commons.lang StringUtils lowerCase
public static String lowerCase(String str)
Converts a String to lower case as per String#toLowerCase() .
From source file:org.eclipse.skalli.core.search.LuceneIndex.java
private ScoreDoc getDocByUUID(IndexSearcher searcher, UUID uuid) throws IOException { Query query = null;/*ww w. j a v a 2 s . c o m*/ try { QueryParser parser = new QueryParser(LUCENE_VERSION, FIELD_UUID, analyzer); query = parser.parse(StringUtils.lowerCase(uuid.toString())); } catch (ParseException e) { LOG.error(MessageFormat.format("Failed to create query from UUID {0}", uuid.toString()), e); return null; } TopScoreDocCollector collector = TopScoreDocCollector.create(2, false); searcher.search(query, collector); if (collector.getTotalHits() < 1) { return null; } if (collector.getTotalHits() > 1) { LOG.error(MessageFormat.format("Too many documents found with UUID {0}", uuid.toString())); return null; } ScoreDoc hit = collector.topDocs().scoreDocs[0]; return hit; }
From source file:org.eclipse.skalli.core.user.ldap.LDAPClient.java
private User processEntry(SearchResult entry) throws NamingException { User user = new User(); Attributes attrs = entry.getAttributes(); Attribute attrBits = attrs.get(LDAPAttributeNames.BITS.getLdapKey()); if (attrBits != null) { long lng = Long.parseLong(attrBits.get(0).toString()); long secondBit = lng & 2; // get bit 2 if (secondBit != 0) { // User not enabled return null; }/*from w w w. j av a 2s . c o m*/ } user.setUserId(StringUtils.lowerCase(getStringValue(attrs, LDAPAttributeNames.USERID))); user.setFirstname(getStringValue(attrs, LDAPAttributeNames.FIRSTNAME)); user.setLastname(getStringValue(attrs, LDAPAttributeNames.LASTNAME)); user.setEmail(getStringValue(attrs, LDAPAttributeNames.EMAIL)); user.setTelephone(getStringValue(attrs, LDAPAttributeNames.TELEPHONE)); user.setMobile(getStringValue(attrs, LDAPAttributeNames.MOBILE)); user.setRoom(getStringValue(attrs, LDAPAttributeNames.ROOM)); user.setLocation(getStringValue(attrs, LDAPAttributeNames.LOCATION)); user.setDepartment(getStringValue(attrs, LDAPAttributeNames.DEPARTMENT)); user.setCompany(getStringValue(attrs, LDAPAttributeNames.COMPANY)); user.setSip(getStringValue(attrs, LDAPAttributeNames.SIP)); return user; }
From source file:org.eclipse.skalli.core.user.ldap.LDAPUserComponent.java
@Override public synchronized List<User> findUser(String searchText) { if (StringUtils.isBlank(searchText)) { return Collections.emptyList(); }//from w w w . j av a2 s . c o m LDAPClient ldap = getLDAPClient(); if (ldap == null) { return Collections.emptyList(); } List<User> users = ldap.searchUserByName(searchText); for (User user : users) { if (user != null) { cache.put(StringUtils.lowerCase(user.getUserId()), user); } } return users; }
From source file:org.eclipse.skalli.model.Member.java
public Member(String userID) { this.userID = StringUtils.lowerCase(userID); }
From source file:org.eclipse.skalli.model.Member.java
public void setUserID(String userID) { this.userID = StringUtils.lowerCase(userID); }
From source file:org.eclipse.skalli.view.internal.application.ProjectApplication.java
public ProjectApplication(User user) { this.userId = user != null ? StringUtils.lowerCase(user.getUserId()) : null; this.setUser(user); }
From source file:org.egov.egf.web.actions.masters.BankAction.java
private void populateBankNames() { final JSONArray jsonArray = new JSONArray(persistenceService .findAllBy("select name FROM Bank WHERE lower(name) like ?", StringUtils.lowerCase(term + "%"))); writeToAjaxResponse(jsonArray.toString()); }
From source file:org.gbif.portal.web.controller.search.NameSearchController.java
/** * @see org.gbif.portal.web.controller.RestController#resolveAndCreateView(java.util.Map, javax.servlet.http.HttpServletRequest, boolean) *//*from w w w.j a v a2 s.co m*/ protected ModelAndView resolveAndCreateView(String prefix, String returnType, String view) { if (view == null) { view = defaultSubView; } //to lower case if (caseInsensitive) { view = StringUtils.lowerCase(view); } if (!supportedSubViews.contains(view)) view = defaultSubView; // if(caseInsensitive){ // returnType = StringUtils.lowerCase(returnType); // } if (returnType == null || !supportedReturnTypes.contains(returnType)) returnType = defaultReturnType; String resolvedViewName = prefix + "." + returnType + "." + view; logger.debug(resolvedViewName); return new ModelAndView(resolvedViewName); }
From source file:org.hoteia.qalingo.core.service.WebBackofficeService.java
protected User handleUserForm(User user, final UserForm userForm) { if (user == null) { user = new User(); }//w w w. j av a2 s . co m user.setTitle(userForm.getTitle()); user.setLastname(userForm.getLastname()); user.setFirstname(userForm.getFirstname()); user.setEmail(userForm.getEmail()); if (StringUtils.isNotEmpty(userForm.getLogin())) { user.setLogin(userForm.getLogin()); } else { String login = StringUtils.lowerCase(userForm.getFirstname().substring(0, 1) + userForm.getLastname()); User checkUserLogin = userService.getUserByLoginOrEmail(login); int i = 1; while (checkUserLogin != null) { login = StringUtils.lowerCase(userForm.getFirstname().substring(0, 1) + userForm.getLastname() + i); checkUserLogin = userService.getUserByLoginOrEmail(login); i++; } user.setLogin(login.toLowerCase()); } if (StringUtils.isNotEmpty(userForm.getPassword())) { // UPDATE PASSWORD user.setPassword(securityUtil.encodePassword(userForm.getPassword())); } else { if (StringUtils.isEmpty(user.getPassword())) { // SET A DEFAULT PASSWORD String password = securityUtil.generatePassword(); user.setPassword(securityUtil.encodePassword(password)); userForm.setPassword(password); } } user.setAddress1(userForm.getAddress1()); user.setAddress2(userForm.getAddress2()); user.setPostalCode(userForm.getPostalCode()); user.setCity(userForm.getCity()); user.setStateCode(userForm.getStateCode()); user.setAreaCode(userForm.getAreaCode()); user.setCountryCode(userForm.getCountryCode()); user.setActive(userForm.isActive()); return user; }
From source file:org.hy.foundation.utils.page.Page.java
/** * ???./* ww w . j ava 2 s.c om*/ * * @param orderDir * ?descasc,?','. */ public void setOrderDir(final String orderDir) { String lowcaseOrderDir = StringUtils.lowerCase(orderDir); // order? String[] orderDirs = StringUtils.split(lowcaseOrderDir, ','); for (String orderDirStr : orderDirs) { if (!StringUtils.equals(Sort.DESC, orderDirStr) && !StringUtils.equals(Sort.ASC, orderDirStr)) { throw new IllegalArgumentException("??" + orderDirStr + "??"); } } this.orderDir = lowcaseOrderDir; }