Use compare function in custom wiki content

Description
wout.lemmens
Posts: 1
Joined: Thu Nov 30, 2017 2:00 pm

Use compare function in custom wiki content

Postby wout.lemmens » Thu Nov 30, 2017 2:25 pm

Hi,

I'm creating a view on some linked work items, and create a nice table out of that.

But I want to be able to create a compare view on my custom wiki generated content, just like what is possible in the document compare functionality.

Just starting on this compare view, and starting small:
I managed to request the change within a work item by the following:

Code: Select all

#set($wiLatest=$trackerService.getWorkItem("MLR", "MLR-599"))
#set($wiOld=$trackerService.getWorkItemWithRevision("MLR", "MLR-599", "78839"))

#set($DiffMan = $wiLatest.getDataSvc().getDiffManager())

#set($excludeFields = $objectFactory.newSet())
#set($void=$excludeFields.add("previousStatus"))
#set($fieldDiffs = $DiffMan.generateDiff($wiOld, $wiLatest, $excludeFields))

#foreach($diff in $fieldDiffs)
   * field: $diff.getFieldName()
   ** before: $diff.getBefore()
   ** after: $diff.getAfter()
#end


But now I want to get a nice view on the changed data as well (green highlighting for new text, red highlighting for removed text). Just like what is present in the LiveDoc compare functionality:
compare.PNG
compare.PNG (1.13 KiB) Viewed 1154 times


What manager-object can I use for rendering the compare? The DiffManager only allows me to to a compare, but it does not allow me to render it in a usable way.

Any help is appreciated. Thnx.

ALMighty
Posts: 80
Joined: Wed Apr 27, 2016 10:34 am
Location: Austria

Re: Use compare function in custom wiki content

Postby ALMighty » Wed Feb 07, 2018 3:10 pm

Hello and sry for the veeeery late answer, I am not a member for this Forum for very long.

wout.lemmens wrote:What manager-object can I use for rendering the compare? The DiffManager only allows me to to a compare, but it does not allow me to render it in a usable way.


May I ask what you mean by "render"? Do you mean that you a use a field/variable of that diff for further usage?

EDIT:
Besides, have you hever considered to traverse and process the history in a Java programme using the Polarion SDK (which is actually a set of Java libraries stored in the SDK folder of the Polarion installation which is on your server)? You probably have to abstain from the nice and colorful diff view (Though there are sure ways to make something with red and green colors in a Java command line/shell without a fancy window) when using the Java SOAP API of Polarion but when the data itself is easier to access in my opinion.

For Java, the TrackerWebService has the generateHistory() method, which gives you the history of a work item as a Change object array. In each change object, there is a Fielddiff array which you can get when you invoke the getDiffs() method on the Change object.

Check the Javadocs I have linkd out, maybe they suit your demand better. If you want to know how to set up a Java project which acesses the Polarion API, just let me know. :wink:
Nevertehless, meanwhile I experiment a bit more with History and Diffs in Wikipages so that I can help you concerning your original request. :idea:
---------------------------------------------------------------------------------------------------
Playing a good game is never lame. :D
Image

peterfriedrich
Posts: 40
Joined: Tue Jul 30, 2013 1:08 pm

Re: Use compare function in custom wiki content

Postby peterfriedrich » Thu Aug 16, 2018 11:40 am

Hi all,
I am also looking for exactly such a solution.
I am not familiar with that programming stuff. Can somebody post the solution?
Kind regards
Peter


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 6 guests