[midPoint] ScriptedSQL update attributes

Wojciech Staszewski wojciech.staszewski at diagnostyka.pl
Thu Jul 6 17:23:45 CEST 2017


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

all with the same result, that means NULL. What is the correct working syntax?

Thanks a lot,
Regards,
Wojciech Staszewski.



More information about the midPoint mailing list