RE: Custom Report: getCovers() and getCoveringTestCases()

J Francisco Guardado, modified 9 Years ago.

Custom Report: getCovers() and getCoveringTestCases()

Youngling Posts: 2 Join Date: 7/30/14 Recent Posts
Hi,

I organized testcases by linking them to requriments and now I want to do a report that presents those links using excel.
On implementing a custom report I found getCovers() and getCoveringTestCases() for TestCase and Requirement respectively to solve this, but they deliver internal representation of the objects.

Is there a way to translate or get the dynamic text of 'shortname' prior to passing the data to the render process, or better access them from the render process whlie it iterates. It seems to me actually that the renderer can deal with those methods but the result is only an empty list.

Example:

<e:column value="#{req.getCoveringTestCases()}" var="reqtc">
<f:facet name="header">
<e:cell value="Testcases" />
</f:facet>
<e:cell value="#{reqtc.shortname}" />
</e:column>

Thanks in advance.
thumbnail
Torsten Stolpmann, modified 9 Years ago.

RE: Custom Report: getCovers() and getCoveringTestCases()

Jedi Council Member Posts: 755 Join Date: 2/12/09 Recent Posts
Hi Francisco,

at a glance this looks like you are on the right track with your approach.

To my knowledge there really should be no need to extract the field values prior to rendering.

I think your problem is that #{req.getCoveringTestCases()} is returning a java.util.Set instead of a java.util.List which the underlying EL Implementation is unable use for iteration.

So changing #{req.getCoveringTestCases()} to #{req.getCoveringTestCases().toArray()} should give you the result you are looking for.

Please let me know if this works for you.

Regards,

Torsten
J Francisco Guardado, modified 9 Years ago.

RE: Custom Report: getCovers() and getCoveringTestCases()

Youngling Posts: 2 Join Date: 7/30/14 Recent Posts
Torsten,

thanks for your reply.

Unfortunately, it did not work. I tried even using a separated worksheet passing the same context to it as in my previous try.
In this case I got an empty iteration for the cells.

Code:

<e:worksheet value="#{requirements}" var="req">


<e:column value="#{req.getCoveringTestCases().toArray()}" var="reqtc">
<f:facet name="header">
<e:cell value="Testcases" />
</f:facet>
<e:cell value="#{reqtc.shortname}" />
</e:column>
</e:worksheet>

It could be also seen that the element column is not able to parse the new value operation at all. With the line:

<e:column value="#{req.getCoveringTestCases().trray()}" var="reqtc">

I got an empty iteration too.

Regards
thumbnail
Torsten Stolpmann, modified 9 Years ago.

RE: Custom Report: getCovers() and getCoveringTestCases()

Jedi Council Member Posts: 755 Join Date: 2/12/09 Recent Posts
Hi Francisco,

you are right in that the underlying framework (seam-excel/jexcelapi) does not support the nesting of both worksheet and column iterations.

A working (yet cumbersome) solution would be the following and relies on loop unrolling:


<e:workbook xmlns:e="http://jboss.org/schema/seam/excel" xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:f="http://java.sun.com/jsf/core">

<e:worksheet value="#{requirements}" var="req" varStatus="reqStat">
<e:column>
<f:facet name="header">
  <e:cell value="Requirement" />
</f:facet>
<e:cell value="#{req.shortname}" />
</e:column>
<e:column>
<f:facet name="header">
  <e:cell value="Testcase" />
</f:facet>
<e:cell value="#{req.getCoveringTestCases().toArray()[0].getShortname()}" />
</e:column>
<e:column>
<f:facet name="header">
  <e:cell value="Testcase" />
</f:facet>
<e:cell value="#{req.getCoveringTestCases().toArray()[1].getShortname()}" />
</e:column>
<!-- repeat columns as needed -->
</e:worksheet>

</e:workbook>


Sorry, but there is other solution at hand for this output format.

Regards,

Torsten