CategoryMVCResourceCommand.java 文件源码

java
阅读 16 收藏 0 点赞 0 评论 0

项目:liferay-dummy-factory 作者:
/**
 * Get Category list
 * 
 * @param resourceRequest
 * @param resourceResponse
 * @return
 * @throws PortalException
 */
private String getCategoryList(ResourceRequest resourceRequest, ResourceResponse resourceResponse)
        throws PortalException {

    JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

    long vocabularyId = ParamUtil.getLong(resourceRequest, "vocabularyId",0);

    if (_log.isDebugEnabled()) {
        _log.debug("Vocabulary Id <" + String.valueOf(vocabularyId) + ">");
    }

    List<AssetCategory> categories = 
        _assetCategoryLocalService.getVocabularyCategories(
            vocabularyId,
            QueryUtil.ALL_POS,
            QueryUtil.ALL_POS,
            null
        );

    for (AssetCategory category : categories) {
        JSONObject curUserJSONObject = JSONFactoryUtil.createJSONObject();

        if (_log.isDebugEnabled()) {
            _log.debug("Category name <" + category.getName() + ">");
            _log.debug(category.toString());
            _log.debug("----------");
        }

        curUserJSONObject.put("categoryId", category.getCategoryId());
        curUserJSONObject.put("categoryName", category.getName());

        jsonArray.put(curUserJSONObject);
    }

    return jsonArray.toJSONString();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号