Example usage for com.liferay.portal.kernel.util TextFormatter formatName

List of usage examples for com.liferay.portal.kernel.util TextFormatter formatName

Introduction

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

Prototype

public static String formatName(String name) 

Source Link

Usage

From source file:com.inikah.slayer.service.impl.MyKeyValueLocalServiceImpl.java

License:Open Source License

public List<KeyValuePair> getItemsForFilter(boolean bride, String column, long parentId, String parentColumn) {
    List<MyKeyValue> items = myKeyValueFinder.findResults(bride, column, parentId, parentColumn);

    List<KeyValuePair> kvPairs = new ArrayList<KeyValuePair>();
    for (MyKeyValue myKeyValue : items) {

        long key = myKeyValue.getMyKey();

        String name = LanguageUtil.get(Locale.ENGLISH, myKeyValue.getMyName());
        if (column.contains("ountry")) {
            name = TextFormatter.formatName(name);
        }//from   w w w  . j av  a 2  s.co m

        StringBuilder sb = new StringBuilder(name);
        sb.append(StringPool.SPACE);
        sb.append(StringPool.OPEN_PARENTHESIS);
        sb.append(myKeyValue.getMyValue());
        sb.append(StringPool.CLOSE_PARENTHESIS);
        kvPairs.add(new KeyValuePair(String.valueOf(key), sb.toString()));
    }

    return ListUtil.sort(kvPairs, new KeyValuePairComparator(false, true));
}