Example usage for com.liferay.portal.kernel.model ModelHintsUtil trimString

List of usage examples for com.liferay.portal.kernel.model ModelHintsUtil trimString

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.model ModelHintsUtil trimString.

Prototype

public static String trimString(String model, String field, String value) 

Source Link

Usage

From source file:com.liferay.blogs.util.BlogsUtil.java

License:Open Source License

public static String getUrlTitle(long entryId, String title) {
    if (title == null) {
        return String.valueOf(entryId);
    }/*from  w  w  w. j  a  v  a2 s .  c o  m*/

    title = StringUtil.toLowerCase(title.trim());

    if (Validator.isNull(title) || Validator.isNumber(title) || title.equals("rss")) {

        title = String.valueOf(entryId);
    } else {
        title = FriendlyURLNormalizerUtil.normalizeWithPeriodsAndSlashes(title);
    }

    return ModelHintsUtil.trimString(BlogsEntry.class.getName(), "urlTitle", title);
}

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

License:Open Source License

public static String getUrlTitle(long id, String title) {
    if (title == null) {
        return String.valueOf(id);
    }//from w  w w .  j  a v  a  2  s .c o  m

    title = StringUtil.toLowerCase(title.trim());

    if (Validator.isNull(title) || Validator.isNumber(title) || title.equals("rss")) {

        title = String.valueOf(id);
    } else {
        title = FriendlyURLNormalizerUtil.normalizeWithPeriodsAndSlashes(title);
    }

    return ModelHintsUtil.trimString(JournalArticle.class.getName(), "urlTitle", title);
}