[midPoint] Assign org to user with extension attribute on the assignment

Martin Lízner - AMI Praha a.s. martin.lizner at ami.cz
Thu Jan 19 20:54:10 CET 2017


Although not having hands-on experience, I think you are right about
setExtension(ExtensionType
value), you will need to play with it a bit as you can construct new
ExtensionType in simillar fashion:

ExtensionType et = new ExtensionType(getPrismContext());
et.asPrismContainerValue().add(....

M.

Martin Lízner
solution architect

gsm: [+420] 737 745 571
e-mail: martin.lizner at ami.cz


AMI Praha a.s.
Pláničkova 11
162 00 Praha 6
tel.: [+420] 274 783 239
web: www.ami.cz



[image: AMI Praha a.s.] <http://www.skyidentity.com/>

Textem tohoto e-mailu podepisující neslibuje uzavřít ani neuzavírá za
společnost AMI Praha a.s.
jakoukoliv smlouvu. Každá smlouva, pokud bude uzavřena, musí mít výhradně
písemnou formu.


2017-01-19 20:20 GMT+01:00 Ana Pereyra <apereyra at identicum.com>:

> Hi all.
>
> We have the following situation: we have extended the schema of the
> AssignmentType object and added one attribute.
>
> Simultaneously, in the user template, we have logic that assigns an org to
> the user based on his "organization" attribute. The tricky part is that we
> need to assign the org to the user, and *also *set the extended attribute
> of the assignment with a certain value.
>
> This is the script we have so far for that mapping in the user template:
>
> <mapping>
>>       <authoritative>true</authoritative>
>>   <strength>strong</strength>
>>       <source>
>>         <c:path>$focus/organization</c:path>
>>       </source>
>>       <expression>
>>          <script>
>>             <code>
>>   import com.evolveum.midpoint.xml.ns._public.common.common_3.
>> AssignmentType;
>>   import com.evolveum.midpoint.xml.ns._public.common.common_3.
>> ObjectReferenceType;
>>   import com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType;
>>   import java.util.*;
>>                 org = midpoint.searchObjectByName(OrgType.class,
>> organization);
>>                 log.info("org {}" , org);
>>                 orgOrt = new ObjectReferenceType();
>>    orgOrt.setOid(org.getOid());
>>    orgOrt.setType(OrgType.COMPLEX_TYPE);
>> <!-- creating assignment -->
>>    AssignmentType assignment = new AssignmentType();
>>    assignment.asPrismContainerValue();
>>    assignment.setTargetRef(orgOrt);
>>
>> *<!-- right here we would need to that something like "setValue" for the
>> extended attribute -->*
>>    return assignment
>>   </code>
>>          </script>
>>       </expression>
>>       <target>
>>          <c:path>assignment</c:path>
>>       </target>
>>    </mapping>
>
>
> I read in the definition of the AssignmentType class, that there's a
> method "setExtension" that we could use, but had no luck understanding how
> to create and ExtensionType object with that value set.
>
> Any help is appreciated. Thanks in advance.
> Regards,
> --
> *Ana Pereyra*
>  Identicum S.A.
>
> *Jorge Newbery 3226, ArgentinaTel: +54 (11) **4552.3050*
> *apereyra at identicum.com <apereyra at identicum.com>*
> www.identicum.com
>
> _______________________________________________
> 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/20170119/fca8c36b/attachment.htm>


More information about the midPoint mailing list