[midPoint] scriptedsql connector add attribute to multivalue field

Nico Pätzelt-Schäkel paetni1 at gmail.com
Wed May 10 15:26:30 CEST 2017


Hello,

we are using the scripted sql connector and midpoint 3.5.1.
Following Problem occurs when a multivalue field is updated:
The old values are removed from midpoint repo and only the new value is in
midpoint.

On the database everything is correct there are the old values and the new
one seperated by ; .
I had a look at the Logfile and found following delta's:

---[ EXECUTED delta of UserType ]---------------------
Channel: http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user
Wave: 0
ObjectDelta<UserType>(UserType:80bf9380-8e7e-42ec-bf7b-5eb05c614343,MODIFY):
  extension/sapmandanten
    ADD: 123
    OLD: 55, 999
  metadata/modifyChannel
    REPLACE: http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user
  metadata/modifyTimestamp
    REPLACE: 2017-05-10T14:21:42.469+02:00
  metadata/modifierRef
    REPLACE: oid=00000000-0000-0000-0000-000000000002
Result: SUCCESS: null
--------------------------------------------------

Then the update groovy is caled and executed. After this the Database has
the correct values:
Entering ADD_ATTRIBUTE_VALUES Script for __ACCOUNT__ and attr
[sapmandanten:[123]]


After this the delta of the Shadowtype gets listed. Here is only the new
value listed (123).
 ---[ EXECUTED delta of ShadowType ]---------------------
 Channel: http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user
 Wave: 0
 Resource: resource:11111111-2222-3333-4444-200000000000(Portal)
 ObjectDelta<ShadowType>(ShadowType:0303a1d2-611d-46c1-9750-d8504b69c6ce,MODIFY):
 attributes/sapmandanten
 ADD: 123
 metadata/modifyChannel
 REPLACE: http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user
 metadata/modifyTimestamp
 REPLACE: 2017-05-10T14:21:42.642+02:00
 metadata/modifierRef
 REPLACE: oid=00000000-0000-0000-0000-000000000002
 Result: SUCCESS: null
 --------------------------------------------------

Then the search scripted is executed the log says. After this action there
is again a delta of the UserType listed which shows the delete of the old
values from the multivalue field:
 ---[ EXECUTED delta of UserType ]---------------------
 Channel: http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user
 Wave: 1
 ObjectDelta<UserType>(UserType:80bf9380-8e7e-42ec-bf7b-5eb05c614343,MODIFY):
 extension/sapmandanten
 DELETE: 55, 999
 OLD: 55, 999
 metadata/modifyChannel
 REPLACE: http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user
 metadata/modifyTimestamp
 REPLACE: 2017-05-10T14:21:45.630+02:00
 metadata/modifierRef
 REPLACE: oid=00000000-0000-0000-0000-000000000002
 Result: SUCCESS: null
 --------------------------------------------------

We end up with only the new attribute 123 in midpoint. The Database has all
three values (correct). After a reconcile of the user there are all values
in midpoint too, but thats not like it should work.
Maybe someone can help?

Our update.groovy looks like:
...
case "__ACCOUNT__":
attributes.get("sapmandanten").each {
            sql.executeUpdate(
                            "UPDATE users SET
sapmandanten=concat_ws(';',sapmandanten, ? ) WHERE uid = ?",
                            [
                                    it,
                                    uid
                            ]

           )
}
break
...

Kind regards
Nico Pätzelt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170510/4bebd588/attachment.htm>


More information about the midPoint mailing list