Example usage for com.liferay.portal.kernel.util StringUtil removeFromList

List of usage examples for com.liferay.portal.kernel.util StringUtil removeFromList

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util StringUtil removeFromList.

Prototype

public static String removeFromList(String s, String element) 

Source Link

Document

Removes the remove string from string s that represents a list of comma delimited strings.

Usage

From source file:com.liferay.journal.util.impl.JournalUtil.java

License:Open Source License

public static String removeArticleLocale(Document document, String content, String languageId) {

    try {//  ww w .j  a va 2s. c  om
        Element rootElement = document.getRootElement();

        String availableLocales = rootElement.attributeValue("available-locales");

        if (availableLocales == null) {
            return content;
        }

        availableLocales = StringUtil.removeFromList(availableLocales, languageId);

        if (availableLocales.endsWith(",")) {
            availableLocales = availableLocales.substring(0, availableLocales.length() - 1);
        }

        rootElement.addAttribute("available-locales", availableLocales);

        removeArticleLocale(rootElement, languageId);

        content = XMLUtil.formatXML(document);
    } catch (Exception e) {
        _log.error(e, e);
    }

    return content;
}