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:com.manydesigns.portofino.actions.admin.servletcontext.ServletContextAction.java
protected void setupForm() { ServletContext servletContext = context.getServletContext(); Enumeration<String> attributeNames = servletContext.getAttributeNames(); List<KeyValue> attributes = new ArrayList<KeyValue>(); while (attributeNames.hasMoreElements()) { String key = attributeNames.nextElement(); String value = StringUtils.abbreviate(OgnlUtils.convertValueToString(servletContext.getAttribute(key)), 300);//from w ww . j av a 2 s. c o m attributes.add(new KeyValue(key, value)); } TableFormBuilder builder = new TableFormBuilder(KeyValue.class); builder.configNRows(attributes.size()); builder.configMode(Mode.VIEW); form = builder.build(); form.readFromObject(attributes); }
From source file:net.osxx.plugin.pay99billBank.Pay99billBankPlugin.java
@Override public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) { PluginConfig pluginConfig = getPluginConfig(); Payment payment = getPayment(sn);//from ww w . java2s .c o m Map<String, Object> parameterMap = new LinkedHashMap<String, Object>(); parameterMap.put("inputCharset", "1"); parameterMap.put("pageUrl", getNotifyUrl(sn, NotifyMethod.sync)); parameterMap.put("bgUrl", getNotifyUrl(sn, NotifyMethod.async)); parameterMap.put("version", "v2.0"); parameterMap.put("language", "1"); parameterMap.put("signType", "1"); parameterMap.put("merchantAcctId", pluginConfig.getAttribute("partner")); parameterMap.put("payerIP", request.getLocalAddr()); parameterMap.put("orderId", sn); parameterMap.put("orderAmount", payment.getAmount().multiply(new BigDecimal(100)).setScale(0).toString()); parameterMap.put("orderTime", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date())); parameterMap.put("orderTimestamp", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date())); parameterMap.put("productName", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 100)); parameterMap.put("productDesc", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 400)); parameterMap.put("ext1", "osxx"); parameterMap.put("payType", "10"); String bank = request.getParameter(BANK_PARAMETER_NAME); parameterMap.put("bankId", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK); parameterMap.put("signMsg", generateSign(parameterMap)); return parameterMap; }
From source file:net.groupbuy.plugin.pay99billBank.Pay99billBankPlugin.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 va 2 s . co m Map<String, Object> parameterMap = new LinkedHashMap<String, Object>(); parameterMap.put("inputCharset", "1"); parameterMap.put("pageUrl", getNotifyUrl(sn, NotifyMethod.sync)); parameterMap.put("bgUrl", getNotifyUrl(sn, NotifyMethod.async)); parameterMap.put("version", "v2.0"); parameterMap.put("language", "1"); parameterMap.put("signType", "1"); parameterMap.put("merchantAcctId", pluginConfig.getAttribute("partner")); parameterMap.put("payerIP", request.getLocalAddr()); parameterMap.put("orderId", sn); parameterMap.put("orderAmount", payment.getAmount().multiply(new BigDecimal(100)).setScale(0).toString()); parameterMap.put("orderTime", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date())); parameterMap.put("orderTimestamp", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date())); parameterMap.put("productName", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 100)); parameterMap.put("productDesc", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 400)); parameterMap.put("ext1", "shopxx"); parameterMap.put("payType", "10"); String bank = request.getParameter(BANK_PARAMETER_NAME); parameterMap.put("bankId", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK); parameterMap.put("signMsg", generateSign(parameterMap)); return parameterMap; }
From source file:com.sammyun.plugin.pay99billBank.Pay99billBankPlugin.java
@Override public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) { PluginConfig pluginConfig = getPluginConfig(); Payment payment = getPayment(sn);/* ww w .j av a 2 s. co m*/ Map<String, Object> parameterMap = new LinkedHashMap<String, Object>(); parameterMap.put("inputCharset", "1"); parameterMap.put("pageUrl", getNotifyUrl(sn, NotifyMethod.sync)); parameterMap.put("bgUrl", getNotifyUrl(sn, NotifyMethod.async)); parameterMap.put("version", "v2.0"); parameterMap.put("language", "1"); parameterMap.put("signType", "1"); parameterMap.put("merchantAcctId", pluginConfig.getAttribute("partner")); parameterMap.put("payerIP", request.getLocalAddr()); parameterMap.put("orderId", sn); parameterMap.put("orderAmount", payment.getAmount().multiply(new BigDecimal(100)).setScale(0).toString()); parameterMap.put("orderTime", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date())); parameterMap.put("orderTimestamp", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date())); parameterMap.put("productName", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 100)); parameterMap.put("productDesc", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 400)); parameterMap.put("ext1", "preschoolEdu"); parameterMap.put("payType", "10"); String bank = request.getParameter(BANK_PARAMETER_NAME); parameterMap.put("bankId", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK); parameterMap.put("signMsg", generateSign(parameterMap)); return parameterMap; }
From source file:com.dp2345.plugin.pay99billBank.Pay99billBankPlugin.java
@Override public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) { PluginConfig pluginConfig = getPluginConfig(); Payment payment = getPayment(sn);//from w ww . j a v a 2s. c om Map<String, Object> parameterMap = new LinkedHashMap<String, Object>(); parameterMap.put("inputCharset", "1"); parameterMap.put("pageUrl", getNotifyUrl(sn, NotifyMethod.sync)); parameterMap.put("bgUrl", getNotifyUrl(sn, NotifyMethod.async)); parameterMap.put("version", "v2.0"); parameterMap.put("language", "1"); parameterMap.put("signType", "1"); parameterMap.put("merchantAcctId", pluginConfig.getAttribute("partner")); parameterMap.put("payerIP", request.getLocalAddr()); parameterMap.put("orderId", sn); parameterMap.put("orderAmount", payment.getAmount().multiply(new BigDecimal(100)).setScale(0).toString()); parameterMap.put("orderTime", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date())); parameterMap.put("orderTimestamp", new SimpleDateFormat("yyyyMMddhhmmss").format(new Date())); parameterMap.put("productName", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 100)); parameterMap.put("productDesc", StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 400)); parameterMap.put("ext1", "dp2345"); parameterMap.put("payType", "10"); String bank = request.getParameter(BANK_PARAMETER_NAME); parameterMap.put("bankId", StringUtils.isNotEmpty(bank) ? bank : DEFAULT_BANK); parameterMap.put("signMsg", generateSign(parameterMap)); return parameterMap; }
From source file:com.sammyun.plugin.alipayWap.AlipayWapPlugin.java
@Override public Map<String, Object> getParameterMap(String sn, String description, HttpServletRequest request) { PluginConfig pluginConfig = getPluginConfig(); Payment payment = getPayment(sn);// ww w .j a va 2s .c om String sellerAccountName = pluginConfig.getAttribute("partner"); String subject = StringUtils.abbreviate(description.replaceAll("[^0-9a-zA-Z\\u4e00-\\u9fa5 ]", ""), 60); String totalFee = payment.getAmount().setScale(2).toString(); String merchantUrl = getMobileNotifyUrl(sn, NotifyMethod.sync); // ? String format = "xml"; // ?? // ? String v = "2.0"; // ? String reqDataToken = "<direct_trade_create_req><notify_url>" + getMobileNotifyUrl(sn, NotifyMethod.async) + "</notify_url><call_back_url>" + getMobileNotifyUrl(sn, NotifyMethod.sync) + "</call_back_url><seller_account_name>" + "moco.tmall@moco-paris.com" + "</seller_account_name><out_trade_no>" + sn + "</out_trade_no><subject>" + subject + "</subject><total_fee>" + totalFee + "</total_fee><merchant_url>" + merchantUrl + "</merchant_url></direct_trade_create_req>"; Map<String, Object> parameterMapToken = new HashMap<String, Object>(); parameterMapToken.put("service", "alipay.wap.trade.create.direct"); parameterMapToken.put("partner", pluginConfig.getAttribute("partner")); parameterMapToken.put("_input_charset", "utf-8"); // ???0001(RSA)?MD5 // ????rsasign_type0001?RSA parameterMapToken.put("sec_id", PluginConfig.SIGN_TYPE); parameterMapToken.put("format", format); parameterMapToken.put("v", v); parameterMapToken.put("req_id", DateUtil.getOrderNum()); parameterMapToken.put("req_data", reqDataToken); String requestToken = ""; // URLDECODE? try { // String sHtmlTextToken = buildRequest(getRequestUrl(), parameterMapToken); // sHtmlTextToken = // sHtmlTextToken.replaceAll("%(?![0-9a-fA-F]{2})", // "%25"); // sHtmlTextToken = sHtmlTextToken.replaceAll("\\+", "%2B"); sHtmlTextToken = URLDecoder.decode(sHtmlTextToken, "utf-8"); requestToken = super.getRequestToken(sHtmlTextToken); } catch (UnsupportedEncodingException e) { e.printStackTrace(); logger.error(e.getMessage()); } catch (Exception e) { e.printStackTrace(); logger.error(e.getMessage()); } // String reqData = "<auth_and_execute_req><request_token>" + requestToken + "</request_token></auth_and_execute_req>"; // Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("service", "alipay.wap.auth.authAndExecute"); parameterMap.put("partner", sellerAccountName); parameterMap.put("_input_charset", "utf-8"); parameterMap.put("sec_id", PluginConfig.SIGN_TYPE); parameterMap.put("format", format); parameterMap.put("v", v); parameterMap.put("req_data", reqData); return buildRequestPara(parameterMap); }
From source file:mobi.chouette.model.Company.java
/** * set operating department name <br/> * truncated to 255 characters if too long * // w w w . ja v a 2 s . c om * @param value * New value */ public void setOperatingDepartmentName(String value) { operatingDepartmentName = StringUtils.abbreviate(value, 255); }
From source file:mobi.chouette.model.Line.java
/** * set number <br/>//from w w w . j ava2s .co m * truncated to 255 characters if too long * * @param value * New value */ public void setNumber(String value) { number = StringUtils.abbreviate(value, 255); }
From source file:de.fu_berlin.inf.dpp.activities.business.TextEditActivity.java
@Override public String toString() { return "TextEditActivity(" + this.offset + ",new:'" + Utils.escapeForLogging(StringUtils.abbreviate(this.text, 150)) + "',old:'" + Utils.escapeForLogging(StringUtils.abbreviate(this.replacedText, 150)) + "',path:" + this.path.toString() + ",src:" + this.source + ")"; }
From source file:gr.abiss.calipso.domain.ItemRenderingTemplate.java
@Override public String toString() { return new ToStringBuilder(this).appendSuper(super.toString()).append("description", this.getDescription()) .append("priority", this.getPriority()).append("hideOverview", this.getHideOverview()) .append("hideHistory", this.getHideHistory()) .append("templateText (abbreviated)", StringUtils.abbreviate(this.getTemplateText(), 20)) .toString();/*from www . j a va 2 s . com*/ }