Search code examples
ibm-sbtibm-connections

IBM SBT: Updating a subcommunity breaks subcommunity relation?


I have implemented creation of subcommunities using IBM SBT 1.0.2.20140527-1807 against IC 4.5 (thanks for heavy API changes from 1.0.1 :-/ ) and want to update a freshly created subcommunity with a nice "content" containing some HTML with links to some content inside this community. Thus I must first create the subcommunity and afterwards update the "content" attribute, because I need some data not yet present before successful creation.

The way I do this is basically as follows:

(1) Create subcommunity [proven successful, and it IS a subcommunity now]
(2) Fetch the new subcommunity using CommunityService.getCommunity(communityUuid) [proven successful]
(3) execute community.setContent(string) [no errors]
(4) execute CommunityService.updateCommunity(community) [no errors]

The REST request created and sent for CREATE is:

POST /communities/service/atom/community/subcommunities?communityUuid=8ea4ff45-ef58-4c9b-b131-def2d3e233f7

The XML data sent is:

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<title type="text">mytitle</title>
<content type="html">mycontent</content>
<category term="community" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>
<category term="mytag"></category>
<snx:communityType xmlns:snx="http://www.ibm.com/xmlns/prod/sn">private</snx:communityType>
</entry>

The REST request created and sent for UPDATE is:

PUT /communities/service/atom/community/instance?communityUuid=ae63bedf-98f2-45d4-ad6a-4dfd1f3a58d7

The XML data sent is:

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<title type="text">mytitle</title>
<content type="html">mycontent</content>
<category term="community" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>
<category term="mytag"></category>
<snx:communityType xmlns:snx="http://www.ibm.com/xmlns/prod/sn">private</snx:communityType>
<snx:communityUuid xmlns:snx="http://www.ibm.com/xmlns/prod/sn">ae63bedf-98f2-45d4-ad6a-4dfd1f3a58d7</snx:communityUuid>
<id>http://communities.ibm.com:2006/service/atom/community/instance?communityUuid=ae63bedf-98f2-45d4-ad6a-4dfd1f3a58d7</id>
</entry>

Afterwards the content is indeed updated -- but the community is not a subcommunity any more, but a regular top level community.

Why is that?

What can I do about it?


Solution

  • IBM SBT SDK 1.1.0 of Jul 17, 2014, seems to be out. At least it is available in Maven central.

    This is the better answer of course but will require several code adjustments if you have built code on top of internal structures due to some internal refactorings.