protected void exportAssetCategories(PortletDataContext portletDataContext) throws Exception { Document document = SAXReaderUtil.createDocument(); Element rootElement = document.addElement("categories-hierarchy"); Element assetVocabulariesElement = rootElement.addElement("vocabularies"); List<AssetVocabulary> assetVocabularies = AssetVocabularyLocalServiceUtil.getGroupVocabularies(portletDataContext.getGroupId()); for (AssetVocabulary assetVocabulary : assetVocabularies) { _portletExporter.exportAssetVocabulary( portletDataContext, assetVocabulariesElement, assetVocabulary); } Element categoriesElement = rootElement.addElement("categories"); List<AssetCategory> assetCategories = AssetCategoryUtil.findByGroupId(portletDataContext.getGroupId()); for (AssetCategory assetCategory : assetCategories) { _portletExporter.exportAssetCategory( portletDataContext, assetVocabulariesElement, categoriesElement, assetCategory); } _portletExporter.exportAssetCategories(portletDataContext, rootElement); portletDataContext.addZipEntry( portletDataContext.getRootPath() + "/categories-hierarchy.xml", document.formattedString()); }
protected void exportAssetCategories( PortletDataContext portletDataContext, boolean exportPortletDataAll, boolean exportCategories, boolean companyGroup) throws Exception { Document document = SAXReaderUtil.createDocument(); Element rootElement = document.addElement("categories-hierarchy"); if (exportPortletDataAll || exportCategories || companyGroup) { if (_log.isDebugEnabled()) { _log.debug("Export categories"); } Element assetVocabulariesElement = rootElement.addElement("vocabularies"); List<AssetVocabulary> assetVocabularies = AssetVocabularyLocalServiceUtil.getGroupVocabularies(portletDataContext.getGroupId()); for (AssetVocabulary assetVocabulary : assetVocabularies) { _portletExporter.exportAssetVocabulary( portletDataContext, assetVocabulariesElement, assetVocabulary); } Element categoriesElement = rootElement.addElement("categories"); List<AssetCategory> assetCategories = AssetCategoryUtil.findByGroupId(portletDataContext.getGroupId()); for (AssetCategory assetCategory : assetCategories) { _portletExporter.exportAssetCategory( portletDataContext, assetVocabulariesElement, categoriesElement, assetCategory); } } _portletExporter.exportAssetCategories(portletDataContext, rootElement); portletDataContext.addZipEntry( ExportImportPathUtil.getRootPath(portletDataContext) + "/categories-hierarchy.xml", document.formattedString()); }