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

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

Introduction

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

Prototype

public static String substringAfterLast(String str, String separator) 

Source Link

Document

Gets the substring after the last occurrence of a separator.

Usage

From source file:edu.mayo.cts2.framework.plugin.service.bprdf.dao.id.ValueSetName.java

/**
 * Parses the.//from w  w w.j ava2  s .c o m
 *
 * @param name the name
 * @return the code system name
 */
public static ValueSetName parse(String name) {
    String acronym = StringUtils.substringBeforeLast(name, SEPARATOR);
    String ontologyId = StringUtils.substringAfterLast(name, SEPARATOR);

    return new ValueSetName(acronym, ontologyId);
}

From source file:edu.mayo.cts2.framework.plugin.service.bprdf.dao.id.CodeSystemVersionName.java

/**
 * Parses the.//from   w w w .j a va2s. com
 *
 * @param name the name
 * @return the code system version name
 */
public static CodeSystemVersionName parse(String name) {
    String acronym = StringUtils.substringBeforeLast(name, SEPARATOR);
    String id = StringUtils.substringAfterLast(name, SEPARATOR);

    return new CodeSystemVersionName(acronym, id);
}

From source file:edu.mayo.cts2.framework.plugin.service.bprdf.util.UriUtils.java

/**
 * Gets the namespace name tuple.//from w ww.  j  a v a 2 s  .c o  m
 * The first element in the array will be the name
 * The seconed element in the array wil be the namespace uri
 *
 * @param uri the uri
 * @return the namespace name tuple
 */
public static String[] getNamespaceNameTuple(String uri) {
    String name;
    String namespace;

    int splitPoint = Util.splitNamespace(uri);

    if (splitPoint == uri.length()) {
        name = StringUtils.substringAfterLast(uri, "/");
        namespace = StringUtils.substringBeforeLast(uri, "/") + "/";
    } else {
        namespace = uri.substring(0, splitPoint);
        name = uri.substring(splitPoint);
    }

    if (StringUtils.isBlank(name) || StringUtils.isBlank(namespace)) {
        throw new UriParseException(uri);
    } else {
        return new String[] { name, namespace };
    }
}

From source file:com.spotify.docker.CompositeImageName.java

/**
 * An image name can be a plain image name or in the composite format <name>:<tag&gt and
 * this factory method makes sure that we get the plain image name as well as all the desired tags
 * for an image, including any composite tag.
 *///  w  w w  . ja v  a2  s. com
static CompositeImageName create(final String imageName, final List<String> imageTags)
        throws MojoExecutionException {

    final String name = StringUtils.substringBeforeLast(imageName, ":");
    if (StringUtils.isBlank(name)) {
        throw new MojoExecutionException("imageName not set!");
    }

    final List<String> tags = new ArrayList<>();
    final String tag = StringUtils.substringAfterLast(imageName, ":");
    if (StringUtils.isNotBlank(tag)) {
        tags.add(tag);
    }
    if (imageTags != null) {
        tags.addAll(imageTags);
    }
    if (tags.size() == 0) {
        throw new MojoExecutionException("No tag included in imageName and no imageTags set!");
    }
    return new CompositeImageName(name, tags);
}

From source file:com.example.NoJcrPropertyModel.java

private String createLabel(final String path) {
    String result = StringUtils.substringAfterLast(path, "/");
    result = StringUtils.substringBeforeLast(result, ".");
    return WordUtils.capitalize(result);
}

From source file:es.urjc.mctwp.image.impl.collection.fs.ImageContentFileFilter.java

@Override
public boolean accept(File pathname) {
    String ext = StringUtils.substringAfterLast(pathname.getName(), FilenameUtils.EXTENSION_SEPARATOR_STR);
    return (ext == null) ? false : (!ext.equals(ThumbNail.TBN_EXT));
}

From source file:com.evolveum.midpoint.provisioning.ucf.api.UcfUtil.java

public static void addConnectorNames(ConnectorType connectorType, String frameworkPrefix, String bundle,
        String type, String version, ConnectorHostType hostType) {
    StringBuilder connectorName = new StringBuilder();
    connectorName.append(frameworkPrefix).append(" ");
    connectorName.append(type);//w ww  . j  av a  2  s.c  o  m
    connectorName.append(" v");
    connectorName.append(version);
    StringBuilder displayName = new StringBuilder(StringUtils.substringAfterLast(type, "."));
    if (hostType != null) {
        connectorName.append(" @");
        connectorName.append(hostType.getName());
        displayName.append(" @");
        displayName.append(hostType.getName());
    }
    connectorType.setName(new PolyStringType(connectorName.toString()));
    connectorType.setDisplayName(new PolyStringType(displayName.toString()));
}

From source file:hr.fer.spocc.util.BasePropertyConstants.java

/**
 * Returns the relative name of the property; for example, relative
 * name of the "some.example" is "example", but relative name
 * of the "test" is again "test".//  w w w.j  a  v  a2  s  . c  om
 * 
 * @param propertyName apsolute or relative name
 * @return relative name
 */
protected static String relativePropertyName(String propertyName) {
    if (!propertyName.contains(SEPARATOR))
        return propertyName;
    return StringUtils.substringAfterLast(propertyName, SEPARATOR);
}

From source file:hudson.plugins.sonar.client.HttpClient.java

public String getHttp(String url, String usernameOrToken, String password) throws Exception {
    String baseUrl = StringUtils.substringBeforeLast(url, "/");
    String path = StringUtils.substringAfterLast(url, "/");
    HttpConnector httpConnector = HttpConnector.newBuilder().userAgent("Scanner for Jenkins").url(baseUrl)
            .credentials(usernameOrToken, password).build();
    WsResponse response = httpConnector.call(new GetRequest(path));
    return response.content();

}

From source file:ch.algotrader.cache.EntityCacheSubKey.java

public EntityCacheSubKey(BaseEntityI entity, String roleName) {

    super(entity);
    this.key = StringUtils.substringAfterLast(roleName, ".");
}