List of usage examples for org.apache.commons.lang StringUtils substringAfterLast
public static String substringAfterLast(String str, String separator)
Gets the substring after the last occurrence of a separator.
From source file:it.openutils.mgnlaws.magnolia.datastore.S3DataRecord.java
public S3DataRecord(AmazonS3 client, S3ObjectSummary summary) { this(new DataIdentifier(StringUtils.substringAfterLast(summary.getKey(), "/")), new S3LazyObject(client, summary.getBucketName(), summary.getKey())); }
From source file:com.netflix.spinnaker.igor.travis.client.model.Commit.java
public boolean isTag() { return compareUrl != null && StringUtils.substringAfterLast(compareUrl, "/compare/").matches(branch); }
From source file:eu.annocultor.converters.europeana.EuropeanaSolrDocumentTagger.java
String makeRecordHash(String resolveUri) { if (resolveUri.contains("/")) { resolveUri = StringUtils.substringAfterLast(resolveUri, "/"); }//from w w w .j a va2 s. com return StringUtils.substringBeforeLast(resolveUri, "."); }
From source file:com.adobe.acs.commons.users.impl.AbstractAuthorizable.java
public AbstractAuthorizable(Map<String, Object> config) throws EnsureAuthorizableException { String tmp = PropertiesUtil.toString(config.get(EnsureServiceUser.PROP_PRINCIPAL_NAME), null); if (StringUtils.contains(tmp, "/")) { tmp = StringUtils.removeStart(tmp, getDefaultPath()); tmp = StringUtils.removeStart(tmp, "/"); this.principalName = StringUtils.substringAfterLast(tmp, "/"); this.intermediatePath = PathUtil.makePath(getDefaultPath(), StringUtils.removeEnd(tmp, this.principalName)); } else {// w w w . j a v a2s.c om this.principalName = tmp; this.intermediatePath = getDefaultPath(); } // Check the principal name for validity if (StringUtils.isBlank(this.principalName)) { throw new EnsureAuthorizableException("No Principal Name provided to Ensure Service User"); } else if (ProtectedAuthorizables.isProtected(this.principalName)) { throw new EnsureAuthorizableException(String.format( "[ %s ] is an System User provided by AEM or ACS AEM Commons. You cannot ensure this user.", this.principalName)); } final String[] acesProperty = PropertiesUtil.toStringArray(config.get(EnsureServiceUser.PROP_ACES), new String[0]); for (String entry : acesProperty) { if (StringUtils.isNotBlank(entry)) { try { aces.add(new Ace(entry)); } catch (EnsureAuthorizableException e) { log.warn("Malformed ACE config [ " + entry + " ] for Service User [ " + StringUtils.defaultIfEmpty(this.principalName, "NOT PROVIDED") + " ]", e); } } } }
From source file:com.adobe.acs.commons.users.impl.ServiceUser.java
public ServiceUser(Map<String, Object> config) throws EnsureServiceUserException { String tmp = PropertiesUtil.toString(config.get(EnsureServiceUser.PROP_PRINCIPAL_NAME), null); if (StringUtils.contains(tmp, "/")) { tmp = StringUtils.removeStart(tmp, PATH_SYSTEM_USERS); tmp = StringUtils.removeStart(tmp, "/"); this.principalName = StringUtils.substringAfterLast(tmp, "/"); this.intermediatePath = PathUtil.makePath(PATH_SYSTEM_USERS, StringUtils.removeEnd(tmp, this.principalName)); } else {//from w w w .j a va2s. c om this.principalName = tmp; this.intermediatePath = "/home/users/system"; } // Check the principal name for validity if (StringUtils.isBlank(this.principalName)) { throw new EnsureServiceUserException("No Principal Name provided to Ensure Service User"); } else if (ProtectedSystemUsers.isProtected(this.principalName)) { throw new EnsureServiceUserException(String.format( "[ %s ] is an System User provided by AEM or ACS AEM Commons. You cannot ensure this user.", this.principalName)); } final String[] acesProperty = PropertiesUtil.toStringArray(config.get(EnsureServiceUser.PROP_ACES), new String[0]); for (String entry : acesProperty) { try { aces.add(new Ace(entry)); } catch (EnsureServiceUserException e) { log.warn("Malformed ACE config [ " + entry + " ] for Service User [ " + StringUtils.defaultIfEmpty(this.principalName, "NOT PROVIDED") + " ]", e); } } }
From source file:it.openutils.mgnlaws.magnolia.datastore.S3IdentifierIterator.java
@Override public DataIdentifier next() { S3ObjectSummary summary = iterator.next(); if (summary != null) { return new DataIdentifier(StringUtils.substringAfterLast(summary.getKey(), "/")); }/*ww w.ja v a2s .c o m*/ return null; }
From source file:info.magnolia.cms.util.PathUtil.java
/** * Returns the extension of the file denoted by the path excluding the dot. More specifically returns the part of * the string after the last dot. If there's no dot in the path it returns the empty string. *///from w w w. j a va 2s .c om public static String getExtension(String path) { if (path == null) { return null; } return StringUtils.substringAfterLast(getFileName(path), "."); }
From source file:net.refractions.udig.ui.internal.Messages.java
/** * Find the localized message for the given key. If arguments are given, then the * result message is formatted via {@link MessageFormat}. * * @param locale The locale to use to localize the given message. * @param key//from w w w .ja va2s .c o m * @param args If not null, then the message is formatted via {@link MessageFormat} * @return The message for the given key. */ public static String get(Locale locale, String key, Object... args) { try { // getBundle() caches the bundles ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_NAME, locale, Messages.class.getClassLoader()); if (args == null || args.length == 0) { return bundle.getString(key); } else { String msg = bundle.getString(key); return MessageFormat.format(msg, args); } } catch (Exception e) { return StringUtils.substringAfterLast(key, "_"); } }
From source file:info.magnolia.module.delta.BootstrapSingleResourceAndOrderBefore.java
public BootstrapSingleResourceAndOrderBefore(String name, String description, String resource, String orderBeforeName) { super(name, description); // TODO : these values should be provided by the BootstrapUtil/Helper once MAGNOLIA-1806 is done. String filename = StringUtils.substringAfterLast(resource, "/"); String repository = StringUtils.substringBefore(filename, "."); String path = StringUtils.substringAfter(StringUtils.substringBeforeLast(filename, "."), "."); path = "/" + StringUtils.replace(path, ".", "/"); addTask(new BootstrapSingleResource(name, description, resource)); addTask(new OrderNodeBeforeTask(name, description, repository, path, orderBeforeName)); }
From source file:info.magnolia.module.admininterface.PageMVCServlet.java
/** * */// w w w.j ava2 s . c om protected MVCServletHandler getHandler(HttpServletRequest request, HttpServletResponse response) { String pageName = RequestFormUtil.getParameter(request, "mgnlPage"); //$NON-NLS-1$ if (StringUtils.isEmpty(pageName)) { pageName = (String) request.getAttribute("javax.servlet.include.request_uri"); //$NON-NLS-1$ if (StringUtils.isEmpty(pageName)) { pageName = (String) request.getAttribute("javax.servlet.forward.servlet_path"); //$NON-NLS-1$ } if (StringUtils.isEmpty(pageName)) { pageName = request.getRequestURI(); } pageName = StringUtils.replaceOnce(StringUtils.substringAfterLast(pageName, "/pages/"), ".html", //$NON-NLS-1$ //$NON-NLS-2$ StringUtils.EMPTY); } PageMVCHandler handler = null; if (pageName != null) { // try to get a registered handler try { handler = PageHandlerManager.getInstance().getPageHandler(pageName, request, response); } catch (InvalidDialogPageHandlerException e) { log.error("no page found: [" + pageName + "]"); //$NON-NLS-1$ } } else { log.error("no dialogpage name passed"); //$NON-NLS-1$ } return handler; }