protected void setDDMStructure() throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY); _ddmStructureDisplayFieldValue = StringPool.BLANK; _ddmStructureFieldLabel = StringPool.BLANK; _ddmStructureFieldName = StringPool.BLANK; _ddmStructureFieldValue = null; long[] classNameIds = getClassNameIds(); long[] classTypeIds = getClassTypeIds(); if (isSubtypeFieldsFilterEnabled() && (classNameIds.length == 1) && (classTypeIds.length == 1)) { _ddmStructureDisplayFieldValue = GetterUtil.getString( _portletPreferences.getValue("ddmStructureDisplayFieldValue", StringPool.BLANK)); _ddmStructureFieldName = GetterUtil.getString( _portletPreferences.getValue("ddmStructureFieldName", StringPool.BLANK)); _ddmStructureFieldValue = _portletPreferences.getValue("ddmStructureFieldValue", StringPool.BLANK); if (Validator.isNotNull(_ddmStructureFieldName) && Validator.isNotNull(_ddmStructureFieldValue)) { AssetRendererFactory assetRendererFactory = AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName( PortalUtil.getClassName(classNameIds[0])); Tuple classTypeFieldName = assetRendererFactory.getClassTypeFieldName( classTypeIds[0], _ddmStructureFieldName, themeDisplay.getLocale()); _ddmStructureFieldLabel = (String) classTypeFieldName.getObject(0); } } }
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; }