[midPoint] import jpegPhoto from a database table
Ch. Olbricht
colbricht at hs-harz.de
Wed Apr 30 12:09:45 CEST 2025
Hello Davy,
thank you very much for your tip but:
The field in my postgresql table is type BYTEA and using the
DatabaseTableConnector v1.5.2.0 in resource -> edit raw the element in
the schema is of type="xsd:base64Binary".
In this constellation basic.isEmpty(input) returns always true.
Therefore Your code is not working for inbound mapping in this way.
I found a second Problem on outbound mapping:
Loading a Jpeg in midPoint GUI and outbund mapping with "As is" saves
the image into the database but deleting the Jpeg in midPoint GUI leaves
the image in the database untouched!
Am 23.04.2025 um 13:42 schrieb Davy Priem:
> Hi,
>
> See below to import a photo from a database table.
>
> Best regards
> Davy Priem
> VIVES University of Applied Sciences
>
> */attribute>/*
> */ <ref>ri:Photo</ref>/*
> */<displayName>Photo</displayName>/*
> */ <inbound>/*
> */ <expression>/*
> */ <script>/*
> */ <code>/*
> */ import java.util.Base64;/*
> */
> /*
> */ if (!(basic.isEmpty(input))){/*
> */ log.info("photo is not null");/*
> */ byte[] decodedBytes =
> Base64.getDecoder().decode(input);/*
> */ return decodedBytes;/*
> */ }/*
> */ </code>/*
> */ </script>/*
> */ </expression>/*
> */ <target>/*
> */<path>$focus/jpegPhoto</path>/*
> */ </target>/*
> */ </inbound>/*
> */ </attribute>/*
>
> ------------------------------------------------------------------------
> *Van:* midPoint <midpoint-bounces at lists.evolveum.com> namens Ch.
> Olbricht via midPoint <midpoint at lists.evolveum.com>
> *Verzonden:* woensdag 23 april 2025 13:38
> *Aan:* midpoint at lists.evolveum.com <midpoint at lists.evolveum.com>
> *CC:* Ch. Olbricht <colbricht at hs-harz.de>
> *Onderwerp:* [midPoint] import jpegPhoto from a database table
> Hi Community,
>
> does anyone knows, how JPEG import to attribute "jpegPhoto" from a
> database table works?
>
>
> Having a Postgresql Table like:
>
> CREATE TABLE test(
> user TEXT,
> image BYTEA)
>
> And a resource with in- and outbound mappings, including for the
> "jpegPhoto" attribute:
>
> ...
> <attribute>
> <ref>ri:image</ref>
> <outbound>
> <name>jpegPhoto_out</name>
> <strength>strong</strength>
> <source>
> <path>jpegPhoto</path>
> </source>
> </outbound>
> <inbound>
> <name>jpegPhoto_in</name>
> <strength>strong</strength>
> <target>
> <path>jpegPhoto</path>
> </target>
> </inbound>
> </attribute>
>
> OK, select a user, upload a JPG-file and save the user works and
> outbound mapping saves the user- and image-data in table test.
>
> But deleting the jpegPhoto attribute from this user and doing then a
> import task with the same table-data from the outbound mapping ...
> jpegPhoto is still empty!
>
> Why?
>
>
> Kind Regards
> Christian
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> https://lists.evolveum.com/mailman/listinfo/midpoint
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20250430/a02acfa2/attachment.htm>
More information about the midPoint
mailing list