[midPoint] [Japer Report] How to retrieve info from parentOrfRef: solved

Sébastien MARBRIER smarbrier at positivethinking.tech
Wed Jun 22 10:23:12 CEST 2022


Dear Mrs Bolemant,

I am pleased to cofirm to you that the solution you proposed worked perfectly.

Thank you very much for your kind help.

Best regards,


[logo]<https://www.positivethinking.tech/>

Sébastien Marbrier  | Senior IT Consultant
smarbrier at positivethinking.tech<mailto:smarbrier at positivethinking.tech>

Tel. +41 21 601 81 00<tel:+41%2021%20601%2081%2000>

[Teams chat]<https://teams.microsoft.com/l/chat/0/0?users=smarbrier@positivethinking.tech>
 <https://teams.microsoft.com/l/chat/0/0?users=smarbrier@positivethinking.tech>
Chat with me on Teams<https://teams.microsoft.com/l/chat/0/0?users=smarbrier@positivethinking.tech>



[cid:image003.png at 01D88622.121FBEB0]<https://www.linkedin.com/company/the-positive-thinking-company/>  [cid:image004.png at 01D88622.121FBEB0] <https://www.instagram.com/positivethinkingcompany/>   [cid:image005.png at 01D88622.121FBEB0] <https://twitter.com/PTC_Tech>   [cid:image006.png at 01D88622.121FBEB0] <https://youtube.com/channel/UCfaImWa6r0IoZoUYLhbiF7w>
Avenue de cour, 135 – 1007 Lausanne
www.positivethinking.tech<https://www.positivethinking.tech/>




From: Katka Bolemant <katkav at evolveum.com>
Sent: mardi, 21 juin 2022 11:11
To: midPoint General Discussion <midpoint at lists.evolveum.com>
Cc: Sébastien MARBRIER <smarbrier at positivethinking.tech>
Subject: Re: [midPoint] [Japer Report] How to retrieve info from parentOrfRef

Hi Sébastien,

complex path (e.g. extension/someAttribute) doesn't work in Jasper reports. To use extension in the Jasper reports in midPoint 4.0.x, you will need to slightly change the configuration of your report.

First, you need to specify that you want to use extension in your report. You can do it by adding "extension" field definition, in jasper definition it looks like:

<field name="extension" class="com.evolveum.midpoint.xml.ns._public.common.common_3.ExtensionType"/>

and in midPoint you can see it like this:

[cid:image007.png at 01D88622.1217F680]

Then, you need to specify from which extension attribute you want to retrieve a value to the report. So, for the textField where the extension attribute should be used, you need to specify textFieldExpression in the following format:

<textFieldExpression><![CDATA[basic.getPropertyValue((com.evolveum.midpoint.xml.ns._public.common.common_3.ExtensionType) $F{extension}, 'someAttribute')]]></textFieldExpression>

where 'someAttribute' should be replaced with the name of your extension attribute.


Hope this helps.

Best Regards,

--
Katarina Bolemant
Development Team Leader
evolveum.com

________________________________
From: "midPoint General Discussion" <midpoint at lists.evolveum.com<mailto:midpoint at lists.evolveum.com>>
To: "midPoint General Discussion" <midpoint at lists.evolveum.com<mailto:midpoint at lists.evolveum.com>>
Cc: "Sébastien MARBRIER" <smarbrier at positivethinking.tech<mailto:smarbrier at positivethinking.tech>>
Sent: Tuesday, June 14, 2022 10:16:34 AM
Subject: [midPoint] [Japer Report] How to retrieve info from parentOrfRef

Dear midpojnt community,

I need to create a report on a midpoint 4.0.1

I am able to filter correctly the users related to the metarole using the filter:
<queryString language="mql">
                               <![CDATA[<filter>
    <type>
        <type>UserType</type>
        <filter>
            <and>
               <ref>
                  <path>parentOrgRef/@/roleMembershipRef</path>
                  <value oid="…" />
               </ref>
                <equal>
                    <path>activation/administrativeStatus</path>
                    <expression>
                        <queryInterpretationOfNoValue>filterAll</queryInterpretationOfNoValue>
                        <path>$activation</path>
                    </expression>
                </equal>
            </and>
        </filter>
    </type>
</filter>]]>
                </queryString>

I can also extract normal information such as firstname, fullname or email but I can’t extract a piece of information located in the extension and also in the parentOrgRef’s name.

The user schema extension has the following structure:
<xsd:complexType name="UserExtensionType">
                               <xsd:annotation>
                                <xsd:appinfo>
                                               <a:extension ref="c:UserType"/>
                                 </xsd:appinfo>
                               </xsd:annotation>
                               <xsd:sequence>
                                               <xsd:element name="company" type="xsd:string" minOccurs="0">
                                                               <xsd:annotation>
                                                                               <xsd:appinfo>
                                                                                              <a:indexed>true</a:indexed>
                                                                                              <a:displayName>Company</a:displayName>
                                                                                              <a:displayOrder>110</a:displayOrder>
                                                                               </xsd:appinfo>
[…]
                                                               </xsd:annotation>
                                               </xsd:element>
[…]
                               </xsd:sequence>
    </xsd:complexType>


With the parentOrgRef field, several variations were tried:
Report Field
Field name /extension/company field class : java.lang.String
<field name="/extension/company" class="java.lang.String"/>

<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="360" y="0" width="100" height="20" uuid="e7f668f3-9664-4660-8b16-0d25df7d3e2d"/>
                <textFieldExpression><![CDATA[$F{/extension/company}]]></textFieldExpression>
</textField>

Error message : No such property: company for class: report_script in report script

Report Field
Field name parentOrgRef/name field class : java.lang.String
<field name="parentOrgRef/name" class="java.lang.String"/>

<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="360" y="0" width="100" height="20" uuid="e7f668f3-9664-4660-8b16-0d25df7d3e2d"/>
                <textFieldExpression><![CDATA[$F{parentOrgRef/name}]]></textFieldExpression>
</textField>

Error Message : No such property: name for class: report_script in report script


Report Field
Field name /parentOrgRef/@/name field class : java.lang.String
<field name="/parentOrgRef/@/name" class="java.lang.String"/>

<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="360" y="0" width="100" height="20" uuid="e7f668f3-9664-4660-8b16-0d25df7d3e2d"/>
                <textFieldExpression><![CDATA[$F{/parentOrgRef/@/name}]]></textFieldExpression>
</textField>

The error message after the tak ran :
Compilation error in report script: startup failed:
report script: 1: unexpected token: @ @ line 1, column 15.
/parentOrgRef/@/name

I was able to get some information rom the parentOrgRef when I directly used the parentOrgRef as a string parameter but it is not usuable.

Can someone would new how to deal with it ?
In very rare occasions the user can have several parentOrgRef tags, how can I handle this case if the extension field cannot be used ?

Thank you very much for your help.


[logo]<https://www.positivethinking.tech/>

Sébastien Marbrier  | Senior IT Consultant
smarbrier at positivethinking.tech<mailto:smarbrier at positivethinking.tech>

Tel. +41 21 601 81 00

[Teams chat]<https://teams.microsoft.com/l/chat/0/0?users=smarbrier@positivethinking.tech>
 <https://teams.microsoft.com/l/chat/0/0?users=smarbrier@positivethinking.tech>
Chat with me on Teams<https://teams.microsoft.com/l/chat/0/0?users=smarbrier@positivethinking.tech>



[cid:image003.png at 01D88622.121FBEB0]<https://www.linkedin.com/company/the-positive-thinking-company/>  [cid:image004.png at 01D88622.121FBEB0] <https://www.instagram.com/positivethinkingcompany/>   [cid:image005.png at 01D88622.121FBEB0] <https://twitter.com/PTC_Tech>   [cid:image006.png at 01D88622.121FBEB0] <https://youtube.com/channel/UCfaImWa6r0IoZoUYLhbiF7w>
Avenue de cour, 135 – 1007 Lausanne
www.positivethinking.tech<https://www.positivethinking.tech/>







________________________________
Positive Thinking Company puts security at a high priority in its conduct of business. Therefore, we have put our best efforts into ensuring that this email and its attached documents are error and virus-free. Nonetheless, full security of emails/documents cannot be ensured. Therefore, the recipient is responsible for checking the email/documents for threats with its own security measures, prior to opening it. Positive Thinking Company does not accept liability for any damage inflicted by using the content of this email/documents. If you are not the intended recipient, please notify the sender and delete this email/document.



_______________________________________________
midPoint mailing list
midPoint at lists.evolveum.com<mailto:midPoint at lists.evolveum.com>
https://lists.evolveum.com/mailman/listinfo/midpoint


________________________________
Positive Thinking Company puts security at a high priority in its conduct of business. Therefore, we have put our best efforts into ensuring that this email and its attached documents are error and virus-free. Nonetheless, full security of emails/documents cannot be ensured. Therefore, the recipient is responsible for checking the email/documents for threats with its own security measures, prior to opening it. Positive Thinking Company does not accept liability for any damage inflicted by using the content of this email/documents. If you are not the intended recipient, please notify the sender and delete this email/document.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220622/d4abd392/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image007.png
Type: image/png
Size: 97376 bytes
Desc: image007.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220622/d4abd392/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 7735 bytes
Desc: image001.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220622/d4abd392/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 686 bytes
Desc: image002.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220622/d4abd392/attachment-0009.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 2337 bytes
Desc: image003.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220622/d4abd392/attachment-0010.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 2756 bytes
Desc: image004.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220622/d4abd392/attachment-0011.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image005.png
Type: image/png
Size: 2358 bytes
Desc: image005.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220622/d4abd392/attachment-0012.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image006.png
Type: image/png
Size: 2669 bytes
Desc: image006.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220622/d4abd392/attachment-0013.png>


More information about the midPoint mailing list