[midPoint] Exception when translating PP

Wojciech Staszewski wojciech.staszewski at diagnostyka.pl
Fri Nov 17 22:57:56 CET 2017


Hello!

Sorry for answering such old post, but I got it working already and I
want to share it for others.

The SearchScript.groovy must return "String", not "byte[]":

oracle_blob = (oracle.sql.BLOB)row[0];
if ( oracle_blob ) {
            blob2bytearray = oracle_blob.getBinaryStream().getBytes();
            String imageattribute =
Base64.getEncoder().encode(blob2bytearray);
            } else { null } // important! if the blob field is empty the
getBinaryStream() method throws exception


So the MID-3651 can be closed. :)

W dniu 08.01.2017 o 16:54, Wojciech Staszewski pisze:
> Hello!
>
> Anything about that? I stuck here... and this is something what I really need... :(
>
> Thank you!
> Best regards,
> WS
>
> Dnia sobota, 31 grudnia 2016 23:41:29 CET Wojciech Staszewski pisze:
>> Hi....
>>
>> The image (binary) attribute in my ScriptedSQL resource drives me crazy...
>> What I did:
>>
>> Custom schema extension:
>>            <xsd:element name="stamp" type="xsd:base64Binary" minOccurs="0"> 
>>                <xsd:annotation> 
>>                    <xsd:appinfo> 
>>                        <a:indexed>true</a:indexed> 
>>                        <a:displayName>User stamp</a:displayName> 
>>                        <a:displayOrder>370</a:displayOrder> 
>>                    </xsd:appinfo> 
>>                </xsd:annotation> 
>>            </xsd:element>
>>
>> SchemaScript.groovy:
>> account.addAttributeInfo(AttributeInfoBuilder.build("userstamp", byte[].class));
>>
>> SearchScript.groovy:
>>         def stampquery = "select u.stamp from users u" + where;
>>         row = sql.firstRow(stampquery);
>>         stamp_blob = (oracle.sql.BLOB)row[0];
>>         stamp = stamp_blob.getBinaryStream().getBytes();
>>
>> Midpoint GUI: My ScriptedSQL Resource->Accounts->Resource->click on some user
>> I see the user stamp attribute, I can download it and open correctly in image viewer.
>>
>> I made inbound mapping userstamp -> extension/stamp
>> but reconciliation gives me error:
>>
>> ERROR (com.evolveum.midpoint.web.component.progress.ProgressReporter): Error executing changes.
>> com.evolveum.midpoint.util.exception.SchemaException: Exception when translating PP({http://midpoint.evolveum.com/xml/ns/story/unix-1}stamp):[PPV(byte[]:byte[-1,-40,-1,-32,0,16,74,70,73,70,0,1,1,1,0,0,0,0,0,0,-1,-37,0,67,0,9,6,7,19,19,18,21,19,18,18,22,22,21,22,23,23,23,25,24,21,25,21,24,24,27,26,26,29,29,23,23,29,26,25,24,30,40,32,25,,... 10849 bytes total])]: Can't extract value for saving from prism property value
>> PPV(byte[]:byte[-1,-40,-1,-32,0,16,74,70,73,70,0,1,1,1,0,0,0,0,0,0,-1,-37,0,67,0,9,6,7,19,19,18,21,19,18,18,22,22,21,22,23,23,23,25,24,21,25,21,24,24,27,26,26,29,29,23,23,29,26,25,24,30,40,32,25,,... 10849 bytes total])
>>
>> *****   What attribute types should I use for image attribute? In schema extension is base64Binary, on resource byte[], I suspect is something wrong here ;(  ******
>>
>> I know, I'm workaholic...
>> Happy New Year!!!!
>> _______________________________________________
>> midPoint mailing list
>> midPoint at lists.evolveum.com
>> http://lists.evolveum.com/mailman/listinfo/midpoint
>>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint




More information about the midPoint mailing list