Example usage for com.liferay.portal.kernel.util LocalizationUtil deserialize

List of usage examples for com.liferay.portal.kernel.util LocalizationUtil deserialize

Introduction

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

Prototype

public static Object deserialize(JSONObject jsonObject) 

Source Link

Usage

From source file:com.liferay.exportimport.resources.importer.internal.util.FileSystemImporter.java

License:Open Source License

protected Map<Locale, String> getMap(JSONObject layoutJSONObject, String name) {

    Map<Locale, String> map = new HashMap<>();

    JSONObject jsonObject = layoutJSONObject.getJSONObject(name.concat("Map"));

    if (jsonObject != null) {
        map = (Map<Locale, String>) LocalizationUtil.deserialize(jsonObject);

        if (!map.containsKey(LocaleUtil.getDefault())) {
            Collection<String> values = map.values();

            Iterator<String> iterator = values.iterator();

            map.put(LocaleUtil.getDefault(), iterator.next());
        }/*from w  w w  .  ja va 2 s  .  co  m*/
    } else {
        String value = layoutJSONObject.getString(name);

        map.put(LocaleUtil.getDefault(), value);
    }

    return map;
}

From source file:com.liferay.resourcesimporter.util.FileSystemImporter.java

License:Open Source License

protected Map<Locale, String> getMap(JSONObject layoutJSONObject, String name) {

    Map<Locale, String> map = new HashMap<Locale, String>();

    JSONObject jsonObject = layoutJSONObject.getJSONObject(name.concat("Map"));

    if (jsonObject != null) {
        map = (Map<Locale, String>) LocalizationUtil.deserialize(jsonObject);

        if (!map.containsKey(LocaleUtil.getDefault())) {
            Collection<String> values = map.values();

            Iterator<String> iterator = values.iterator();

            map.put(LocaleUtil.getDefault(), iterator.next());
        }/* w  ww  . jav  a  2 s.c  om*/
    } else {
        String value = layoutJSONObject.getString(name);

        map.put(LocaleUtil.getDefault(), value);
    }

    return map;
}