[midPoint] ComplexType inside Schema Extension?

BOSCHMANS Glenn gboschmans at cibg.brussels
Tue Jun 20 08:21:16 CEST 2017


Hi Jason,

I think he wants to be able to add multiple elements of ExercicioType to a user.

Br,
Glenn

[cid:cibg_aee22c14-e9ed-4d7b-8c27-f6c4a26e7736.png]

Glenn Boschmans
Consultant
Business Integrated Solutions
Kunstlaan 21, 1000 Brussel - cibg.brussels<http://cibg.brussels> - disclaimer<http://cibg.brussels/disclaimer-1>
+32 2 282 47 70 |
Be green, leave it on the screen !                                                       [cid:ln_e679eb12-caaa-4d0d-b64d-b39c820c309b.png] <http://www.linkedin.com/company/cirb_cibg>   [cid:tw_20cfb408-d952-4ea7-a757-a8716eaac012.png] <https://twitter.com/CIRB_CIBG>   [cid:logo_eco_mail_e3e2fbdd-9cbf-4a5b-b0c1-1624e00ef4cd.jpg] <http://www.leefmilieu.brussels/themas/duurzame-stad/label-ecodynamische-onderneming>

From: midPoint [mailto:midpoint-bounces at lists.evolveum.com] On Behalf Of Jason Everling
Sent: maandag 19 juni 2017 22:49
To: midPoint General Discussion
Subject: Re: [midPoint] ComplexType inside Schema Extension?

Is there a reason for having to add a new complextype and not just use the one already there and add your attributes? It would look like below,

<xsd:schema elementFormDefault="qualified"
            targetNamespace="http://example.com/xml/ns/mySchema"
            xmlns:tns="http://example.com/xml/ns/mySchema"
            xmlns:a="http://prism.evolveum.com/xml/ns/public/annotation-3"
            xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema">

    <xsd:complexType name="UserExtensionType">
        <xsd:annotation>
            <xsd:appinfo>
                <a:extension ref="c:UserType"/>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
                        <xsd:element name="idExercicio" type="xsd:string" minOccurs="1"></xsd:element>
                        <xsd:element name="dataInicioExercicio" type="xsd:dateTime" minOccurs="1"></xsd:element>
            <xsd:element name="dataFimExercicio" type="xsd:dateTime" minOccurs="0"></xsd:element>
        </xsd:sequence>
    </xsd:complexType>
</xsd:schema>



As for your way I think you have to reference the type,

    <xsd:complexType name="ExercicioType">
        <xsd:annotation>
            <xsd:appinfo>
                <a:extension ref="c:UserType"/>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name ="idExercicio" type="xsd:string" minOccurs="1"></xsd:element>
            <xsd:element name="dataInicioExercicio" type="xsd:dateTime" minOccurs="1"></xsd:element>
            <xsd:element name="dataFimExercicio" type="xsd:dateTime" minOccurs="0"></xsd:element>
        </xsd:sequence>
    </xsd:complexType>


JASON

On Mon, Jun 19, 2017 at 3:35 PM, Alcides Carlos de Moraes Neto <alcides.neto at gmail.com<mailto:alcides.neto at gmail.com>> wrote:
Hello,

I'm trying to create a user extension attribute that is a complexType. I'm able to import the schema, but I cannot save the object using the XML editor.

Here's my XSD:

<xsd:schema elementFormDefault="qualified"
            targetNamespace="http://example.com/xml/ns/mySchema"
            xmlns:tns="http://example.com/xml/ns/mySchema"
            xmlns:a="http://prism.evolveum.com/xml/ns/public/annotation-3"
            xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema">

    <xsd:complexType name="UserExtensionType">
        <xsd:annotation>
            <xsd:appinfo>
                <a:extension ref="c:UserType"/>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
        <xsd:element name="exercicio" minOccurs="0" maxOccurs="unbounded" type="tns:ExercicioType"></xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="ExercicioType">
        <xsd:sequence>
            <xsd:element name ="idExercicio" type="xsd:string" minOccurs="1"></xsd:element>
            <xsd:element name="dataInicioExercicio" type="xsd:dateTime" minOccurs="1"></xsd:element>
            <xsd:element name="dataFimExercicio" type="xsd:dateTime" minOccurs="0"></xsd:element>
        </xsd:sequence>
    </xsd:complexType>
</xsd:schema>

Here's my user. It's a very simple user I created first using the GUI. I then added the <extension>

<user xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
      xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
      xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
      xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3"
      xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"
      xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"
      oid="542aba1d-457f-43bc-9664-3b91e30ea416"
      version="2">
   <name>Fulano</name>
   <extension xmlns:ex="http://example.com/xml/ns/mySchema">
       <ex:exercicio>
           <ex:idExercicio>123</ex:idExercicio>
           <ex:dataInicioExercicio>2017-06-19T17:02:31.468Z</ex:dataInicioExercicio>
       </ex:exercicio>
   </extension>
   <metadata>
      <requestTimestamp>2017-06-19T17:02:31.468Z</requestTimestamp>
      <requestorRef oid="00000000-0000-0000-0000-000000000002" type="c:UserType"><!-- administrator --></requestorRef>
      <createTimestamp>2017-06-19T17:02:31.540Z</createTimestamp>
      <creatorRef oid="00000000-0000-0000-0000-000000000002" type="c:UserType"><!-- administrator --></creatorRef>
      <createChannel>http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user</createChannel>
      <modifyTimestamp>2017-06-19T17:17:08.229Z</modifyTimestamp>
      <modifierRef xmlns:tns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
                   oid="00000000-0000-0000-0000-000000000002"
                   type="tns:UserType"><!-- administrator --></modifierRef>
      <modifyChannel>http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user</modifyChannel>
   </metadata>
   <activation>
      <effectiveStatus>enabled</effectiveStatus>
      <enableTimestamp>2017-06-19T17:02:31.493Z</enableTimestamp>
   </activation>
   <iteration>0</iteration>
   <iterationToken/>
</user>

I get the following error:
Cannot parse as {http://example.com/xml/ns/mySchema}ExercicioType<http://example.com/xml/ns/mySchema%7DExercicioType>: ( {http://example.com/xml/ns/mySchema}idExercicio<http://example.com/xml/ns/mySchema%7DidExercicio> => parser ValueParser(DOMe, {http://example.com/xml/ns/mySchema}idExercicio<http://example.com/xml/ns/mySchema%7DidExercicio>: 123) {http://example.com/xml/ns/mySchema}dataInicioExercicio<http://example.com/xml/ns/mySchema%7DdataInicioExercicio> => parser ValueParser(DOMe, {http://example.com/xml/ns/mySchema}dataInicioExercicio<http://example.com/xml/ns/mySchema%7DdataInicioExercicio>: 2017-06-19T17:02:31.468Z) )

Is this not possible? I have not seen any examples or questions.





_______________________________________________
midPoint mailing list
midPoint at lists.evolveum.com<mailto: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/20170620/b1912b56/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cibg_aee22c14-e9ed-4d7b-8c27-f6c4a26e7736.png
Type: image/png
Size: 11221 bytes
Desc: cibg_aee22c14-e9ed-4d7b-8c27-f6c4a26e7736.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170620/b1912b56/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ln_e679eb12-caaa-4d0d-b64d-b39c820c309b.png
Type: image/png
Size: 722 bytes
Desc: ln_e679eb12-caaa-4d0d-b64d-b39c820c309b.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170620/b1912b56/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tw_20cfb408-d952-4ea7-a757-a8716eaac012.png
Type: image/png
Size: 464 bytes
Desc: tw_20cfb408-d952-4ea7-a757-a8716eaac012.png
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170620/b1912b56/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logo_eco_mail_e3e2fbdd-9cbf-4a5b-b0c1-1624e00ef4cd.jpg
Type: image/jpeg
Size: 1260 bytes
Desc: logo_eco_mail_e3e2fbdd-9cbf-4a5b-b0c1-1624e00ef4cd.jpg
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170620/b1912b56/attachment.jpg>


More information about the midPoint mailing list