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

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


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170627/f33b4569/attachment.htm>


More information about the midPoint mailing list