【问题标题】:adding category to new created journal article in liferay在 liferay 中为新创建的期刊文章添加类别
【发布时间】:2014-06-10 13:14:51
【问题描述】:

我正在尝试将类别添加到新创建的文章中。我的代码在这里:

ServiceContext serviceContext = ServiceContextFactory.getInstance(
    JournalArticle.class.getName(), 
    actionRequest
);
article = JournalArticleLocalServiceUtil.addArticle(
    ImporterConstants.IMPORTER_ID, 
    ImporterConstants.GROUP_ID, 
    ImporterConstants.DOC_FOLDER_ID,
    titleMap, 
    descMap, 
    content, 
    structureID, 
    templateID, 
    serviceContext
);
AssetEntry ae = AssetEntryLocalServiceUtil.fetchEntry(
    JournalArticle.class.getName(), 
    article.getResourcePrimKey()
); //returns AssetEntry
AssetEntryLocalServiceUtil.addAssetCategoryAssetEntry(48183, ae);

文章创建没有问题,但是当我尝试调用时

 AssetEntryLocalServiceUtil.addAssetCategoryAssetEntry(48183, ae)

AssetCategoryLocalServiceUtil.addAssetEntryAssetCategory(ae.getEntryId(), 48183)

它不会带来任何结果,并且表assetentries_assetcategories 没有任何变化。编号 48183 是 categoryidfrom 表 `assetcategory。

你能告诉我哪里有问题吗? PS:我使用的是Liferay Portal Community Edition 6.2.0 CE GA1

谢谢

【问题讨论】:

    标签: liferay-6


    【解决方案1】:

    尝试使用所需的类别 ID 更新文章资产条目

    AssetEntry updateEntry(
            long userId, long groupId, String className, long classPK,
            String classUuid, long classTypeId, long[] categoryIds,
            String[] tagNames, boolean visible, Date startDate, Date endDate,
            Date publishDate, Date expirationDate, String mimeType,
            String title, String description, String summary, String url,
            String layoutUuid, int height, int width, Integer priority,
            boolean sync)
        throws PortalException, SystemException
    
    
    assetEntryLocalService.updateEntry(
                userId, entry.getGroupId(), JournalArticle.class.getName(),
                entry.getEntryId(), entry.getUuid(), 0, assetCategoryIds,
                assetTagNames, visible, null, null, entry.getDisplayDate(), null,
                ContentTypes.TEXT_HTML, entry.getTitle(), null, summary, null, null,
                0, 0, null, false);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-22
      • 2013-01-18
      • 2015-02-21
      • 2019-08-11
      • 2014-09-01
      • 2018-03-14
      • 2015-11-14
      • 1970-01-01
      相关资源
      最近更新 更多