[midPoint] Re. Multi-valued properties

Deepak Natarajan dnataraj at trilobytesystems.com
Tue May 13 12:12:40 CEST 2014


Yes! This was the issue, thanks guys!

BR/Deepak

> Paul Heaney <mailto:lists at pheaney.co.uk>
> May 13, 2014 at 10:40 AM
> 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:
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint
> Pavol Mederly <mailto:mederly at evolveum.com>
> May 13, 2014 at 10:31 AM
> 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:
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint
> Deepak Natarajan <mailto:dnataraj at trilobytesystems.com>
> May 13, 2014 at 8:47 AM
>
> 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

Trilobyte Systems ApS
Falkoner Alle 1, 3
2000 Frederiksberg
Denmark
+45 29375068

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20140513/1a174b2d/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/20140513/1a174b2d/attachment.jpg>


More information about the midPoint mailing list