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

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

Introduction

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

Prototype

public static int lastIndexOf(String str, String searchStr) 

Source Link

Document

Finds the last index within a String, handling null.

Usage

From source file:pt.webdetails.cpf.repository.pentaho.PentahoLegacySolutionAccess.java

@Override
public boolean createFolder(String path, boolean isHidden) { // TODO: shouldn't this be recursive?
    path = StringUtils.chomp(path, "/"); // strip trailing / if there
    String folderName = FilenameUtils.getBaseName(getPath(path));
    String folderPath = getPath(path).substring(0, StringUtils.lastIndexOf(getPath(path), folderName));

    try {/*from w ww. j  a  v  a2 s  .  co  m*/
        if (getRepositoryService().createFolder(userSession, "", folderPath, folderName, "")) {
            if (isHidden) {
                String indexContent = "<index><name>" + folderName + "</name><description></description>"
                        + "<icon>reporting.png</icon><visible>false</visible><display-type>list</display-type></index>";

                String repositoryBaseURL = PentahoSystem.getApplicationContext().getSolutionPath("");
                getRepository().addSolutionFile(repositoryBaseURL, folderName,
                        ISolutionRepository.INDEX_FILENAME, indexContent.getBytes(), true);
            }
            return true;
        } else {
            return false;
        }

    } catch (IOException ex) {
        logger.error(ex);
        return false;
    }
}

From source file:technology.tikal.gae.http.cache.AbstractCacheController.java

public String getResourseUri(String currentUri, CacheAction action) {
    if (action == CacheAction.UPDATE || action == CacheAction.DELETE) {
        return currentUri.substring(0, StringUtils.lastIndexOf(currentUri, '/'));
    }/* w  w  w .j  ava 2  s  . c o  m*/
    return currentUri;
}