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:org.ebayopensource.turmeric.eclipse.codegen.utils.CodeGenUtil.java

/**
 * Extracts the GIN value from the service interface name. Acts as a domain
 * wrapper over string utility class//w w  w.j  a v  a2s . c  o  m
 *
 * @param serviceInterface the service interface
 * @return the gIN from interface
 */
public static String getGINFromInterface(String serviceInterface) {
    return StringUtils.substringAfterLast(serviceInterface, ".");
}

From source file:org.ebayopensource.turmeric.eclipse.errorlibrary.ui.components.ErrorSelector.java

@Override
protected boolean validateCurrentSelection() {
    IStatus status = new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK, "", //$NON-NLS-1$
            null);/*from  w  w  w .j  a  v  a2s . c o  m*/
    if (super.validateCurrentSelection()) {

        for (ISOAError error : getCurrentSelection()) {
            String errorLibrary = error.getDomain().getLibrary().getName();
            IProject errorLibProject = WorkspaceUtil.getProject(errorLibrary);
            // first check if there is a workspace project with the same
            // name
            // and with soa error lib nature
            if (errorLibProject != null && errorLibProject.isAccessible() && isErrorLibrary(errorLibProject)) {
                // this is fine, there is an error lib project with the same
                // name in workspace
            } else {
                // finding out if the jar is exists in repo.
                String location = "";
                try {
                    location = GlobalRepositorySystem.instanceOf().getActiveRepositorySystem()
                            .getAssetRegistry().getAssetLocation(errorLibrary);
                    if (StringUtils.isEmpty(location)
                            || !StringUtils.equalsIgnoreCase(SOAProjectConstants.FILE_EXTENSION_JAR,
                                    StringUtils.substringAfterLast(location, "."))) {
                        status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR,
                                StringUtil.formatString(SOAMessages.LIBRARY_NOT_BUILT_ERR_MSG, errorLibrary),
                                null);

                        updateStatus(status);
                    }
                } catch (Exception e) {
                    status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR,
                            SOAMessages.LIBRARY_NOT_BUILT_ERR_MSG + errorLibrary, null);
                    updateStatus(status);

                }

            }
        }
    }
    return status.isOK();
}

From source file:org.ebayopensource.turmeric.eclipse.resources.util.SOAClientConfigUtil.java

private static String getServiceNameFromClientConfigServiceName(String serviceName) {
    // this has bracket {namespace}serviceName
    if (StringUtils.lastIndexOf(serviceName, "}") != -1) {
        return StringUtils.substringAfterLast(serviceName, "}");
    }//from   w w w.  j  a v  a2s . co m
    return serviceName;
}

From source file:org.ebayopensource.turmeric.eclipse.typelibrary.ui.TypeLibraryUtil.java

/**
 * Gets the type name from protocol string.
 *
 * @param typeLibString the type lib string
 * @return the type name from protocol string
 *///from   w  ww.  jav  a2  s.  com
public static String getTypeNameFromProtocolString(String typeLibString) {
    String retValue = null;
    if (!StringUtils.isEmpty(typeLibString)
            && typeLibString.startsWith(SOATypeLibraryConstants.TURMERIC_XSD_FILE_PROTOCOL)) {

        // removing type lib start string
        retValue = StringUtils.substringAfterLast(typeLibString, SOATypeLibraryConstants.PROTOCOL_DELIMITER);

        // removing xsd extn end string
        retValue = StringUtils.substringBeforeLast(retValue, SOATypeLibraryConstants.EXT_XSD);
    }
    return retValue;

}

From source file:org.ebayopensource.turmeric.eclipse.typelibrary.ui.TypeLibraryUtil.java

/**
 * Gets the type name from xsd schema location.
 *
 * @param schemaLocation the schema location
 * @return the type name from xsd schema location
 *///  ww w  .jav a2 s.  c om
public static String getTypeNameFromXSDSchemaLocation(String schemaLocation) {
    return getXsdTypeNameFromFileName(StringUtils.substringAfterLast(schemaLocation, "/"));
}

From source file:org.ebayopensource.turmeric.eclipse.typelibrary.ui.TypeLibraryUtil.java

/**
 * Checks if is new style base location.
 *
 * @param baseLocationStr the base location str
 * @return true, if is new style base location
 *//*from  w w  w  .j a va  2 s . co m*/
public static boolean isNewStyleBaseLocation(String baseLocationStr) {
    return !(StringUtils.countMatches(
            StringUtils.substringAfterLast(baseLocationStr, SOATypeLibraryConstants.FOLDER_META_SRC_TYPES),
            WorkspaceUtil.PATH_SEPERATOR) == 1);
}

From source file:org.ebayopensource.turmeric.eclipse.typelibrary.utils.XSDDeltaVisitor.java

/**
 * {@inheritDoc}//from   w w w .jav  a2 s  .co m
 */
@Override
public boolean visit(IResourceDelta delta) throws CoreException {
    if (StringUtils.equalsIgnoreCase(StringUtils.substringAfterLast(delta.getFullPath().toString(), "."),
            "xsd")) {
        xsdFile = (IFile) delta.getResource();
        return false;
    }
    return true;
}

From source file:org.ebayopensource.turmeric.eclipse.utils.wsdl.WSDLUtil.java

private static String[] getParentFolder(String fullFileName) {
    String[] result = new String[2];
    final String slash = "/";
    if (StringUtils.isNotBlank(fullFileName)) {
        fullFileName = StringUtils.replaceChars(fullFileName, File.separator, slash);
        result[0] = fullFileName.indexOf(slash) >= 0 ? StringUtils.substringBeforeLast(fullFileName, slash)
                : "";
        result[1] = StringUtils.substringAfterLast(fullFileName, "/");
    }//  w w w  . ja v a2  s  .c  o m
    return result;
}

From source file:org.eclipse.buildship.docs.formatting.LinkRenderer.java

private Node addType(String className, GenerationListener listener) {
    //        if (model.isKnownType(className)) {
    //            Element linkElement = document.createElement("apilink");
    //            linkElement.setAttribute("class", className);
    //            return linkElement;
    //        }/*from   w ww .  j a  va 2s.c  om*/

    if (primitiveTypes.contains(className)) {
        Element classNameElement = document.createElement(TAG_NAME);
        classNameElement.appendChild(document.createTextNode(className));
        return classNameElement;
    }

    if (className.startsWith("java.")) {
        Element linkElement = document.createElement("ulink");
        linkElement.setAttribute("url", String.format(
                "http://download.oracle.com/javase/1.5.0/docs/api/%s.html", className.replace(".", "/")));
        Element classNameElement = document.createElement("classname");
        classNameElement.appendChild(document.createTextNode(StringUtils.substringAfterLast(className, ".")));
        linkElement.appendChild(classNameElement);
        return linkElement;
    }

    if (className.startsWith("groovy.")) {
        Element linkElement = document.createElement("ulink");
        linkElement.setAttribute("url",
                String.format("http://groovy.codehaus.org/gapi/%s.html", className.replace(".", "/")));
        Element classNameElement = document.createElement(TAG_NAME);
        classNameElement.appendChild(document.createTextNode(StringUtils.substringAfterLast(className, ".")));
        linkElement.appendChild(classNameElement);
        return linkElement;
    }

    //this if is a bit cheesy but 1-letter classname surely means a generic type and the warning will be useless
    if (className.length() > 1) {
        listener.warning(String.format("Could not generate link for unknown class '%s'", className));
    }
    Element element = document.createElement(TAG_NAME);
    element.appendChild(document.createTextNode(className));
    return element;
}

From source file:org.eclipse.buildship.docs.source.model.ClassMetaData.java

public String getSimpleName() {
    return StringUtils.substringAfterLast(className, ".");
}