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

Ana Pereyra apereyra at identicum.com
Fri Jan 20 15:59:56 CET 2017


Thank you very much for answering so fast.

I've been trying to solve this, and got to the point of creating an
Item<?,?> object to add to the extension (
https://evolveum.com/downloads/midpoint/3.4/midpoint-3.4-javadoc/com/evolveum/midpoint/prism/PrismContainerValue.html#add(com.evolveum.midpoint.prism.Item).
Does anyone have an example of this? I couldn't find any.

Thanks in advance.
Best regards

2017-01-19 16:54 GMT-03:00 Martin Lízner - AMI Praha a.s. <
martin.lizner at ami.cz>:

> 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.Assignm
>>> entType;
>>>   import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectR
>>> eferenceType;
>>>   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
>>
>>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint
>
>


-- 
*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/20170120/892e75e1/attachment.htm>


More information about the midPoint mailing list