[midPoint] Schema user attribute is not updated during inbound mapping

Mercedes Oncina Deltell moncina at um.es
Wed Mar 2 11:28:34 CET 2022


Solved!

I use the following Groovy code:

/if (input == null) {//
//  def verCode = UUID.randomUUID().toString()//
//  return verCode//
//}/

It generates UUIDs in the form: 5eaaa9d3-26fe-4e18-9e37-4469999f1b06, 
perfect!

But I still can't get this generated value to be stored in the 
employeeNumber attribute of the user schema attribute of midPoint, it is 
stored in the database correctly, but the employeeNumber attribute is 
still null in midPoint.

My inbound and outbound mapping is:

/<attribute id="30">//
//                <ref>ri:AFI_ID</ref>//
//                <description>Identificador único, generado 
automáticamente</description>//
//                <matchingRule 
xmlns:gen459="http://prism.evolveum.com/xml/ns/public/matching-rule-3">gen459:default</matchingRule>//
//                <tolerant>true</tolerant>//
//<exclusiveStrong>false</exclusiveStrong>//
//*<outbound>*//
//<authoritative>true</authoritative>//
//<exclusive>false</exclusive>//
//                    <strength>normal</strength>//
//                    <source>//
//<path>$focus/employeeNumber</path>//
//                    </source>//
//                    <target>//
//<path>$projection/attributes/AFI_ID</path>//
//                    </target>//
//                </outbound>//
//*<inbound id="49">*//
//<authoritative>true</authoritative>//
//<exclusive>false</exclusive>//
//                    <strength>normal</strength>//
//                    <expression>//
//                        <script>//
//                           <code>//
//                                if (input == null) {
                                     def verCode = 
UUID.randomUUID().toString()
                                     return verCode
                                 }
//                           </code>//
//                        </script>//
//                    </expression>//
//                    <target>//
//<path>$focus/employeeNumber</path>//
//                    </target>//
//                </inbound>//
//            </attribute>/


El 17/02/2022 a las 9:21, midpoint-request at lists.evolveum.com escribió:
> ----------------------------------------------------------------------
>
> Message: 2
> Date: Thu, 17 Feb 2022 09:21:11 +0100
> From: MERCEDES ONCINA DELTELL<moncina at um.es>
> To:midpoint at lists.evolveum.com
> Subject: Re: [midPoint] Error in script condition during inbound
> 	mapping
> Message-ID:
> 	<20220217092111.Horde.cixgCxTnahig_t8VwNcjHUe at webmail.um.es>
> Content-Type: text/plain; charset="utf-8"; Format="flowed";
> 	DelSp="Yes"
>
>    I have configured the condition with input == null and midPoint
> generates correctly the value and update it into the database table,
> but it is not mapped into the employeeNumber attribute, I do not know
> why, it is null in midPoint while it has a value in the table, also,
> if I reconcile the user, the value in the database table remains
> intact, this behaviour is perfect, but I can not see this value in the
> midPoint user.
>
> On the other hand, I have seen the kind of values that midPoint
> generates with this expression, 8 alphanumeric characters. What I want
> is to generate an UUID, so I am trying to use the "uuidgen" Linux
> command, and I have tried this:
>    <script xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3">
>       <code>
>          "uuidgen -x -r".execute()
>       </code>
>    </script>
>
>    But the error I get when I try to import a user is:
>
> Expected class java.lang.String type, but got class
> java.lang.ProcessImpl in expression in mapping in inbound expression
> for AFI_ID in
> resource:3a091f48-850c-4ee8-ae1c-eac5c264c41c(MIDPOINT.AFILIACIONES)(actor=user:00000000-0000-0000-0000-000000000002(administrator); input=null; resource=resource:3a091f48-850c-4ee8-ae1c-eac5c264c41c(MIDPOINT.AFILIACIONES); configuration=systemConfiguration:00000000-0000-0000-0000-000000000001(SystemConfiguration); focus (user)=user:null(null); projection (shadow, account)=shadow:e6452b1b-496a-429a-8d07-3452e5b6c1ee(34812812); operation=add; ) in expression in mapping in inbound expression for AFI_ID in
> resource:3a091f48-850c-4ee8-ae1c-eac5c264c41c(MIDPOINT.AFILIACIONES)
>
> Thanks.
>
>
> midpoint-request at lists.evolveum.com  escribió:
>
>> ------------------------------
>>
>> Message: 2
>> Date: Wed, 16 Feb 2022 14:15:51 +0100
>> From: Mercedes Oncina Deltell<moncina at um.es>
>> To:midpoint at lists.evolveum.com
>> Subject: [midPoint] Error in script condition during inbound mapping
>> Message-ID:<224b64b9-93b8-28ed-815b-521651eedf23 at um.es>
>> Content-Type: text/plain; charset="utf-8"; Format="flowed"
>>
>> Hello again.
>>
>> I have learned a lot about midPoint during last week. Now, I have a new
>> question.
>>
>> I want to import an attribute which could be null in the database table,
>> it is mapped into the employeeNumber attribute of the user schema in
>> midPoint. If it is null in the database, I want to random generate a
>> value and map it into the attribute, but if it contains a value, I just
>> only want to import it.
>>
>> As this employeeNumber should always have a value in midPoint, it is
>> mapped out to the property AFI_ID in the database table. My objective
>> is, if in database the value is null, midPoint will generate this value
>> and then, update it to the database again.
>>
>> I have tried many configurations and (I think) I know where the problem
>> is, in the script code of the condition of the inbound mapping:
>>
>> /<attribute id="30">//
>> //*<ref>ri:AFI_ID</ref>*//
>> //                <description>Identificador único, generado
>> automáticamente</description>//
>> //                <matchingRule
>> xmlns:gen459="http://prism.evolveum.com/xml/ns/public/matching-rule-3">gen459:default</matchingRule>//
>> //                <tolerant>true</tolerant>//
>> //<exclusiveStrong>false</exclusiveStrong>//
>> /*/                <outbound>/*/
>> //<authoritative>true</authoritative>//
>> //<exclusive>false</exclusive>//
>> //<strength>normal</strength>//
>> //*<source>*/*/
>> /**/<path>$focus/employeeNumber</path>/**/
>> /**/                    </source>/**/
>> /**/                </outbound>/*/
>> //                <inbound id="49">//
>> //<authoritative>true</authoritative>//
>> //<exclusive>false</exclusive>//
>> //<strength>normal</strength>//
>> //*<expression>*/*/
>> /**/                        <generate/>/**/
>> /**/                    </expression>/*/
>> //                    <target>//
>> //<path>$focus/employeeNumber</path>//
>> //                    </target>//
>> //*<condition>*/*/
>> /**/                        <script>/**/
>> /**/                           <code>/**/
>> /**/$projection/attributes/AFI_ID == null/**/
>> /**/                           </code>/**/
>> /**/                        </script>/**/
>> /**/                    </condition>/*/
>> //                </inbound>//
>> //            </attribute>/
>>
>> But this configuration is not correct, maybe because it is not a Groovy
>> expression, the error when I try to reconcile or import an user is:
>>
>> Groovy Evaluation Failed: No such property: $projection for class:
>> condition_in_mapping_in_inbound_expression_for_AFI_ID_in_resource_3a091f48-850c-4ee8-ae1c-eac5c264c41c(MIDPOINT(actor=user:00000000-0000-0000-0000-000000000002(administrator);
>> input=PPV(String:wB7TPNFn);
>> resource=resource:3a091f48-850c-4ee8-ae1c-eac5c264c41c(MIDPOINT.AFILIACIONES);
>> configuration=systemConfiguration:00000000-0000-0000-0000-000000000001(SystemConfiguration);
>> focus (user)=user:null(null); projection (shadow,
>> account)=shadow:4a56dbf2-93ab-4ae5-8b4d-3747f34711fe(34812808);
>> operation=add; ) in condition in mapping in inbound expression for
>> AFI_ID in
>> resource:3a091f48-850c-4ee8-ae1c-eac5c264c41c(MIDPOINT.AFILIACIONES)
>>
>> Could anyone advice me about this kind of expressions?
>>
>> Thanks in advance.
>>
>> --
>> Mercedes Oncina Deltell
>> Servicio de Infraestructuras TICS
>> ATICA - Universidad de Murcia
>> Telf: +34 868881983
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> <https://lists.evolveum.com/pipermail/midpoint/attachments/20220216/61772317/attachment-0001.htm>
>>
>> ------------------------------
>>
>> Message: 3
>> Date: Wed, 16 Feb 2022 17:18:49 +0000
>> From: Paulo Fernandes de Souza Junior<PFSJ at senado.leg.br>
>> To: midPoint General Discussion<midpoint at lists.evolveum.com>
>> Cc: Mercedes Oncina Deltell<moncina at um.es>
>> Subject: Re: [midPoint] Error in script condition during inbound
>>          mapping
>> Message-ID:<1645031929533.1242 at senado.leg.br>
>> Content-Type: text/plain; charset="iso-8859-1"
>>
>> Use input == null in the condition.
>>
>> Paulo Fernandes de Souza Júnior
>> NQPPPS
>> Senado Federal - PRODASEN
>> Fone: 61 3303.3924
>>
>> ________________________________
>> De: midPoint<midpoint-bounces at lists.evolveum.com>  em nome de
>> Mercedes Oncina Deltell via midPoint<midpoint at lists.evolveum.com>
>> Enviado: quarta-feira, 16 de fevereiro de 2022 10:15
>> Para:midpoint at lists.evolveum.com
>> Cc: Mercedes Oncina Deltell
>> Assunto: [midPoint] Error in script condition during inbound mapping
>>
>> Hello again.
>>
>> I have learned a lot about midPoint during last week. Now, I have a
>> new question.
>>
>> I want to import an attribute which could be null in the database
>> table, it is mapped into the employeeNumber attribute of the user
>> schema in midPoint. If it is null in the database, I want to random
>> generate a value and map it into the attribute, but if it contains a
>> value, I just only want to import it.
>>
>> As this employeeNumber should always have a value in midPoint, it is
>> mapped out to the property AFI_ID in the database table. My
>> objective is, if in database the value is null, midPoint will
>> generate this value and then, update it to the database again.
>>
>> I have tried many configurations and (I think) I know where the
>> problem is, in the script code of the condition of the inbound
>> mapping:
>>
>>             <attribute id="30">
>>                 <ref>ri:AFI_ID</ref>
>>                 <description>Identificador único, generado
>> automáticamente</description>
>>                 <matchingRule
>> xmlns:gen459="http://prism.evolveum.com/xml/ns/public/matching-rule-3"<http://prism.evolveum.com/xml/ns/public/matching-rule-3>>gen459:default</matchingRule>
>>                 <tolerant>true</tolerant>
>>                 <exclusiveStrong>false</exclusiveStrong>
>>                 <outbound>
>>                     <authoritative>true</authoritative>
>>                     <exclusive>false</exclusive>
>>                     <strength>normal</strength>
>>                     <source>
>>                         <path>$focus/employeeNumber</path>
>>                     </source>
>>                 </outbound>
>>                 <inbound id="49">
>>                     <authoritative>true</authoritative>
>>                     <exclusive>false</exclusive>
>>                     <strength>normal</strength>
>>                     <expression>
>>                         <generate/>
>>                     </expression>
>>                     <target>
>>                         <path>$focus/employeeNumber</path>
>>                     </target>
>>                     <condition>
>>                         <script>
>>                            <code>
>>                               $projection/attributes/AFI_ID == null
>>                            </code>
>>                         </script>
>>                     </condition>
>>                 </inbound>
>>             </attribute>
>>
>> But this configuration is not correct, maybe because it is not a
>> Groovy expression, the error when I try to reconcile or import an
>> user is:
>>
>> Groovy Evaluation Failed: No such property: $projection for class:
>> condition_in_mapping_in_inbound_expression_for_AFI_ID_in_resource_3a091f48-850c-4ee8-ae1c-eac5c264c41c(MIDPOINT(actor=user:00000000-0000-0000-0000-000000000002(administrator); input=PPV(String:wB7TPNFn); resource=resource:3a091f48-850c-4ee8-ae1c-eac5c264c41c(MIDPOINT.AFILIACIONES); configuration=systemConfiguration:00000000-0000-0000-0000-000000000001(SystemConfiguration); focus (user)=user:null(null); projection (shadow, account)=shadow:4a56dbf2-93ab-4ae5-8b4d-3747f34711fe(34812808); operation=add; ) in condition in mapping in inbound expression for AFI_ID in
>> resource:3a091f48-850c-4ee8-ae1c-eac5c264c41c(MIDPOINT.AFILIACIONES)
>>
>> Could anyone advice me about this kind of expressions?
>>
>> Thanks in advance.
>>
>> --
>> Mercedes Oncina Deltell
>> Servicio de Infraestructuras TICS
>> ATICA - Universidad de Murcia
>> Telf: +34 868881983
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> <https://lists.evolveum.com/pipermail/midpoint/attachments/20220216/53f41c2a/attachment.htm>
>>
>> ------------------------------
>>
>> Subject: Digest Footer
>>
>> _______________________________________________
>> midPoint mailing list
>> midPoint at lists.evolveum.com
>> https://lists.evolveum.com/mailman/listinfo/midpoint
>>
>> ------------------------------
>>
>> End of midPoint Digest, Vol 118, Issue
>> 34*****************************************
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:<https://lists.evolveum.com/pipermail/midpoint/attachments/20220217/ce52e5f7/attachment.htm>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> https://lists.evolveum.com/mailman/listinfo/midpoint
>
>
> ------------------------------
>
> End of midPoint Digest, Vol 118, Issue 37
> *****************************************

-- 
Mercedes Oncina Deltell
Servicio de Infraestructuras TICS
ATICA - Universidad de Murcia
Telf: +34 868881983
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220302/2728ee9e/attachment-0001.htm>


More information about the midPoint mailing list