1

我正在尝试使用 JSF 2.0/ICEfaces portlet 应用程序中的内置注释功能(该应用程序已经运行良好)。不幸的是,似乎还没有关于评论内容的详细文档,所以我希望有人能给我一些指示,如何创建和检索应该链接到单个整数的评论。

更清楚地说……我想(重新)在我的自定义 portlet 中使用“页面评论”portlet 的功能,但只使用底层服务,而不是 UI 部分。

我已经发现该 Portlet 通过 EditDiscussionAction 类使用 MBMessageServiceUtil.addDiscussionMessage(...)。不幸的是,我不知道我应该提供什么作为参数值。有人可以对此有所了解吗?javadoc有点……短;-)

public static MBMessage addDiscussionMessage(long groupId,
                                             String className,
                                             long classPK,
                                             String permissionClassName,
                                             long permissionClassPK,
                                             long threadId,
                                             long parentMessageId,
                                             String subject,
                                             String body,
                                             ServiceContext serviceContext)

干杯,tamm0r

4

1 回答 1

5

这会很长,但这里是逐场比赛。

  1. 在您看来,您将获取 MBMessageDisplay 对象。
    MBMessageDisplay messageDisplay =
       MBMessageLocalServiceUtil.getDiscussionMessageDisplay(
          themeDisplay.getUserId(), themeDisplay.getScopeGroupId(),
          MyModelEntry.class.getName(), myModelEntry.getTasksEntryId(),
          WorkflowConstants.STATUS_APPROVED);
  1. MBMessageDisplay 将包含重要数据,例如 threadId 和 parentMessageId,因此请务必同时发布这些数据。

  2. 在您进行帖子中提到的调用的“控制器”中,从请求中获取 ServiceContext,如下所示:

    ServiceContext serviceContext = ServiceContextFactory.getInstance(
       MyModelEntry.class.getName(), actionRequest);
    
  3. 因此,您现在拥有所需的所有参数。

    long groupId - Group (Organization or Community usually) you're writing the comment in.
    String className - MyModelEntry.class.getName()
    long classPK - MyModelEntry's Primary Key or ID
    String permissionClassName - Model where the permission checker should look, typically the same as className
    long permissionClassPK - Its Primary Key or Id
    long threadId - From MBMessageDisplay.
    long parentMessageId - From MBMessageDisplay.
    String subject - the subject
    String body - the body
    ServiceContext serviceContext - from Request in step 3.
    

希望这可以帮助!

于 2011-06-07T23:47:51.143 回答