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

Ana Pereyra apereyra at identicum.com
Thu Jan 19 20:20:05 CET 2017


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170119/67719c6b/attachment.htm>


More information about the midPoint mailing list