It's all about the answers!

Ask a question

Java API Extending - Work Item Attribute table breaks in RTC 5.0.2


Peter Moraza (481924) | asked May 15 '15, 9:29 p.m.
edited May 21 '15, 9:45 p.m.
Hi,

We recently upgraded our RTC from 4.0.6 to 5.0.2. We were populating Work Item attributes (Large HTML) in work items with nicely formatted tables in version 4.0.6. After the upgrade, old work items retain the table formatting until we write again to the attribute, then the table formatting is lost and the data appears as an unformatted string with some embedded css properties visible. Did the HTML/CSS version change in 5.0.2? What HTML and CSS version is compatible with RTC 5.0.2? No luck finding any documentation on this.

We are using the RTC 4.0.3 Java API to update the Work Item attribute. Does Jazz 5.0.2 require use of the 5.0.2 Java API to edit Work Item attributes?

This worked in 4.0.6.

IAttribute iAttribute = workItemClient.findAttribute(prjareahndl, "OurAttribute", monitor);
WorkItemWorkingCopy wc = manager.getWorkingCopy(workItem);
workItemCopy.setValue(iAttribute, ourupdate);
wc.save(monitor);

Regards,

Peter

One answer



permanent link
Ralph Schoon (63.1k33645) | answered May 19 '15, 5:03 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Peter,

it is always a good idea to use the same version of the server. in general the team tries to maintain a N-1 compatibility. I have tried to explain that here: https://rsjazz.wordpress.com/2013/07/09/new-version-and-now-experiences-with-sdk-and-plain-java-api-across-tool-versions/.

However, I am not sure how you create the content for your attribute. Please be aware that  XMLString.createFromPlainText() will assume that the text is plain and escape out certain characters. XMLString.createFromXMLText() will assume a valid HTML/XML string and leave the tags alone.

Both methods should be used in order to manipulate text e.g. if you want to create new content. I experienced that when creating A RTC WorkItem Command Line Version 2.2
You could look into that code to see what I do.

Comments
Ralph Schoon commented May 19 '15, 5:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Also, there was some work done for a richer editor experience in 5.x. Maybe this contributes too.


Peter Moraza commented May 20 '15, 8:56 p.m. | edited May 20 '15, 8:58 p.m.

Hi Ralph,


I updated to RTC API version 5.0.2 but that did not help.

The only methods I could find which accept XMLString as input update Work Item "comments" (IComment createComment) and Work Item "Description" and "Summary" (IWorkItem setHTMLDescription and setHTMLSummary). I'm using IWorkItem setValue(IAttribute, String) because I was able to select the Work Item attribute that I need to write to (I don't want to update comments, description or summary).

TIA

Peter


Peter Moraza commented May 20 '15, 8:58 p.m.
The String I am passing to IWorkItem setValue is as follows:

"<html><head><style>table, th, td {    border: 1px solid black;}th, td {    padding: 6px;}</style></head><body><table><tr><th>BROKER</th><th>EG</th><th>STREAM</th><th>FLOW</th></tr>" + "<tr><td>" + "DAKPIB00" + "</td><td>" + "TEAMDEV" + "</td><td>" + "National" + "</td><td>" + "/home2/ibadm/rtc/load/rational.kp.org/ibadm/20141009160458/release-item-id-166101/FILEOUTPUT_EXAMPLE_20141009/FILEOUTPUT_EXAMPLE.bar" + "</td></tr>" + "</table></body></html>")


Peter

Your answer


Register or to post your answer.