[midPoint] ScriptedSQL update attributes

Rodrigo Yanis ryanis at identicum.com
Thu Jul 6 20:19:29 CEST 2017


Great! Glad it worked!

Cheers,


*Rodrigo Yanis.*
Identicum S.A.
Jorge Newbery 3226
Tel: +54 (11) 4552-3050
ryanis at identicum.com
www.identicum.com

2017-07-06 15:06 GMT-03:00 Wojciech Staszewski <
wojciech.staszewski at diagnostyka.pl>:

> Yeaaah!!
>
> Strong mapping solved the problem.
> You're great!! Thanks!
>
> W dniu 06.07.2017 o 19:53, Rodrigo Yanis pisze:
>
> It should be, only if "attr" content is a string type. Also, have you
> tried setting <strength>normal</strength> to <strength>strong</strength>
> on the mapping? Perhaps the script is not collecting a value as there's
> been no delta on that specific attribute on the connected platform.
>
> https://wiki.evolveum.com/display/midPoint/Mapping#Mapping-MappingStrength
>
> Hope it helps.
>
>
> *Rodrigo Yanis.*
> Identicum S.A.
> Jorge Newbery 3226
> Tel: +54 (11) 4552-3050
> ryanis at identicum.com
> www.identicum.com
>
> 2017-07-06 14:48 GMT-03:00 Wojciech Staszewski <wojciech.staszewski@
> diagnostyka.pl>:
>
>> Thank you for the array logging code.
>> Unfortunately the array looks like it was empty:
>>
>> (org.forgerock.openicf.misc.scriptedcommon.ScriptedConnector): method:
>> null msg:Attribute received: n_family -> []
>>
>> Hmmmm....
>>
>> W dniu 06.07.2017 o 18:14, Rodrigo Yanis pisze:
>>
>> Just to clarify, make sure "attr" variable contains a *string *with
>> the attribute you want to get. That's how we have it configured in our own
>> implementations and it's working fine.
>> Also, perhaps add some logging to see the contents of the "attributes"
>> array:
>>
>>> *attributes.each{attr, value -> log.info <http://log.info>("Attribute
>>> received: ${attr} -> ${value}")};*
>>
>> So you get a better grasp of what's on that array.
>>
>> Regards,
>>
>>
>> *Rodrigo Yanis.*
>> Identicum S.A.
>> Jorge Newbery 3226
>> Tel: +54 (11) 4552-3050
>> ryanis at identicum.com
>> www.identicum.com
>>
>> 2017-07-06 13:05 GMT-03:00 Rodrigo Yanis <ryanis at identicum.com>:
>>
>>> Hello Wojciech,
>>>
>>> Have you tried something like this?
>>>
>>> *attributes?.get("n_family")?.get(0);*
>>>
>>> Regards,
>>>
>>>
>>> *Rodrigo Yanis.*
>>> Identicum S.A.
>>> Jorge Newbery 3226
>>> Tel: +54 (11) 4552-3050
>>> ryanis at identicum.com
>>> www.identicum.com
>>>
>>> 2017-07-06 12:23 GMT-03:00 Wojciech Staszewski <
>>> wojciech.staszewski at diagnostyka.pl>:
>>>
>>>> Hello!
>>>>
>>>> I have a resource with ScriptedSQL 1.1.2.0-em3 connector.
>>>>
>>>> It worked ok, but from a certain date it gives me an error during
>>>> attibutes update:
>>>>
>>>> switch ( action ) {
>>>>
>>>>     case "UPDATE":
>>>>     switch ( objectClass ) {
>>>>         case "__ACCOUNT__":
>>>>         for (attr in accountAttrNames) {
>>>>             if (attributes.get(attr) != null) {
>>>>                 switch (attr) {
>>>>                     case "n_family":
>>>>                         def family = attributes.get(attr)?.get(0).t
>>>> oString();
>>>>                         sql.executeUpdate("UPDATE egw_addressbook SET
>>>> n_family=? WHERE account_id=?",[family,uid]);
>>>>                         break;
>>>>                         [...]
>>>>
>>>>
>>>>
>>>>
>>>> Outbound mapping:
>>>>
>>>> <attribute>
>>>> <c:ref>ri:n_family</c:ref>
>>>> <outbound>
>>>>                <authoritative>true</authoritative>
>>>>                <exclusive>false</exclusive>
>>>>                <strength>normal</strength>
>>>>                <source>
>>>>                   <c:path>familyName</c:path>
>>>>                </source>
>>>> </outbound>
>>>> </attribute>
>>>>
>>>>
>>>>
>>>> The ERROR:
>>>> ERROR (com.evolveum.midpoint.provisioning.ucf.impl.connid.ConnIdUtil):
>>>> ConnId Exception java.lang.IndexOutOfBoundsException in
>>>> connector:97d430f1-d2b0-4487-b60b-4905dc76d2ca(ICF
>>>> org.forgerock.openicf.connectors.scriptedsql.ScriptedSQLConnector
>>>> v1.1.2.0.em3): ConnectorSpec(resource:d7a1b38
>>>> c-07db-42cc-b173-664b6e317871(EGroupWare), name=null,
>>>> oid=97d430f1-d2b0-4487-b60b-4905dc76d2ca) while updating object
>>>> identified by ConnId UID '1020': Index: 0, Size: 0
>>>> ERROR (com.evolveum.midpoint.provisioning.impl.ProvisioningServiceImpl):
>>>> Couldn't modify object: unexpected problem: java.lang.IndexOutOfBoundsException:
>>>> Index: 0, Size: 0
>>>> ERROR (com.evolveum.midpoint.model.impl.lens.ChangeExecutor): Error
>>>> executing changes for (account (default) on
>>>> resource:d7a1b38c-07db-42cc-b173-664b6e317871(EGroupWare)): Internal
>>>> error: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
>>>>
>>>> The value of "n_family" is NULL, although "familyName" of midPoint's
>>>> user is not null.
>>>>
>>>> I tried this (sorry, I'm not a developer):
>>>>
>>>> def family = attributes.get(attr)?.get(0).toString();
>>>> def family = attributes?.get(attr)?.get(0).toString();
>>>> def family = attributes.get(attr)?.get(0);
>>>> def family = attributes?.get(attr)?.get(0);
>>>> def family = attributes.get(attr)?.find { true };
>>>>
>>>> as in the example: https://github.com/Evolveum/mi
>>>> dpoint/blob/master/samples/resources/scriptedsql/CreateScript.groovy
>>>>
>>>> all with the same result, that means NULL. What is the correct working
>>>> syntax?
>>>>
>>>> Thanks a lot,
>>>> Regards,
>>>> Wojciech Staszewski.
>>>> _______________________________________________
>>>> midPoint mailing list
>>>> midPoint at lists.evolveum.com
>>>> http://lists.evolveum.com/mailman/listinfo/midpoint
>>>>
>>>
>>>
>>
>>
>> _______________________________________________
>> midPoint mailing listmidPoint at lists.evolveum.comhttp://lists.evolveum.com/mailman/listinfo/midpoint
>>
>>
>>
>> _______________________________________________
>> midPoint mailing list
>> midPoint at lists.evolveum.com
>> http://lists.evolveum.com/mailman/listinfo/midpoint
>>
>>
>
>
> _______________________________________________
> midPoint mailing listmidPoint at lists.evolveum.comhttp://lists.evolveum.com/mailman/listinfo/midpoint
>
>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170706/d62f9b5b/attachment.htm>


More information about the midPoint mailing list