Example usage for org.apache.commons.lang StringUtils abbreviate

List of usage examples for org.apache.commons.lang StringUtils abbreviate

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils abbreviate.

Prototype

public static String abbreviate(String str, int maxWidth) 

Source Link

Document

Abbreviates a String using ellipses.

Usage

From source file:net.shopxx.plugin.alipayBankPayment.AlipayBankPaymentPlugin.java

@Override
public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) {
    Setting setting = SystemUtils.getSetting();
    PluginConfig pluginConfig = getPluginConfig();
    PaymentLog paymentLog = getPaymentLog(sn);
    Map<String, Object> parameterMap = new HashMap<String, Object>();
    parameterMap.put("service", "create_direct_pay_by_user");
    parameterMap.put("partner", pluginConfig.getAttribute("partner"));
    parameterMap.put("_input_charset", "utf-8");
    parameterMap.put("sign_type", "MD5");
    parameterMap.put("return_url", getNotifyUrl(PaymentPlugin.NotifyMethod.sync));
    parameterMap.put("notify_url", getNotifyUrl(PaymentPlugin.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");
    String bank = request.getParameter(BANK_PARAMETER_NAME);
    parameterMap.put("defaultbank", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK);
    parameterMap.put("seller_id", pluginConfig.getAttribute("partner"));
    parameterMap.put("total_fee", paymentLog.getAmount().setScale(2).toString());
    parameterMap.put("show_url", setting.getSiteUrl());
    parameterMap.put("paymethod", "bankPay");
    parameterMap.put("extend_param", "isv^1860648a1");
    parameterMap.put("exter_invoke_ip", request.getLocalAddr());
    parameterMap.put("extra_common_param", "shopxx");
    parameterMap.put("sign", generateSign(parameterMap));
    return parameterMap;
}

From source file:gov.guilin.plugin.tenpayBank.TenpayBankPlugin.java

@Override
public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) {
    PluginConfig pluginConfig = getPluginConfig();
    Payment payment = getPayment(sn);//  w  w  w. ja  v a2s .  c o  m
    Map<String, Object> parameterMap = new HashMap<String, Object>();
    parameterMap.put("trade_mode", "1");
    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 ]", ""), 30));
    parameterMap.put("body",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 30));
    String bank = request.getParameter(BANK_PARAMETER_NAME);
    parameterMap.put("bank_type", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK);
    parameterMap.put("seller_id", pluginConfig.getAttribute("partner"));
    parameterMap.put("total_fee", payment.getAmount().multiply(new BigDecimal(100)).setScale(0).toString());
    parameterMap.put("fee_type", "1");
    parameterMap.put("spbill_create_ip", request.getLocalAddr());
    parameterMap.put("attach", "guilin");
    parameterMap.put("sign", generateSign(parameterMap));
    return parameterMap;
}

From source file:net.groupbuy.plugin.alipayBank.AlipayBankPlugin.java

@Override
public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) {
    Setting setting = SettingUtils.get();
    PluginConfig pluginConfig = getPluginConfig();
    Payment payment = getPayment(sn);//from   w w  w .  java2  s  .com
    Map<String, Object> parameterMap = new HashMap<String, Object>();
    parameterMap.put("service", "create_direct_pay_by_user");
    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");
    String bank = request.getParameter(BANK_PARAMETER_NAME);
    parameterMap.put("defaultbank", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK);
    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", "bankPay");
    parameterMap.put("exter_invoke_ip", request.getLocalAddr());
    parameterMap.put("extra_common_param", "shopxx");
    parameterMap.put("sign", generateSign(parameterMap));
    return parameterMap;
}

From source file:net.shopxx.plugin.tenpayBankPayment.TenpayBankPaymentPlugin.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("trade_mode", "1");
    parameterMap.put("partner", pluginConfig.getAttribute("partner"));
    parameterMap.put("input_charset", "utf-8");
    parameterMap.put("sign_type", "MD5");
    parameterMap.put("return_url", getNotifyUrl(PaymentPlugin.NotifyMethod.sync));
    parameterMap.put("notify_url", getNotifyUrl(PaymentPlugin.NotifyMethod.async));
    parameterMap.put("out_trade_no", sn);
    parameterMap.put("subject",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 30));
    parameterMap.put("body",
            StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 30));
    String bank = request.getParameter(BANK_PARAMETER_NAME);
    parameterMap.put("bank_type", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK);
    parameterMap.put("seller_id", pluginConfig.getAttribute("partner"));
    parameterMap.put("total_fee", paymentLog.getAmount().multiply(new BigDecimal(100)).setScale(0).toString());
    parameterMap.put("fee_type", "1");
    parameterMap.put("spbill_create_ip", request.getLocalAddr());
    parameterMap.put("attach", "shopxx");
    parameterMap.put("sign", generateSign(parameterMap));
    return parameterMap;
}

From source file:com.sammyun.plugin.alipayBank.AlipayBankPlugin.java

@Override
public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) {
    Setting setting = SettingUtils.get();
    PluginConfig pluginConfig = getPluginConfig();
    Payment payment = getPayment(sn);/*from   w  w  w.jav a  2 s. c  o  m*/
    Map<String, Object> parameterMap = new HashMap<String, Object>();
    parameterMap.put("service", "create_direct_pay_by_user");
    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");
    String bank = request.getParameter(BANK_PARAMETER_NAME);
    parameterMap.put("defaultbank", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK);
    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", "bankPay");
    parameterMap.put("exter_invoke_ip", request.getLocalAddr());
    parameterMap.put("extra_common_param", "preschoolEdu");
    parameterMap.put("sign", generateSign(parameterMap));
    return parameterMap;
}

From source file:net.osxx.plugin.paypal.PaypalPlugin.java

@Override
public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) {
    PluginConfig pluginConfig = getPluginConfig();
    Payment payment = getPayment(sn);//from  ww  w  .j  a v  a2  s.  c  o  m
    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", payment.getAmount().setScale(2).toString());
    parameterMap.put("currency_code", pluginConfig.getAttribute("currency"));
    parameterMap.put("return", getNotifyUrl(sn, NotifyMethod.sync));
    parameterMap.put("notify_url", getNotifyUrl(sn, 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", "osxx");
    return parameterMap;
}

From source file:com.dp2345.plugin.alipayBank.AlipayBankPlugin.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.j  av a2  s. co m*/
    Map<String, Object> parameterMap = new HashMap<String, Object>();
    parameterMap.put("service", "create_direct_pay_by_user");
    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");
    String bank = request.getParameter(BANK_PARAMETER_NAME);
    parameterMap.put("defaultbank", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK);
    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", "bankPay");
    parameterMap.put("exter_invoke_ip", request.getLocalAddr());
    parameterMap.put("extra_common_param", "dp2345");
    parameterMap.put("sign", generateSign(parameterMap));
    return parameterMap;
}

From source file:mobi.chouette.model.Company.java

/**
 * set organizational unit <br/>//from w w w.  jav  a2  s  . co m
 * truncated to 255 characters if too long
 * 
 * @param value
 *            New value
 */
public void setOrganisationalUnit(String value) {
    organisationalUnit = StringUtils.abbreviate(value, 255);

}

From source file:net.groupbuy.plugin.paypal.PaypalPlugin.java

@Override
public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) {
    PluginConfig pluginConfig = getPluginConfig();
    Payment payment = getPayment(sn);// w w  w.j  ava 2s  .  c  o m
    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", payment.getAmount().setScale(2).toString());
    parameterMap.put("currency_code", pluginConfig.getAttribute("currency"));
    parameterMap.put("return", getNotifyUrl(sn, NotifyMethod.sync));
    parameterMap.put("notify_url", getNotifyUrl(sn, 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.gu.management.database.logging.SqlQueryDataTest.java

private String stringPreview(String sql) {
    return StringUtils.abbreviate(sql, 60);
}