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