0

我尝试使用 ActivityService 类发布活动条目。我希望我所有的追随者和我自己都能看到它。

这。

ActivityStreamService service = new ActivityStreamService();
service.postEntry("@me", "@all", "", jsonObject, header);

我看到了我的条目,但没有看到我的追随者

有了这个。

ActivityStreamService service = new ActivityStreamService();
service.postEntry("@public", "@all", "", jsonObject, header);

我的追随者看到了该条目,但我没有看到这个。

有人知道哪个是正确的组合吗?

4

2 回答 2

1

有几种方法... 1 - 您可以使用分发方法 http://www-10.lotus.com/ldd/appdevwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Connections+4.5+API+Documentation #action=openDocument&res_title=Distributing_events_ic45&content=pdcontent openSocial : { "deliverTo":[ {"objectType":"person", "id":"tag:example.org,2011:jane"} ] }

*您需要一个特殊的 j2ee 角色才能分发此内容(WidgetContainer 应用程序中的 trustedApplication 角色)

2 - 您可以使用微博 http://www-10.lotus.com/ldd/appdevwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Connections+4.5+API+Documentation#action=openDocument&res_title=Posting_microblog_entries_ic45&content=pdcontent

发布到我的董事会:/ublog/@me/@all { "content": "A new test post" }

3 - 否则,你需要做多个帖子

这意味着必须将事件单独发送给要接收事件的每个用户。为了确保这可以更有效地完成,对开放社交规范的扩展允许在数据模型中使用一些分发方式

我希望这有帮助。

于 2013-07-30T15:19:11.823 回答
1

除了openSocial JSON 对象,您还可以使用JSON对象

例如这个 JSON 片段:

    "to":[
      {"objectType":"person", "id":"@me"}.
      {"objectType":"person", "id":"@public"}
      {"objectType":"community", "id":"xxx-xx-xxx0x0x0x0x0x"}
    ]

...可以通过像这样更新您的jsonObject来生成:

    // @me
    JsonJavaObject meJson = new JsonJavaObject();
    meJson.put("objectType","person");
    meJson.put("id","@me");

    // @public
    JsonJavaObject publicJson = new JsonJavaObject();
    publicJson.put("objectType","person");
    publicJson.put("id","@public");

    // Community
    JsonJavaObject communityJson = new JsonJavaObject();
    communityJson.put("objectType","community");
    communityJson.put("id","xxx-xx-xxx0x0x0x0x0x");

    // Shove them all in a list
    List<JsonJavaObject> toJson = new ArrayList<JsonJavaObject>();
    toJson.add(meJson);
    toJson.add(publicJson);
    toJson.add(communityJson);

    // add to: [...] to the root JsonJavaObject 
    jsonObject.put("to", toJson ) ;

另外:这是一个关于将用户添加到trustedExternalApplication角色的视频。

于 2013-07-31T21:55:04.677 回答