【问题标题】:Custom asset is not visible in Asset Publisher portlet自定义资产在 Asset Publisher portlet 中不可见
【发布时间】:2014-08-17 07:34:00
【问题描述】:

我的自定义资产在 Asset Publisher 中不可见。我根据this 指南创建了portlet 和服务层。所以我有Location 模型。创建或更新location后我更新条目:

public void addLocation(ActionRequest request, ActionResponse response)
            throws Exception {

        Location location = _updateLocation(request);
        User user = PortalUtil.getUser(request);
            AssetEntryLocalServiceUtil.updateEntry(user.getUserId(),
                PortalUtil.getScopeGroupId(request), Location.class.getName(),
                location.getLocationId(), new long[0], new String[] { "mycat1",
                        "mucat2" });
        sendRedirect(request, response);
    }

AssetEntry 存储在数据库中:

SELECT entryid, groupid, companyid, userid, username, createdate, modifieddate, 
       classnameid, classpk, classuuid, classtypeid, visible, startdate, 
       enddate, publishdate, expirationdate, mimetype, title, description, 
       summary, url, layoutuuid, height, width, priority, viewcount
  FROM assetentry order by createdate desc limit 1;

结果:

结果的左侧 结果的右侧

如果资产存在于数据库中,为什么 Asset Publisher 不显示我的资产? 也许我应该指定一些布局,因为 Asset Publisher 不知道如何显示我的资产。

【问题讨论】:

    标签: liferay liferay-6


    【解决方案1】:

    要正确使用 Asset Framework,您还需要做更多的事情。首先,Asset Publisher 需要知道如何访问您的对象元数据 - 您必须提供自定义 AssetRendererFactory / AssetRenderer 类和一个将呈现您的实体的 JSP 文件。

    使用 Asset Publisher 发布资产部分下的 https://www.liferay.com/documentation/liferay-portal/6.2/development/-/ai/asset-framework-liferay-portal-6-2-dev-guide-06-en 中阅读更多信息。

    【讨论】:

    • 我认为publishing asset 意味着向门户添加新资产(我在我的代码中这样做)。我翻译有误。谢谢。
    • 不客气 :) 还有一件事,记得将所有与数据相关的业务逻辑(例如添加资产)放到服务实现中,而不是您的 portlet 的操作(因为它现在在您的问题)。在 Liferay 的知识库中查看它是如何完成的 - github.com/liferay/liferay-plugins/blob/master/portlets/…
    猜你喜欢
    • 2011-09-14
    • 2021-03-24
    • 2019-04-28
    • 1970-01-01
    • 1970-01-01
    • 2013-04-10
    • 2012-04-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多