List of usage examples for org.apache.commons.lang StringUtils substringAfter
public static String substringAfter(String str, String separator)
Gets the substring after the first occurrence of a separator.
From source file:com.adobe.ac.pmd.rules.core.AbstractFlexRule.java
/** * @return Extracts the rulename from the qualified name of the underlying * class//from ww w .j a va2s . c o m */ public final String getRuleName() { final String qualifiedClassName = this.getClass().getName(); final String className = StringUtils.substringAfter(qualifiedClassName, "."); return className.replace("Rule", ""); }
From source file:com.kinglcc.spring.jms.core.DestinationType.java
public String getDestinationName(String destinationNameWithType) { switch (this) { case SHAREDDURABLETOPIC: String name = StringUtils.substringAfter(destinationNameWithType, SHARED_PREFIX); if (StringUtils.startsWith(name, DURABLE_PREFIX)) { return StringUtils.substringAfter(name, DURABLE_PREFIX); }//from w w w.j a v a 2 s. co m return name; case SHAREDTOPIC: return StringUtils.substringAfter(destinationNameWithType, SHARED_PREFIX); case DURABLETOPIC: return StringUtils.substringAfter(destinationNameWithType, DURABLE_PREFIX); case TOPIC: return StringUtils.substringAfter(destinationNameWithType, TOPIC_PREFIX); default: if (StringUtils.startsWith(destinationNameWithType, QUEUE_PREFIX)) { return StringUtils.substringAfter(destinationNameWithType, QUEUE_PREFIX); } return destinationNameWithType; } }
From source file:com.voa.weixin.task.Task.java
/** * ?access_token/*from ww w.jav a 2s . c om*/ */ public void changeToken() { if (StringUtils.contains(url, "ACCESS_TOKEN")) { url = StringUtils.replace(url, "ACCESS_TOKEN", Carp.token); } else { String oldToken = StringUtils.substringAfter(url, "access_token="); if (StringUtils.contains(oldToken, "&")) { oldToken = StringUtils.substringBetween(url, "access_token=", "&"); } url = StringUtils.replace(url, oldToken, Carp.token); } }
From source file:ips1ap101.lib.core.db.util.DBUtils.java
public static String[] getConstraintMessageKeys(String message) { String trimmed = StringUtils// w ww. j a v a2 s . c o m .trimToEmpty(StringUtils.substringAfter(StringUtils.substringBefore(message, WHERE), ERROR)); if (StringUtils.isNotBlank(trimmed)) { String[] tokens = StringUtils.split(trimmed, ';'); if (tokens != null && tokens.length > 1) { String key = tokens[0].trim(); if (key.matches("^[0-9]{1,3}$")) { int length = Integer.valueOf(key); if (length == tokens.length - 1) { String string; String[] keys = new String[length]; for (int i = 1; i < tokens.length; i++) { key = tokens[i].trim(); if (key.endsWith(SUFIJO) && StringUtils.indexOfAny(key, INFIJOS) > 0) { key = StringUtils.removeEnd(key, SUFIJO); string = BundleMensajes.getString(key); keys[i - 1] = isKey(string) ? string : "<" + key + ">"; } else { return null; } } return keys; } } } String key, string; String stripChars = BOMK + EOMK; List<String> list = new ArrayList<>(); Pattern pattern = Pattern.compile("\\" + BOMK + ".*\\" + EOMK); Matcher matcher = pattern.matcher(trimmed); while (matcher.find()) { key = StringUtils.strip(matcher.group(), stripChars); if (key.endsWith(SUFIJO) && StringUtils.indexOfAny(key, INFIJOS) > 0) { key = StringUtils.removeEnd(key, SUFIJO); string = BundleMensajes.getString(key); key = isKey(string) ? string : "<" + key + ">"; list.add(key); } } return (list.isEmpty()) ? null : list.toArray(new String[list.size()]); } return null; }
From source file:com.github.dbourdette.otto.source.Event.java
public Event parseValue(String key, String value) { if (StringUtils.startsWith(key, INTEGER_PREFIX)) { key = StringUtils.substringAfter(key, INTEGER_PREFIX); putInt(key, Integer.parseInt(value)); } else if (StringUtils.startsWith(key, BOOLEAN_PREFIX)) { key = StringUtils.substringAfter(key, BOOLEAN_PREFIX); putBoolean(key, Boolean.valueOf(value)); } else if (StringUtils.startsWith(key, DATE_PREFIX)) { key = StringUtils.substringAfter(key, DATE_PREFIX); putDate(key, DateTimeFormat.forPattern(DATE_PATTERN).parseDateTime(value)); } else {//from w w w . j av a 2 s. c o m putString(key, value); } return this; }
From source file:com.amalto.core.save.PartialUpdateSaverContext.java
@Override public void setDatabaseDocument(MutableDocument databaseDocument) { String localName = databaseDocument.asDOM().getDocumentElement().getLocalName(); pivot = StringUtils.substringAfter(pivot, localName + '/'); delegate.setDatabaseDocument(databaseDocument); }
From source file:com.cndatacom.core.orm.PropertyFilter.java
/** * @param filterName ,???. //from ww w .j a v a 2s .c o m * eg. LIKES_NAME_OR_LOGIN_NAME * @param value . */ public PropertyFilter(final String filterName, final String value) { this.filterName = filterName; this.value = value; String matchTypeStr = StringUtils.substringBefore(filterName, "_"); //,EQ String matchTypeCode = StringUtils.substring(matchTypeStr, 0, matchTypeStr.length() - 1); //?,S?I String propertyTypeCode = StringUtils.substring(matchTypeStr, matchTypeStr.length() - 1, matchTypeStr.length()); try { matchType = Enum.valueOf(MatchType.class, matchTypeCode); } catch (RuntimeException e) { throw new IllegalArgumentException( "filter??" + filterName + ",.", e); } try { propertyType = Enum.valueOf(PropertyType.class, propertyTypeCode).getValue(); } catch (RuntimeException e) { throw new IllegalArgumentException( "filter??" + filterName + ",.", e); } String propertyNameStr = StringUtils.substringAfter(filterName, "_"); //propertyNames = StringUtils.split(propertyNameStr, PropertyFilter.OR_SEPARATOR); propertyNames = propertyNameStr.split(PropertyFilter.OR_SEPARATOR); Assert.isTrue(propertyNames.length > 0, "filter??" + filterName + ",??."); //entity property. if (propertyNameStr.indexOf(LEFT_JION) != -1) { isLeftJion = true; } // Object value_ = null; if (null == value || value.equals("")) { this.propertyValue = null; } else { this.propertyValue = ReflectionUtils.convertStringToObject(value, propertyType); value_ = propertyValue; //?1 if (propertyType.equals(Date.class) && filterName.indexOf("LTD") > -1) { propertyValue = DateUtils.addDays((Date) propertyValue, 1); } } //request? String key = propertyNames[0].replace(".", "_").replace(":", "_"); // if(propertyType!=Date.class) //// Struts2Utils.getRequest().setAttribute(key, propertyValue); //// else{ //// if(Struts2Utils.getRequest().getAttribute(key)!=null){ //// String time_begin=Struts2Utils.getRequest().getAttribute(key)+""; //// Struts2Utils.getRequest().setAttribute(key, time_begin+"="+com.cndatacom.common.utils.DateUtil.format((Date)value_,"yyyy-MM-dd")); //// }else{ //// Struts2Utils.getRequest().setAttribute(key, com.cndatacom.common.utils.DateUtil.format((Date)value_,"yyyy-MM-dd")); //// } // // } }
From source file:de.griffel.confluence.plugins.plantuml.preprocess.ShortcutLinkUrlRenderer.java
private ShortcutLinkConfig getShortcutLinkConfig(final String pageTitle, final String shortcutValue) { final String shortcutKey = StringUtils.substringAfter(pageTitle, ConfluenceLink.SHORTCUT_LINK_SEPARATOR); if (StringUtils.isEmpty(shortcutValue)) { throw new IllegalArgumentException( "Invalid shortcut link. Missing value for link '" + pageTitle + "'."); }/*from ww w .ja v a 2 s. co m*/ if (StringUtils.isEmpty(shortcutKey)) { throw new IllegalArgumentException("Invalid shortcut link. Missing key for link '" + pageTitle + "'."); } if (!shortcutLinkMap.containsKey(shortcutKey)) { throw new IllegalArgumentException("Unknown shortcut key '" + shortcutKey + "'."); } final ShortcutLinkConfig shortcutLinkConfig = shortcutLinkMap.get(shortcutKey); return shortcutLinkConfig; }
From source file:mitm.application.djigzo.james.mailets.PDFReplyURLBuilderTest.java
@Test public void testUnicode() throws URLBuilderException { final String key = "abc"; final String subject = "Gre"; PDFReplyURLBuilder builder = new PDFReplyURLBuilder(new StandardHttpURLBuilder()); builder.setBaseURL("http://www.example.com"); builder.setUser("user@example.com"); builder.setFrom("test@example.com"); builder.setRecipient("test@recipient.example.com"); builder.setSubject(subject);// ww w. j a v a 2 s . co m builder.setKey(key); builder.setTime(8765L); builder.setMessageID("123"); String url = builder.buildURL(); assertNotNull(url); PDFReplyURLBuilder.KeyProvider keyProvider = new PDFReplyURLBuilder.KeyProvider() { @Override public String getKey(PDFReplyURLBuilder builder) throws URLBuilderException { return key; } }; String envelope = StringUtils.substringBetween(url, "env=", "&hmac="); String hmac = StringUtils.substringAfter(url, "hmac="); System.out.println(url); System.out.println(envelope); System.out.println(hmac); builder = new PDFReplyURLBuilder(new StandardHttpURLBuilder()); builder.loadFromEnvelope(envelope, hmac, keyProvider); assertEquals("user@example.com", builder.getUser()); assertEquals("test@example.com", builder.getFrom()); assertEquals("test@recipient.example.com", builder.getRecipient()); assertEquals(subject, builder.getSubject()); }
From source file:com.tikal.tallerWeb.servicio.monitor.imp.EditorMonitorImpV3.java
@Around("modelChange()") public void updateProperty(ProceedingJoinPoint pjp) throws Throwable { if (encendido && activo) { Object target = pjp.getTarget(); Object proxyTarget = AopContext.currentProxy(); if (!(target instanceof Metadata)) { String methodName = pjp.getSignature().getName(); String propertyName = StringUtils.substringAfter(methodName, "set"); String primeraLetra = propertyName.charAt(0) + ""; propertyName = primeraLetra.toLowerCase() + StringUtils.substringAfter(propertyName, primeraLetra); processChange(proxyTarget, propertyName, pjp.getArgs()[0]); }//w ww . j a v a 2s . c om } pjp.proceed(); }