<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hello Oskar !
<div class=""><br class="">
</div>
<div class="">Thank you so much, it’s working great !</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">Le 28 avr. 2017 à 09:42, Oskar Butovič - AMI Praha a.s. <<a href="mailto:oskar.butovic@ami.cz" class="">oskar.butovic@ami.cz</a>> a écrit :</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">Hello Vincent,
<div class=""><br class="">
</div>
<div class="">you can do something like this:</div>
<div class="">
<div class=""><mapping></div>
<div class="">         <!-- TODO sources --></div>
<div class="">               <expression></div>
<div class="">                  <script></div>
<div class="">                  <span class="gmail-Apple-tab-span" style="white-space:pre">
</span><relativityMode>absolute</relativityMode></div>
<div class="">                     <code></div>
<div class="">                        def resultAssignments = [];</div>
<div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"></span>//TODO create assignments and put them to  resultAssignments</div>
<div class="">        <span class="gmail-Apple-tab-span" style="white-space:pre">
</span>return resultAssignments;</div>
<div class="">                     </code></div>
<div class="">                  </script></div>
<div class="">               </expression></div>
<div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"></span>  <target></div>
<div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"></span><path>assignment</path></div>
<div class=""><span class="gmail-Apple-tab-span" style="white-space:pre"></span>  </target></div>
<div class="">      </mapping> </div>
</div>
<div class=""><br class="">
</div>
<div class="">important is to use <relativityMode>absolute</relativityMode> which tells mapping to treat all multivalue attributes (assignment is internaly just multivalue attribute) and return array.</div>
<div class=""><br class="">
</div>
<div class="">Best Regards</div>
<div class=""><br class="">
</div>
<div class="">Oskar Butovič</div>
</div>
<div class="gmail_extra"><br class="">
<div class="gmail_quote">2017-04-27 18:14 GMT+02:00 HURTEVENT VINCENT <span dir="ltr" class="">
<<a href="mailto:vincent.hurtevent@univ-lyon1.fr" target="_blank" class="">vincent.hurtevent@univ-lyon1.fr</a>></span>:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br class="">
<br class="">
We have a ressource for users in database table, a specific column contains concatenated organization IDs, separated by commas, like "DA,D64,BHU"<br class="">
<br class="">
We would like, in one single sync, to map multiple assignments between our user and organizations.<br class="">
<br class="">
How could we return multiple assignments ? We know how to do it with one, but we can’t figure out to do with multiple.<br class="">
We tried to build and return a assignment list, but with the syntax above, we get an XML parsing error due to<br class="">
<br class="">
"List<assignmentType> assignments = new ArrayList<assignmentType>(); »<br class="">
<br class="">
<br class="">
How could we handle this ?<br class="">
Is there a better way to map multiple assignment ?<br class="">
<br class="">
Thank you !<br class="">
<br class="">
<br class="">
                                                         <code><br class="">
                                                         import com.evolveum.midpoint.xml.ns._<wbr class="">public.common.common_3.<wbr class="">AssignmentType;<br class="">
                                                         import com.evolveum.midpoint.xml.ns._<wbr class="">public.common.common_3.<wbr class="">ObjectReferenceType;<br class="">
                                                         import com.evolveum.midpoint.xml.ns._<wbr class="">public.common.common_3.<wbr class="">OrgType;<br class="">
                                                         import com.evolveum.midpoint.xml.ns._<wbr class="">public.common.common_3.<wbr class="">ActivationType;<br class="">
                                                         import com.evolveum.midpoint.util.<wbr class="">exception.SystemException;<br class="">
                                                         import java.util.*;<br class="">
<br class="">
                                                         if (affectations != null)<br class="">
                                                         {<br class="">
                                                                 List liste_affectations = Arrays.asList(affectations.<wbr class="">split("\\s*,\\s*"));<br class="">
<br class="">
                                                                 List<assignmentType> assignments = new ArrayList<assignmentType>();<br class="">
<br class="">
                                                                 for (String org_name : liste_affectations) {<br class="">
<br class="">
                                                                         org = midpoint.searchObjectByName(<wbr class="">OrgType.class, org_name);<br class="">
<br class="">
                                                                         <a href="http://log.info/" rel="noreferrer" target="_blank" class="">log.info</a>("org {}" , org)<br class="">
                                                                         orgOrt = new ObjectReferenceType();<br class="">
                                                                         orgOrt.setOid(org.getOid());<br class="">
                                                                         orgOrt.setType(OrgType.<wbr class="">COMPLEX_TYPE);<br class="">
<br class="">
                                                                         AssignmentType assignment = new AssignmentType();<br class="">
                                                                         assignment.<wbr class="">asPrismContainerValue()<br class="">
                                                                         assignment.setTargetRef(<wbr class="">orgOrt);<br class="">
<br class="">
                                                                         assignments.add(assignment);<br class="">
                                                                        }<br class="">
<br class="">
                                                                        return assignments;<br class="">
                                                                 }<br class="">
                                                         </code><br class="">
______________________________<wbr class="">_________________<br class="">
midPoint mailing list<br class="">
<a href="mailto:midPoint@lists.evolveum.com" class="">midPoint@lists.evolveum.com</a><br class="">
<a href="http://lists.evolveum.com/mailman/listinfo/midpoint" rel="noreferrer" target="_blank" class="">http://lists.evolveum.com/<wbr class="">mailman/listinfo/midpoint</a><br class="">
</blockquote>
</div>
<br class="">
<br clear="all" class="">
<div class=""><br class="">
</div>
-- <br class="">
<div class="gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<table style="font-family:Verdana,Arial,Helvetica,sans-serif;border-collapse:collapse;padding:0px;margin:0px;border-width:0px!important;border-style:solid!important;width:482px!important" class="">
<tbody class="">
<tr style="padding:0px;margin:0px;border:0px solid gray!important" class="">
<td style="font-family: Arial, sans-serif; font-size: 11px; width: 160px; vertical-align: bottom; padding: 0px; border: 0px solid gray !important;" class="">
<p class=""><span style="font-size:14px;font-weight:bold" class="">Oskar Butovič</span><br class="">
solution architect<br class="">
<br class="">
gsm: [+420] 774 480 101<br class="">
e-mail: <a href="mailto:oskar.butovic@ami.cz" target="_blank" class="">oskar.butovic@ami.cz</a></p>
</td>
<td style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(204, 204, 204); padding: 0px; border-top-width: 0px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; border-top-style: solid !important; border-bottom-style: solid !important; border-left-style: solid !important; border-top-color: gray !important; border-bottom-color: gray !important; border-left-color: gray !important;" class="">
   </td>
<td style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; padding: 0px; border: 0px solid gray !important;" class="">
   </td>
<td style="font-family: Arial, sans-serif; font-size: 11px; vertical-align: bottom; padding: 0px; width: 123px; border: 0px solid gray !important;" class="">
<p class="">AMI Praha a.s.<br class="">
Pláničkova 11<br class="">
162 00 Praha 6<br class="">
tel.: [+420] 274 783 239<br class="">
web: <a href="http://www.ami.cz/" target="_blank" class="">www.ami.cz</a></p>
</td>
<td style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(204, 204, 204); padding: 0px; border-top-width: 0px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; border-top-style: solid !important; border-bottom-style: solid !important; border-left-style: solid !important; border-top-color: gray !important; border-bottom-color: gray !important; border-left-color: gray !important;" class="">
   </td>
<td style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; padding: 0px; border: 0px solid gray !important;" class="">
   </td>
<td style="font-family: Arial, sans-serif; font-size: 11px; margin: 8px; width: 116px; border: 0px solid gray !important;" class="">
<p class=""><img src="http://www.ami.cz/images/podpis/ami_logo.gif" alt="AMI Praha a.s." style="border:0px" class=""></p>
</td>
</tr>
<tr style="padding:0px;margin:0px;border:0px solid gray!important" class="">
<td colspan="7" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; padding: 0px; width: 480px; border: 0px solid gray !important;" class="">
<br class="">
<a href="http://www.ami.cz/reseni-a-sluzby/bezpecnost-dat/identity-management" target="_blank" class=""><img src="http://www.ami.cz/images/podpis/AMI-podpis-IdM_1.png" alt="AMI Praha a.s." style="border:0px;width:480px!important;height:82px!important" class=""></a></td>
</tr>
<tr style="padding:0px;margin:0px;border:0px solid gray!important" class="">
<td colspan="7" style="color:rgb(128,128,128);font-family:Arial,sans-serif;font-size:11px;padding:0px;border:0px solid gray!important" class="">
<br class="">
Textem tohoto e-mailu podepisující neslibuje uzavřít ani neuzavírá za společnost AMI Praha a.s.<br class="">
jakoukoliv smlouvu. Každá smlouva, pokud bude uzavřena, musí mít výhradně písemnou formu.<br class="">
<br class="">
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
_______________________________________________<br class="">
midPoint mailing list<br class="">
<a href="mailto:midPoint@lists.evolveum.com" class="">midPoint@lists.evolveum.com</a><br class="">
http://lists.evolveum.com/mailman/listinfo/midpoint<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>