0

When I have a Community object, I can use setContent() to enter HTML text to be displayed as part of the Community Overview page.

On the other hand, when I have fetched an existing Community object e. g. as member of community.getSubCommunities() and call subcommunity.getContent(), I receive null. If I call subcommunity.getSummary(), I only receive the plain text (cleaned, no HTML).

How can I fetch the existing HTML content?

(Rationale: I have built some nice "content template" as HTML and want to use this for other communities programmatically. In the IC UI I cannot display the HTML source code afaik, I can only see the "rich text".)

Versions:

IBM SBT SDK 1.0.2.20140527-1807 deployed on Tomcat 7.0.53 running on Java 7, firing against IC v4.5 using BasicAuth.

EDIT 20140725: I corrected the text "call subcommunity.getContent(), I receive null". I had NULL in lt/gt pair which did not render here at all. Sorry :-(

  • I could not understand your question. By API definition, Content is html and Summary is the plain text version of the description. So getContent() should return the HTML content. Both return the same value with plain text? – Serdar Basegmez Jul 20 '14 at 11:31
  • try it: I did not find any HTML in what getContent() returns after having used setContent(someHtml). – Christian Gosch Jul 21 '14 at 12:42
  • I actually had a look into the XML returned from "my" IC45 instance. And the interesting thing is: The "content" node is empty. Nothing inside. Only the "summary" node is filled, but obviously with plain text. – Christian Gosch Jul 25 '14 at 11:49
  • Meanwhile the system is upgraded to IC5, but XML response is unchanged with respect to "content" and "summary": "summary" is filled with plain text, and "content" is empty (but present). -- The request types are "fetch my communities" and "fetch sub communities of XYZ". Maybe this is a reason for "content" being empty? – Christian Gosch Sep 18 '14 at 10:32

2 Answers2

0

If I understand correctly, you are pulling a Community object, just after setting Content, trying to get Summary but you don't get the plain text version of the HTML content.

This is simply because of that the plain text version of the description is not being computed within the Community class. It's a wrapping class for the atom entry that represents a community. Therefore you have to submit the community back to the server by saving it, so you can receive the modified plain text value.

Serdar Basegmez
  • 3,355
  • 16
  • 20
  • Please see my text correction of the question :-/ --- getContent() returns NULL, and getSummary() returns plain text. But getContent() should return HTML source. – Christian Gosch Jul 25 '14 at 08:39
0

The answer is to fetch the community by CommunityService.getCommunity(communityUuid) instead of taking a CommunityList entry from the result of CommunityService.getMyCommunities() or the like.

As it seems the only (or at least main) difference between a CommunityList entry and an explicitly fetched Community entity is that in the list entry set the content field is always e