Example usage for com.liferay.portal.kernel.json JSONObject getInt

List of usage examples for com.liferay.portal.kernel.json JSONObject getInt

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.json JSONObject getInt.

Prototype

public int getInt(String key, int defaultValue);

Source Link

Usage

From source file:com.liferay.layout.internal.util.LayoutsTreeImpl.java

License:Open Source License

private int _getLoadedLayoutsCount(HttpSession session, long groupId, boolean privateLayout, long layoutId,
        String treeId) throws Exception {

    StringBundler sb = new StringBundler(7);

    sb.append(treeId);/*from  w ww .  ja v a 2s  .c  o  m*/
    sb.append(StringPool.COLON);
    sb.append(groupId);
    sb.append(StringPool.COLON);
    sb.append(privateLayout);
    sb.append(StringPool.COLON);
    sb.append("Pagination");

    String key = sb.toString();

    String paginationJSON = SessionClicks.get(session, key, JSONFactoryUtil.getNullJSON());

    JSONObject paginationJSONObject = JSONFactoryUtil.createJSONObject(paginationJSON);

    if (_log.isDebugEnabled()) {
        sb = new StringBundler(9);

        sb.append("_getLoadedLayoutsCount(key=");
        sb.append(key);
        sb.append(", layoutId=");
        sb.append(layoutId);
        sb.append(", paginationJSON=");
        sb.append(paginationJSON);
        sb.append(", paginationJSONObject");
        sb.append(paginationJSONObject);
        sb.append(StringPool.CLOSE_PARENTHESIS);

        _log.debug(sb.toString());
    }

    return paginationJSONObject.getInt(String.valueOf(layoutId), 0);
}