2013-07-30 21 views
0

我嘗試後與ActivityService類的活動項目。我希望我所有的追隨者和我自己都能看到它。張貼活動進入所有和我

這一點。

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

我看到我的條目,但不是我的追隨者

與此有關。

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

我的追隨者看到了條目,但我沒有看到這個。

任何人有一個想法,哪一個是正確的組合?

回答

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」: 「人」, 「ID」:」標籤:example.org,2011:簡「} ] }

*您以分發該內容(在WidgetContainer應用trustedApplication角色)

2需要一個特殊的J2EE角色 - 您可以使用ublog 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/@所有 { 「內容」: 「一個新的測試後」}

3 - 否則,你需要做多個職位

這意味着事件將不得不分別發送給每個接收事件的用戶。爲了確保這可以更有效地完成,Open Social規範的擴展允許在數據模型中分發幾種方法

我希望這有助於。

+0

THX這會有所幫助。我會發布兩次:-) –

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) ; 

另外:這裏有adding a user to the trustedExternalApplication role視頻。