public String[] getAllAssetTagNames() throws Exception { if (_allAssetTagNames == null) { ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY); _allAssetTagNames = new String[0]; String selectionStyle = getSelectionStyle(); if (selectionStyle.equals("dynamic")) { _allAssetTagNames = AssetPublisherUtil.getAssetTagNames( _portletPreferences, themeDisplay.getScopeGroupId()); } String assetTagName = ParamUtil.getString(_request, "tag"); if (Validator.isNotNull(assetTagName)) { if (selectionStyle.equals("manual")) { _allAssetTagNames = ArrayUtil.append(_allAssetTagNames, assetTagName); } } if (isMergeURLTags() || isMergeLayoutTags()) { _allAssetTagNames = ArrayUtil.append(_allAssetTagNames, getCompilerTagNames()); } _allAssetTagNames = ArrayUtil.distinct(_allAssetTagNames, new StringComparator()); } return _allAssetTagNames; }
public long[] getClassNameIds() { if (_classNameIds == null) { _classNameIds = AssetPublisherUtil.getClassNameIds(_portletPreferences, getAvailableClassNameIds()); } return _classNameIds; }
public long[] getGroupIds() { if (_groupIds == null) { ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY); _groupIds = AssetPublisherUtil.getGroupIds( _portletPreferences, themeDisplay.getScopeGroupId(), themeDisplay.getLayout()); } return _groupIds; }
protected static List<AssetEntry> getAssetEntries( PortletRequest portletRequest, PortletPreferences portletPreferences) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); int rssDelta = GetterUtil.getInteger(portletPreferences.getValue("rssDelta", "20")); return AssetPublisherUtil.getAssetEntries( portletPreferences, themeDisplay.getLayout(), themeDisplay.getScopeGroupId(), rssDelta, true); }
public long[] getAllAssetCategoryIds() throws Exception { if (_allAssetCategoryIds == null) { _allAssetCategoryIds = new long[0]; String selectionStyle = getSelectionStyle(); if (selectionStyle.equals("dynamic")) { _allAssetCategoryIds = AssetPublisherUtil.getAssetCategoryIds(_portletPreferences); } long assetCategoryId = ParamUtil.getLong(_request, "categoryId"); if (assetCategoryId > 0) { if (selectionStyle.equals("manual")) { _allAssetCategoryIds = ArrayUtil.append(_allAssetCategoryIds, assetCategoryId); } } } return _allAssetCategoryIds; }
public AssetEntryQuery getAssetEntryQuery() throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY); long[] groupIds = getGroupIds(); if (!ArrayUtil.contains(groupIds, themeDisplay.getScopeGroupId())) { groupIds = ArrayUtil.append(groupIds, themeDisplay.getScopeGroupId()); } AssetEntryQuery assetEntryQuery = AssetPublisherUtil.getAssetEntryQuery(_portletPreferences, groupIds); long[] classNameIds = getClassNameIds(); long[] classTypeIds = getClassTypeIds(); if (isSubtypeFieldsFilterEnabled() && (classNameIds.length == 1) && (classTypeIds.length == 1) && Validator.isNotNull(getDDMStructureFieldName()) && Validator.isNotNull(getDDMStructureFieldValue())) { AssetRendererFactory assetRendererFactory = AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName( PortalUtil.getClassName(classNameIds[0])); Tuple classTypeFieldName = assetRendererFactory.getClassTypeFieldName( classTypeIds[0], getDDMStructureFieldName(), themeDisplay.getLocale()); long ddmStructureId = GetterUtil.getLong(classTypeFieldName.getObject(3)); assetEntryQuery.setAttribute( "ddmStructureFieldName", DDMIndexerUtil.encodeName( ddmStructureId, getDDMStructureFieldName(), themeDisplay.getLocale())); assetEntryQuery.setAttribute("ddmStructureFieldValue", getDDMStructureFieldValue()); } AssetPublisherUtil.processAssetEntryQuery( themeDisplay.getUser(), _portletPreferences, assetEntryQuery); assetEntryQuery.setAllCategoryIds(getAllAssetCategoryIds()); if (hasLayoutGroup(groupIds)) { assetEntryQuery.setAllTagIds( AssetTagLocalServiceUtil.getTagIds(groupIds, getAllAssetTagNames())); } else { assetEntryQuery.setAllTagIds( AssetTagLocalServiceUtil.getTagIds(getGroupIds(), getAllAssetTagNames())); } assetEntryQuery.setClassTypeIds(classTypeIds); assetEntryQuery.setEnablePermissions(isEnablePermissions()); assetEntryQuery.setExcludeZeroViewCount(isExcludeZeroViewCount()); String portletName = getPortletName(); if (!portletName.equals(PortletKeys.RELATED_ASSETS)) { assetEntryQuery.setGroupIds(getGroupIds()); } if (isShowOnlyLayoutAssets()) { assetEntryQuery.setLayout(themeDisplay.getLayout()); } if (portletName.equals(PortletKeys.RELATED_ASSETS)) { AssetEntry layoutAssetEntry = (AssetEntry) _request.getAttribute(WebKeys.LAYOUT_ASSET_ENTRY); if (layoutAssetEntry != null) { assetEntryQuery.setLinkedAssetEntryId(layoutAssetEntry.getEntryId()); } } assetEntryQuery.setPaginationType(getPaginationType()); assetEntryQuery.setOrderByCol1(getOrderByColumn1()); assetEntryQuery.setOrderByCol2(getOrderByColumn2()); assetEntryQuery.setOrderByType1(getOrderByType1()); assetEntryQuery.setOrderByType2(getOrderByType2()); return assetEntryQuery; }