List of usage examples for org.apache.commons.lang StringUtils abbreviate
public static String abbreviate(String str, int maxWidth)
Abbreviates a String using ellipses.
From source file:mobi.chouette.model.Company.java
/** * set short name <br/>/*from w ww . j a va2 s . c om*/ * truncated to 255 characters if too long * * @param value * New value */ public void setShortName(String value) { shortName = StringUtils.abbreviate(value, 255); }
From source file:net.groupbuy.plugin.yeepay.YeepayPlugin.java
@Override public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) { PluginConfig pluginConfig = getPluginConfig(); Payment payment = getPayment(sn);/*from w w w . jav a2 s . c o m*/ Map<String, Object> parameterMap = new LinkedHashMap<String, Object>(); parameterMap.put("p0_Cmd", "Buy"); parameterMap.put("p1_MerId", pluginConfig.getAttribute("partner")); parameterMap.put("p2_Order", sn); parameterMap.put("p3_Amt", payment.getAmount().setScale(2).toString()); parameterMap.put("p4_Cur", "CNY"); parameterMap.put("p5_Pid", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 20)); parameterMap.put("p7_Pdesc", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 20)); parameterMap.put("p8_Url", getNotifyUrl(sn, NotifyMethod.general)); parameterMap.put("p9_SAF", "0"); parameterMap.put("pa_MP", "shopxx"); parameterMap.put("pr_NeedResponse", "1"); parameterMap.put("hmac", generateSign(parameterMap)); return parameterMap; }
From source file:com.sammyun.plugin.yeepay.YeepayPlugin.java
@Override public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) { PluginConfig pluginConfig = getPluginConfig(); Payment payment = getPayment(sn);/*from w w w . j av a 2s .co m*/ Map<String, Object> parameterMap = new LinkedHashMap<String, Object>(); parameterMap.put("p0_Cmd", "Buy"); parameterMap.put("p1_MerId", pluginConfig.getAttribute("partner")); parameterMap.put("p2_Order", sn); parameterMap.put("p3_Amt", payment.getAmount().setScale(2).toString()); parameterMap.put("p4_Cur", "CNY"); parameterMap.put("p5_Pid", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 20)); parameterMap.put("p7_Pdesc", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 20)); parameterMap.put("p8_Url", getNotifyUrl(sn, NotifyMethod.general)); parameterMap.put("p9_SAF", "0"); parameterMap.put("pa_MP", "preschoolEdu"); parameterMap.put("pr_NeedResponse", "1"); parameterMap.put("hmac", generateSign(parameterMap)); return parameterMap; }
From source file:com.dp2345.plugin.yeepay.YeepayPlugin.java
@Override public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) { PluginConfig pluginConfig = getPluginConfig(); Payment payment = getPayment(sn);/*from w w w. j av a2 s.c o m*/ Map<String, Object> parameterMap = new LinkedHashMap<String, Object>(); parameterMap.put("p0_Cmd", "Buy"); parameterMap.put("p1_MerId", pluginConfig.getAttribute("partner")); parameterMap.put("p2_Order", sn); parameterMap.put("p3_Amt", payment.getAmount().setScale(2).toString()); parameterMap.put("p4_Cur", "CNY"); parameterMap.put("p5_Pid", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 20)); parameterMap.put("p7_Pdesc", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 20)); parameterMap.put("p8_Url", getNotifyUrl(sn, NotifyMethod.general)); parameterMap.put("p9_SAF", "0"); parameterMap.put("pa_MP", "dp2345"); parameterMap.put("pr_NeedResponse", "1"); parameterMap.put("hmac", generateSign(parameterMap)); return parameterMap; }
From source file:com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.parameters.Base64EncodedStringParameterValue.java
@Override public String getShortDescription() { return name + "=<Base64 Encoded String: " + StringUtils.abbreviate(value, ABBREVIATE_LENGTH) + ">"; }
From source file:net.shopxx.plugin.paypalPayment.PaypalPaymentPlugin.java
@Override public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) { PluginConfig pluginConfig = getPluginConfig(); PaymentLog paymentLog = getPaymentLog(sn); Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("cmd", "_xclick"); parameterMap.put("business", pluginConfig.getAttribute("partner")); parameterMap.put("item_name", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 100)); parameterMap.put("amount", paymentLog.getAmount().setScale(2).toString()); parameterMap.put("currency_code", pluginConfig.getAttribute("currency")); parameterMap.put("return", getNotifyUrl(PaymentPlugin.NotifyMethod.sync)); parameterMap.put("notify_url", getNotifyUrl(PaymentPlugin.NotifyMethod.async)); parameterMap.put("invoice", sn); parameterMap.put("charset", "UTF-8"); parameterMap.put("no_shipping", "1"); parameterMap.put("no_note", "0"); parameterMap.put("rm", "2"); parameterMap.put("custom", "shopxx"); return parameterMap; }
From source file:com.mothsoft.alexis.domain.Topic.java
public String getDescriptionSummary() { return StringUtils.abbreviate(this.description, 75); }
From source file:net.shopxx.plugin.yeepayPayment.YeepayPaymentPlugin.java
@Override public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) { PluginConfig pluginConfig = getPluginConfig(); PaymentLog paymentLog = getPaymentLog(sn); Map<String, Object> parameterMap = new LinkedHashMap<String, Object>(); parameterMap.put("p0_Cmd", "Buy"); parameterMap.put("p1_MerId", pluginConfig.getAttribute("partner")); parameterMap.put("p2_Order", sn); parameterMap.put("p3_Amt", paymentLog.getAmount().setScale(2).toString()); parameterMap.put("p4_Cur", "CNY"); parameterMap.put("p5_Pid", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 20)); parameterMap.put("p7_Pdesc", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 20)); parameterMap.put("p8_Url", getNotifyUrl(PaymentPlugin.NotifyMethod.general)); parameterMap.put("p9_SAF", "0"); parameterMap.put("pa_MP", "shopxx"); parameterMap.put("pr_NeedResponse", "1"); parameterMap.put("hmac", generateSign(parameterMap)); return parameterMap; }
From source file:com.leavesfly.lia.advsearching.SortingExample.java
public void displayResults(Query query, Sort sort) // #1 throws IOException { IndexSearcher searcher = new IndexSearcher(directory); searcher.setDefaultFieldSortScoring(true, false); // #2 TopDocs results = searcher.search(query, null, // #3 20, sort); // #3 System.out.println("\nResults for: " + // #4 query.toString() + " sorted by " + sort); System.out.println(StringUtils.rightPad("Title", 30) + StringUtils.rightPad("pubmonth", 10) + StringUtils.center("id", 4) + StringUtils.center("score", 15)); PrintStream out = new PrintStream(System.out, true, "UTF-8"); // #5 DecimalFormat scoreFormatter = new DecimalFormat("0.######"); for (ScoreDoc sd : results.scoreDocs) { int docID = sd.doc; float score = sd.score; Document doc = searcher.doc(docID); out.println(StringUtils.rightPad( // #6 StringUtils.abbreviate(doc.get("title"), 29), 30) + // #6 StringUtils.rightPad(doc.get("pubmonth"), 10) + // #6 StringUtils.center("" + docID, 4) + // #6 StringUtils.leftPad( // #6 scoreFormatter.format(score), 12)); // #6 out.println(" " + doc.get("category")); // out.println(searcher.explain(query, docID)); // #7 }//from ww w . ja v a 2 s . co m searcher.close(); }
From source file:gov.guilin.plugin.alipayDual.AlipayDualPlugin.java
@Override public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) { Setting setting = SettingUtils.get(); PluginConfig pluginConfig = getPluginConfig(); Payment payment = getPayment(sn);//ww w . jav a 2 s . c o m Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("service", "trade_create_by_buyer"); parameterMap.put("partner", pluginConfig.getAttribute("partner")); parameterMap.put("_input_charset", "utf-8"); parameterMap.put("sign_type", "MD5"); parameterMap.put("return_url", getNotifyUrl(sn, NotifyMethod.sync)); parameterMap.put("notify_url", getNotifyUrl(sn, NotifyMethod.async)); parameterMap.put("out_trade_no", sn); parameterMap.put("subject", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 60)); parameterMap.put("body", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 600)); parameterMap.put("payment_type", "1"); parameterMap.put("logistics_type", "EXPRESS"); parameterMap.put("logistics_fee", "0"); parameterMap.put("logistics_payment", "SELLER_PAY"); parameterMap.put("price", payment.getAmount().setScale(2).toString()); parameterMap.put("quantity", "1"); parameterMap.put("seller_id", pluginConfig.getAttribute("partner")); parameterMap.put("total_fee", payment.getAmount().setScale(2).toString()); parameterMap.put("show_url", setting.getSiteUrl()); parameterMap.put("paymethod", "directPay"); parameterMap.put("exter_invoke_ip", request.getLocalAddr()); parameterMap.put("extra_common_param", "guilin"); parameterMap.put("sign", generateSign(parameterMap)); return parameterMap; }