當前位置: 首頁>>代碼示例>>Java>>正文


Java AssetCategory類代碼示例

本文整理匯總了Java中com.liferay.asset.kernel.model.AssetCategory的典型用法代碼示例。如果您正苦於以下問題:Java AssetCategory類的具體用法?Java AssetCategory怎麽用?Java AssetCategory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AssetCategory類屬於com.liferay.asset.kernel.model包,在下文中一共展示了AssetCategory類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: displayTerm

import com.liferay.asset.kernel.model.AssetCategory; //導入依賴的package包/類
@Override
public String displayTerm(HttpServletRequest request, FacetConfiguration facetConfiguration, String queryTerm) {
    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
    Locale locale = themeDisplay.getLocale();
    try {
        AssetCategory assetCategory = assetCategoryService.getCategory(Long.parseLong(queryTerm));
        return assetCategory.getTitle(locale);
    } catch (PortalException e) {
        LOG.warn("Could not retrieve AssetCategory from id [" + queryTerm + "]", e);
        return queryTerm;
    }
}
 
開發者ID:savoirfairelinux,項目名稱:flashlight-search,代碼行數:13,代碼來源:AssetCategoriesSearchFacetDisplayHandler.java

示例2: getCategoryList

import com.liferay.asset.kernel.model.AssetCategory; //導入依賴的package包/類
/**
 * 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();
}
 
開發者ID:yasuflatland-lf,項目名稱:liferay-dummy-factory,代碼行數:45,代碼來源:CategoryMVCResourceCommand.java


注:本文中的com.liferay.asset.kernel.model.AssetCategory類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。