[midPoint] Working with schema handling expressions
Pavol Mederly
mederly at evolveum.com
Sat Aug 1 00:06:02 CEST 2015
Hello Tim,
a general answer is: midPoint is change-driven. So, if you provide a
mapping based on an expression, this expression is actually evaluated
twice: On original (old) value of its input, and on current (new) value
of it. And the original value in your case is probably considered to be
null.
To be exact, scripts in inbound mappings are often executed only once,
because majority of resources are not able to provide true deltas. (They
provide only the "new" state.)
But even considering that, there can be situations when true deltas are
processed by inbound mappings, e.g. if the value of the resource object
attribute was set by outbound mapping first.
So, although I don't know the exact reason in your case, it can be
something like that.
(If you would like to be sure, just look into log file created with
MODEL logging set to TRACE; or submit it here :)
Best regards,
Pavol
On 31. 7. 2015 21:19, Tim.Strong at sita.aero wrote:
> Hi folks,
> I'm doing some scripting on an inbound attribute that will never be
> null and I'm trying to understand why the expression fails if I do not
> check for a string first.
>
> This works...
> <code>
> String result = basic.stringify(input)?.size() > 0 ?
> basic.stringify(input).substring(0,
> basic.stringify(input).indexOf('@')):'';
> return result;
> </code>
>
>
> And this does *not* work...
> <code>
> String result = basic.stringify(input).substring(0,
> basic.stringify(input).indexOf('@'));
> return result;
> </code>
> ... claiming the input variable is null.
>
> I know it's best to always check if something exists before doing an
> operation on it, but I'm curious as to why it fails in this case if I
> do not check. I'm executing against the same test set of accounts
> both times, and they all have the attribute in question.
>
> Thanks
> Tim
>
>
> _______________________________________________
> 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/20150801/d7e49152/attachment.htm>
More information about the midPoint
mailing list