[midPoint] Re. Multi-valued properties
Paul Heaney
lists at pheaney.co.uk
Tue May 13 09:40:35 CEST 2014
Hi Deepak,
Pavol is right you need to return a List object luckily groovy has the
tokenize operation which will do exactly that, I'm using the below in
one of my connectors sucessfully:
<inbound>
<strength>strong</strength>
<expression>
<script>
<language>http://midpoint.evolveum.com/xml/ns/public/expression/language#Groovy</language>
<code>
if (!basic.isEmpty(input))
{
input.tokenize(",");
}
</code>
</script>
</expression>
<target>
<path>$user/extension/pid:foo</path>
</target>
</inbound>
Cheers
Paul
On 13/05/14 08:31, Pavol Mederly wrote:
> Hello Deepak,
>
> although I'm not very familiar with groovy, your script seems to
> return not a List, but an array (of strings).
> Please convert it to the java.util.List (or any Collection) before
> returning the value to midPoint.
>
> Best regards,
> Pavol
>
>
> On 13. 5. 2014 7:47, Deepak Natarajan wrote:
>>
>> Hi Everyone -
>>
>> I have extended my Midpoint schema with a custom multi-valued
>> property like so :
>>
>> <xsd:element name="foo" type="xsd:string" minOccurs="0"
>> maxOccurs="unbounded">
>> <xsd:annotation>
>> <xsd:appinfo>
>> <a:indexed>true</a:indexed>
>> </xsd:appinfo>
>> </xsd:annotation>
>> </xsd:element>
>>
>> How do I populate this from with an inbound mapping?
>>
>> When I do :
>>
>> <attribute>
>> <ref>ri:resourceFoo</ref>
>> <inbound>
>> <expression>
>> <script>
>> <code>
>> return resourceFoo.split(',')
>> </code>
>> </script>
>> </expression>
>> <target>
>> <path>$user/extension/apos:foo</path>
>> </target>
>> </inbound>
>> </attribute>
>>
>> I get the error :
>> Caused by: java.lang.IllegalArgumentException: Expected class
>> java.lang.String type, but got class [Ljava.lang.String;
>> at
>> com.evolveum.midpoint.prism.util.JavaTypeConverter.convert(JavaTypeConverter.java:240)
>> ~[prism-2.3-SNAPSHOT.jar:na]
>> at
>> com.evolveum.midpoint.model.common.expression.ExpressionUtil.convertValue(ExpressionUtil.java:178)
>> ~[model-common-2.3-SNAPSHOT.jar:na]
>> at
>> com.evolveum.midpoint.model.common.expression.script.jsr223.Jsr223ScriptEvaluator.convertScalarResult(Jsr223ScriptEvaluator.java:184)
>> ~[model-common-2.3-SNAPSHOT.jar:na]
>> ... 54 common frames omitted
>>
>> I have tested my groovy snipped and I'm assuming if it returns a List
>> (as indicated in the stack trace), it would be handled by Midpoint. I
>> couldn't find an example (maybe I missed this..)
>>
>> Thank you!
>>
>> BR/
>> --
>> Deepak Natarajan
>>
>>
>>
>>
>> _______________________________________________
>> midPoint mailing list
>> midPoint at lists.evolveum.com
>> http://lists.evolveum.com/mailman/listinfo/midpoint
>
>
>
> _______________________________________________
> 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/20140513/47950d9e/attachment.htm>
More information about the midPoint
mailing list