[midPoint] Mapping resource attributes to custom schema attributes

Ivan Noris ivan.noris at evolveum.com
Thu May 30 11:54:20 CEST 2013


Hi Remi,


On 05/30/2013 11:29 AM, Tys Remi wrote:
> Hello again,
>
> I am having trouble mapping my csv file to the internal repository.
> The thing is that I do not know how to handle the custom schema extension attributes.
> This is an example of one of the attributes in my schema handling in the csv resource object.
>
> <c:attribute>
>              <c:ref xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-2">ri:city</c:ref>
>              <c:displayName>City</c:displayName>
>              <c:inbound>
>                 <c:target>
>                    <c:path xmlns:gen544="http://midpoint.evolveum.com/xml/ns/fake/sqlRepository-1.xsd"
>                            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>                            xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-2"
>                            xmlns:gen53="http://midpoint.evolveum.com/xml/ns/fake/sqlRepository-1.xsd"
>                            xmlns:my="http://myself.me/schemas/whatever"
>                            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">$user/extension/city</c:path>
>                 </c:target>
>              </c:inbound>
> </c:attribute>
>
> I have tried mapping it without the /extension part as well but I can't figure out how I'm supposed to map it.
>
> My idm.log shows errors like: No target item found that would conform to the path ${.../common/common-2a}user/{.../common/common-2a}extension/{.../common/common-2a}/city
>
>  From what I understand from the live demo is that I need to address it as $user/extension/ext:city and declare the namespace from my extension.xsd file in the path as xmlns:ext, but everytime I add it and save it, it disappears the next time I open it.
>

You are right regarding to the addressing the custom/schema attribute. 
It should be $user/extension/ext:city and ext should be declared as a 
prefix for your namespace.

Consider this example:

                <attribute>
                     <ref>ri:managerPersonNumber</ref>
                     <displayName>Manager Employee Number</displayName>
                     <access>read</access>
                     <inbound>
                       <target>
                         
<path>*$user/extension/customer1:managerEmployeeNumber*</path>
                       </target>
                     </inbound>
                 </attribute>

I define the "*customer1*" prefix for my custom namespace in the XML 
file with my resource/object definition:

<objects xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-2a"
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-2a"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:q="http://prism.evolveum.com/xml/ns/public/query-2"
xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instanc
e-2"
            xmlns:my="http://myself.me/schemas/whatever"
xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-
1/resource-schema-2"
xmlns:icfc="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-2"
*xmlns:customer1="http://evolveum.com/customer1"*>

     <resource oid="ef2bc95b-76e0-48e2-86d6-a000ff000002">
...

This definitely works. (It's from my customer resource definition.)

Maybe you are encountering a bug with embedded XML editor. I recommend 
you to use an XML file with your resource definition and put the inbound 
and the custom attribute and namespaces there. (This will also help you 
in the future if you want to track your configuration changes in 
Subversion, git etc.)

Please let me know if it works this way (it should, we're using it). If 
there is a bug with the embedded editor, we have to confirm it in trunk 
(to-be-2.2 version). So let us know anyway.

Hope this helps.

Regards,
Ivan

-- 
   Ing. Ivan Noris
   Consultant
   Evolveum, s.r.o
   ___________________________________________________
   "Semper cautus - semper paratus - semper idem Vix."

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20130530/445c9595/attachment.htm>


More information about the midPoint mailing list