[midPoint] Re. Referring to resource variable inside expression.
Deepak Natarajan
dnataraj at trilobytesystems.com
Thu Jan 2 15:11:39 CET 2014
Hi Ivan -
Thanks - I tried with $c:input and it worked.
It's a bit weird since in an object template (which I use for
post-creation assignments etc), doing it like this worked :
<mapping>
<source>
<name>varname</name>
<path>varpath</path>
</source>
<expression>
<script>
<code>
tokenize(varname...)
</code>
</script>
</expression>
seems to work, but this fails when I try something similar in a resource
configuration...thought it is quite possible my varpath had an error in
it...(i used $account/attributes/ri:var)
but using 'input' works, thanks!
> Ivan Noris <mailto:ivan.noris at evolveum.com>
> January 2, 2014 at 4:03 PM
> Hi Deepak,
>
> just a blind shot - try to use implicit variable named "input" (it is
> mapped to the "source" of the inbound expression, in your case,
> ri:orgdesc).
>
> See an example (adapted from my customer's resource) written in Groovy
> (not XPath):
>
> <attribute>
> <ref>ri:orgUnitHierarchy</ref>
> <displayName>Organizational Hierarchy</displayName>
> <access>read</access>
> <inbound>
> <expression>
> <script>
> <code>
> String[] tmpHierarchyList = *input* ? *input*?.split('\\.') : []
> tmpHierarchyListNew = []
>
> <!-- some processing skipped here . . . -->
>
> return tmpHierarchyListNew.join(':')
> </code>
> </script>
> </expression>
> <target>
> <path>$user/extension/mycustomer:ouPath</path>
> </target>
> </inbound>
> </attribute>
>
> I do not use XPath in expressions unless absolutely necessary because
> the debugging is quite _challenging_ ;) and it's lot easier to debug
> Groovy statements.
>
> Regards,
> Ivan
>
> On 01/02/2014 02:50 PM, Deepak Natarajan wrote:
>
> --
> Ing. Ivan Noris
> Consultant
> Evolveum, s.r.o
> ___________________________________________________
> "Semper cautus - semper paratus - semper idem Vix."
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint
> Deepak Natarajan <mailto:dnataraj at trilobytesystems.com>
> January 2, 2014 at 3:50 PM
>
> Hi -
>
> I'm struggling with a simple evaluation (I've removed namespace
> declarations for readability) :
>
> <attribute>
> <ref>ri:orgdesc</ref>
> <inbound>
> <expression>
> <script>
>
> <language>http://www.w3.org/TR/xpath/</language>
> <code ...>
>
> tokenize($account/attributes/ri:orgdesc,"/")[last()]
> </code>
> </script>
> </expression>
> <target>
>
> <path>$user/extension/apos:aposUnitAttributes</path>
> </target>
> </inbound>
> </attribute>
>
> I've tried everything, but the variable passed to the XPath tokenize
> function is always nil (I know the function works correctly, since I
> use it elsewhere, and using a literal string above produces the
> correct results)
>
> I've tried including a <source> before the expression with an explicit
> <name> but that doesn't seem to work either.
>
> Thanks for any input! - I'm using build Version: 2.3-SNAPSHOT,
> describe: git-v2.3devel-383-g6ef8f72
>
> BR/Deepak
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20140102/b2985ab8/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compose-unknown-contact.jpg
Type: image/jpeg
Size: 770 bytes
Desc: not available
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20140102/b2985ab8/attachment.jpg>
More information about the midPoint
mailing list