[midPoint] ComplexType inside Schema Extension?

Jason Everling jeverling at bshp.edu
Tue Jun 20 21:31:04 CEST 2017


This works below and posted what it produces, I didn't add any ordering,
displayName, or indexing so it is just displayed randomly and the raw
values,

<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: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>

[image: Inline image 1]

JASON

On Tue, Jun 20, 2017 at 11:52 AM, Alcides Carlos de Moraes Neto <
alcides.neto at gmail.com> wrote:

> Hi Glenn, that's correct, thanks.
> The id and both dates are related.
> We're now considering creating a generic object "Exercicio" instead, and
> just referencing it to the user, and/or vice versa.
>
> 2017-06-20 3:21 GMT-03:00 BOSCHMANS Glenn <gboschmans at cibg.brussels>:
>
>> Hi Jason,
>>
>>
>>
>> I think he wants to be able to add multiple elements of ExercicioType to
>> a user.
>>
>>
>>
>> Br,
>>
>> Glenn
>>
>>
>>
>> *Glenn Boschmans*
>> Consultant
>> Business Integrated Solutions
>> Kunstlaan 21, 1000 Brussel - cibg.brussels - disclaimer
>> <http://cibg.brussels/disclaimer-1>
>> +32 2 282 47 70 <+32%202%20282%2047%2070> |
>> Be green, leave it on the screen !
>> <http://www.linkedin.com/company/cirb_cibg>
>> <https://twitter.com/CIRB_CIBG>
>> <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> 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/conne
>> ctor/icf-1/resource-schema-3"
>>
>>       xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resourc
>> e/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:dataIn
>> icioExercicio>
>>
>>        </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.evo
>> lveum.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}idExercicio => parser
>> ValueParser(DOMe, {http://example.com/xml/ns/mySchema}idExercicio: 123) {
>> http://example.com/xml/ns/mySchema}dataInicioExercicio => parser
>> ValueParser(DOMe, {http://example.com/xml/ns/mySchema}dataInicioExercicio:
>> 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
>> http://lists.evolveum.com/mailman/listinfo/midpoint
>>
>>
>>
>> _______________________________________________
>> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170620/f6ac272d/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tw_20cfb408-d952-4ea7-a757-a8716eaac012.png
Type: image/png
Size: 464 bytes
Desc: not available
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170620/f6ac272d/attachment.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: not available
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170620/f6ac272d/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cibg_aee22c14-e9ed-4d7b-8c27-f6c4a26e7736.png
Type: image/png
Size: 11221 bytes
Desc: not available
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170620/f6ac272d/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ln_e679eb12-caaa-4d0d-b64d-b39c820c309b.png
Type: image/png
Size: 722 bytes
Desc: not available
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170620/f6ac272d/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 12925 bytes
Desc: not available
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170620/f6ac272d/attachment-0003.png>


More information about the midPoint mailing list