[midPoint] Proper handling of multivalued extension property to single string

Kari Heikkilä kari.heikkila at qvantel.com
Tue Jun 27 10:57:32 CEST 2017


Hi Gustáv,

BIG thanks, I feel ashamed not to find this, I googled several times but did not hit to correct keywords ☹
My problem is now solved (tested and verified).

Thanks,
Kari

From: midPoint [mailto:midpoint-bounces at lists.evolveum.com] On Behalf Of Pálos Gustáv
Sent: tiistai 27. kesäkuuta 2017 11.06
To: midPoint General Discussion <midpoint at lists.evolveum.com>
Subject: Re: [midPoint] Proper handling of multivalued extension property to single string

Hi Kari,

please see also:
https://wiki.evolveum.com/display/midPoint/Script+Expression#ScriptExpression-AbsoluteandRelativeScriptExpressions

Best regards

Gustav

2017-06-27 10:00 GMT+02:00 Kari Heikkilä <kari.heikkila at qvantel.com<mailto:kari.heikkila at qvantel.com>>:
Hi,

I have email aliases handling for a user inspired from https://wiki.evolveum.com/display/midPoint/Unique+property+value+HOWTO

Now I need to get this multivalued property concatenated into single string into CSV resource (outbound only).
Problem is that outbound script expression is called separately for each value in multivalued property (visible on log as multiple log lines for one user if there more than one value on property).

Definition snippets:

Schema extension:

    <xsd:element name="emailAddresses" type="xsd:string" minOccurs="0" maxOccurs="unbounded">
        <xsd:annotation>
            <xsd:appinfo>
                <a:indexed>true</a:indexed>         <!-- this is important! -->
                <a:displayName>Email aliases</a:displayName>
                <a:displayOrder>170</a:displayOrder>
            </xsd:appinfo>
            <xsd:documentation>
            ...
            </xsd:documentation>
        </xsd:annotation>
    </xsd:element>

CSV resource schema:

    <xsd:element minOccurs="0" name="proxyAddresses" type="xsd:string">
        <xsd:annotation>
            <xsd:appinfo>
                <a:displayOrder>120</a:displayOrder>
                <ra:frameworkAttributeName>proxyAddresses</ra:frameworkAttributeName>
            </xsd:appinfo>
        </xsd:annotation>
    </xsd:element>

CSV resource schema handling:

    <attribute>
        <c:ref>ri:proxyAddresses</c:ref>
        <displayName>E-mail proxyAddresses</displayName>
        <outbound>
            <strength>strong</strength>
            <source>
                <c:path>$user/extension/emailAddresses</c:path>
            </source>
            <expression>
                <script>
                    <code>
                        log.error("emailAddresses: " + emailAddresses)
                        if (emailAddresses != null && emailAddresses.size() > 0) {
                            emailAddresses.join(',')
                        } else {
                            "no aliases"
                        }
                    </code>
                </script>
            </expression>
        </outbound>
    </attribute>

Which is proper way to handle this?


Best regards,
Kari


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



--
s pozdravom

Gustáv Pálos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170627/0535ca00/attachment.htm>


More information about the midPoint mailing list