List of usage examples for org.apache.commons.lang StringUtils isNotEmpty
public static boolean isNotEmpty(String str)
Checks if a String is not empty ("") and not null.
From source file:com.assemblade.rest.mappers.GroupMapper.java
public com.assemblade.server.model.Group toServer(Group clientGroup) throws StorageException { com.assemblade.server.model.Group serverGroup = new com.assemblade.server.model.Group(); serverGroup.setId(clientGroup.getId()); serverGroup.setParentDn(com.assemblade.server.model.Group.ROOT); if (StringUtils.isNotEmpty(serverGroup.getId())) { serverGroup.setGroupId(userManager.getUserSession() .getByEntryId(new com.assemblade.server.model.Group(), serverGroup.getId()).getGroupId()); }/*from w w w . j a v a2 s . c o m*/ serverGroup.setName(clientGroup.getName()); serverGroup.setDescription(clientGroup.getDescription()); return serverGroup; }
From source file:com.npower.dm.core.selector.j2me.MidpV1Selector.java
/** * @param modelBean/* w ww . j a va2 s . c o m*/ * @param model * @return * @throws Exception */ protected boolean isSelected(ModelBean modelBean, Model model) throws Exception { String v = modelBean.getCapability(model, "j2me_midp_1_0"); if (StringUtils.isNotEmpty(v) && v.trim().equals("true")) { return true; } return false; }
From source file:com.npower.dm.core.selector.j2me.MidpV2Selector.java
/** * @param modelBean// w ww . java 2s. com * @param model * @return * @throws Exception */ protected boolean isSelected(ModelBean modelBean, Model model) throws Exception { String v = modelBean.getCapability(model, "j2me_midp_2_0"); if (StringUtils.isNotEmpty(v) && v.trim().equals("true")) { return true; } return false; }
From source file:com.beyondb.geocoding.BaiduAPI.java
public static Map<String, String> testPost(String x, String y) throws IOException { URL url = new URL("http://api.map.baidu.com/geocoder?" + ak + "=" + "&callback=renderReverse&location=" + x + "," + y + "&output=json"); URLConnection connection = url.openConnection(); /**/*from w w w . j av a 2 s .co m*/ * ??URLConnection?Web * URLConnection???Web??? */ connection.setDoOutput(true); OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream(), "utf-8"); // remember to clean up out.flush(); out.close(); // ????? String res; InputStream l_urlStream; l_urlStream = connection.getInputStream(); BufferedReader in = new BufferedReader(new InputStreamReader(l_urlStream, "UTF-8")); StringBuilder sb = new StringBuilder(""); while ((res = in.readLine()) != null) { sb.append(res.trim()); } String str = sb.toString(); System.out.println(str); Map<String, String> map = null; if (StringUtils.isNotEmpty(str)) { int addStart = str.indexOf("formatted_address\":"); int addEnd = str.indexOf("\",\"business"); if (addStart > 0 && addEnd > 0) { String address = str.substring(addStart + 20, addEnd); map = new HashMap<String, String>(); map.put("address", address); return map; } } return null; }
From source file:com.floreantpos.model.dao.CustomerDAO.java
public List<Customer> findBy(String mobile, String loyalty, String name) { Session session = null;//from ww w . java 2 s. c o m try { session = getSession(); Criteria criteria = session.createCriteria(getReferenceClass()); Disjunction disjunction = Restrictions.disjunction(); if (StringUtils.isNotEmpty(mobile)) disjunction.add(Restrictions.like(Customer.PROP_MOBILE_NO, "%" + mobile + "%")); //$NON-NLS-1$ //$NON-NLS-2$ if (StringUtils.isNotEmpty(loyalty)) disjunction.add(Restrictions.like(Customer.PROP_LOYALTY_NO, "%" + loyalty + "%")); //$NON-NLS-1$ //$NON-NLS-2$ if (StringUtils.isNotEmpty(name)) disjunction.add(Restrictions.like(Customer.PROP_FIRST_NAME, "%" + name + "%")); //$NON-NLS-1$ //$NON-NLS-2$ criteria.add(disjunction); return criteria.list(); } finally { if (session != null) { closeSession(session); } } }
From source file:com.bstek.dorado.data.config.xml.DataElementParserSupport.java
/** * ??DataType??DataType???/* ww w . j av a 2 s.c o m*/ * * @throws Exception * @see #getCurrentDataType(DataParseContext) */ protected Object parseValueFromText(String valueText, DataParseContext context) throws Exception { Object value = valueText; if (StringUtils.isNotEmpty(valueText)) { Expression expression = getExpressionHandler().compile(valueText); if (expression != null) { DataType dataType = getCurrentDataType(context); if (dataType != null) { value = new DataTypeSupportedExpression(dataType, expression); } else { value = expression; } } else { DataType dataType = getCurrentDataType(context); if (dataType != null) { value = dataType.fromText(valueText); } } } return value; }
From source file:com.clican.pluto.dataprocess.dpl.function.impl.MatchPriceAndWeight.java
@SuppressWarnings("unchecked") public Object calculate(List<Map<String, Object>> rowSet) throws CalculationException, PrefixAndSuffixException { Map<String, Object> mapRow = new HashMap<String, Object>(); boolean clear = true; Date date = null;/*from w ww . j a v a 2 s. com*/ for (Map<String, Object> row : rowSet) { date = datePas.getValue(row); String weightCode = weightCodePas.getValue(row); Number weight = weightPas.getValue(row); if (StringUtils.isNotEmpty(weightCode) && clear) { previousWeightMap.clear(); previousResetDuration = resetDurationPas.getValue(row); previousDate = datePas.getValue(row); clear = false; } if (StringUtils.isNotEmpty(weightCode)) { previousWeightMap.put(weightCode, weight.doubleValue()); } } // ??? boolean changeWeight = !clear; if (changeWeight) { for (String code : allCodes) { if (!previousWeightMap.containsKey(code)) { previousWeightMap.put(code, 0d); } } weightMap = new HashMap<String, Double>(previousWeightMap); } else { if (StringUtils.isNotEmpty(previousResetDuration)) { if (previousResetDuration.equals("1D")) { weightMap = new HashMap<String, Double>(previousWeightMap); } else if (previousResetDuration.equals("1W")) { if (!ToChar.toYearAndWeek(previousDate).equals(ToChar.toYearAndWeek(date))) { previousDate = date; weightMap = new HashMap<String, Double>(previousWeightMap); } } else if (previousResetDuration.equals("1M")) { Date temp = DateUtils.addMonths(previousDate, 1); if (temp.compareTo(date) <= 0) { previousDate = date; weightMap = new HashMap<String, Double>(previousWeightMap); } } else if (previousResetDuration.equals("3M")) { Date temp = DateUtils.addMonths(previousDate, 3); if (temp.compareTo(date) <= 0) { previousDate = date; weightMap = new HashMap<String, Double>(previousWeightMap); } } } } Set<String> populatePriceSet = new HashSet<String>(); for (Map<String, Object> row : rowSet) { mapRow.put("date", date); // ??? if (weightMap.size() == 0) { break; } String priceCode = priceCodePas.getValue(row); if (weightMap.containsKey(priceCode)) { populatePriceSet.add(priceCode); } } mapRow.put("date", date); if (populatePriceSet.size() == weightMap.size()) { for (Map<String, Object> row : rowSet) { String priceCode = priceCodePas.getValue(row); Number price = pricePas.getValue(row); if (StringUtils.isNotEmpty(priceCode) && weightMap.containsKey(priceCode)) { if (!mapRow.containsKey("priceMap")) { mapRow.put("priceMap", new HashMap<String, Double>()); } ((Map) mapRow.get("priceMap")).put(priceCode, price.doubleValue()); if (!mapRow.containsKey("weightMap")) { mapRow.put("weightMap", new HashMap<String, Double>()); } if (!((Map) mapRow.get("weightMap")).containsKey(priceCode)) { ((Map) mapRow.get("weightMap")).put(priceCode, weightMap.get(priceCode)); } if (previousResetDuration.equals("1W") || previousResetDuration.equals("1M") || previousResetDuration.equals("3M")) { // ????? weightMap.put(priceCode, null); } } } } return mapRow; }
From source file:net.shopxx.service.impl.ProductNotifyServiceImpl.java
public int send(List<ProductNotify> productNotifies) { if (CollectionUtils.isEmpty(productNotifies)) { return 0; }//from w ww . j a va 2 s.c o m int count = 0; for (ProductNotify productNotify : productNotifies) { if (productNotify != null && StringUtils.isNotEmpty(productNotify.getEmail())) { mailService.sendProductNotifyMail(productNotify); productNotify.setHasSent(true); count++; } } return count; }
From source file:bboss.org.apache.velocity.runtime.parser.node.PropertyExecutor.java
/** * @param log/*from w w w .j a va 2 s .c o m*/ * @param introspector * @param clazz * @param property * @since 1.5 */ public PropertyExecutor(final Log log, final Introspector introspector, final Class clazz, final String property) { this.log = log; this.introspector = introspector; // Don't allow passing in the empty string or null because // it will either fail with a StringIndexOutOfBounds error // or the introspector will get confused. if (StringUtils.isNotEmpty(property)) { discover(clazz, property); } }