[midPoint] import jpegPhoto from a database table

Davy Priem davy.priem at vives.be
Wed Apr 23 13:42:59 CEST 2025


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/20250423/1378101f/attachment.htm>


More information about the midPoint mailing list