[midPoint] Solution - Re: objectClass not recognized in groovy sync

Jason Everling jeverling at bshp.edu
Wed Feb 6 20:11:37 CET 2019


So the __ALL__ ObjectClass is passed when you do not have a default type
(intent) for the resource. This resource doesn't have a default for orgs,
just different intents.

So I got it to pass org, has to add intent to task as well :/

Live Sync: found 3 events to sync from Organization



On Tue, Feb 5, 2019 at 2:48 PM Jason Everling <jeverling at bshp.edu> wrote:

> I setup a resource with different classes to sync and ran into a bug
> maybe? Anyone using sync with multiple classes?
>
> When using if objectClass == "Organization" or even case "Organization" it
> doesn't work. Looking at the logs the Organization objectClass is not
> passed but is actually passed as __ALL__ , Account is passed correctly as
> __ACOUNT__
>
> Error:
> objectClass __ALL__ is not implemented in this script
>
> Example:
> case "SYNC":
> def result = []
> def tstamp = null
> if (token != null){
> tstamp = token
> } else {
> def today= new Date()
> tstamp = today.getTime();
> }
> switch (objectClass) {
> case "__ACCOUNT__":
> sql.eachRow("SELECT * FROM userTable1 WHERE lastChanged > ${tstamp} ORDER
> BY uuid",
> {result.add([operation:"CREATE_OR_UPDATE", uid:it.uuid,
> token:it.lastChanged,
> attributes:[firstname:it.firstname,initials:it.initials,lastname:it.lastname,__ENABLE__:!(it.disabled
> as Boolean)]])}
> )
> break;
> case "Organization":
> sql.eachRow("SELECT * FROM orgTable1 WHERE lastChanged > ${tstamp} ORDER
> BY org",
> {result.add([operation:"CREATE_OR_UPDATE", uid:it.org,
> token:it.lastChanged,
> attributes:[identifier:it.identifier,description:it.description,dept_code:it.dept_code]])}
> )
> break;
> default:
> log.warn("Sync script: objectClass '" + objectClass + "' is not
> implemented in this script")
> }
> log.warn("Sync script: found " + result.size() + " events to sync from " +
> objectClass)
> return result;
>
> JASON
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20190206/a3033880/attachment.htm>


More information about the midPoint mailing list