[midPoint] ScriptedSQL update attributes

Wojciech Staszewski wojciech.staszewski at diagnostyka.pl
Thu Jul 6 19:36:26 CEST 2017


Isn't is the same?


W dniu 06.07.2017 o 18:05, Rodrigo Yanis pisze:
> 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 <mailto:ryanis at identicum.com>
> www.identicum.com <http://www.identicum.com/>
>
> 2017-07-06 12:23 GMT-03:00 Wojciech Staszewski
> <wojciech.staszewski at diagnostyka.pl
> <mailto: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).toString();
>                             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:d7a1b38c-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/midpoint/blob/master/samples/resources/scriptedsql/CreateScript.groovy
>     <https://github.com/Evolveum/midpoint/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 <mailto:midPoint at lists.evolveum.com>
>     http://lists.evolveum.com/mailman/listinfo/midpoint
>     <http://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/b0b37db9/attachment.htm>


More information about the midPoint mailing list