[midPoint] enumeration type for an attribute

Martin Kuba makub at muni.cz
Thu May 6 17:35:18 CEST 2021


Dear all,

I am trying to define an extension attribute for users of enumeration type.
The documentation at https://docs.evolveum.com/midpoint/reference/schema/custom-schema-extension/
lists "enumerations" in the section "Data Types Supported" as a supported type.

I have created a file ${midpoint.home}/schema/user.xsd with the following content:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsd:schema elementFormDefault="qualified"
            targetNamespace="urn:perun:user"
            xmlns:tns="urn:perun:user"
            xmlns:a="http://prism.evolveum.com/xml/ns/public/annotation-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:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:import namespace="http://midpoint.evolveum.com/xml/ns/public/common/common-3"/>
    <xsd:import namespace="http://prism.evolveum.com/xml/ns/public/types-3"/>

    <xsd:simpleType name="FruitsType">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="kiwi"/>
            <xsd:enumeration value="apple"/>
            <xsd:enumeration value="orange"/>
            <xsd:enumeration value="banana"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="UserExtensionType">
        <xsd:annotation>
            <xsd:appinfo>
                <a:extension ref="c:UserType"/>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="favoriteFruit" type="tns:FruitsType" minOccurs="0"/>
        </xsd:sequence>
    </xsd:complexType>
</xsd:schema>

The attribute shows up in the user attributes form, even its value is a selection list
with the correct values.

But when I select a value and save the user, an error appears:

2021-05-06 17:25:28,914 [] [ajp-nio-127.0.0.1-8009-exec-10] ERROR (com.evolveum.midpoint.gui.impl.factory.wrapper.PrismObjectWrapperFactoryImpl): Exception while applying security constraints: Cannot parse as {urn:perun:user}FruitsType because bean unmarshaller cannot process it (generated bean classes are missing?): parser ValueParser(DOM-less, apple, namespace declarations)
com.evolveum.midpoint.util.exception.SchemaException: Cannot parse as {urn:perun:user}FruitsType because bean unmarshaller cannot process it (generated bean classes are missing?): parser ValueParser(DOM-less, apple, namespace declarations)
	at com.evolveum.midpoint.prism.impl.ParsingContextImpl.warnOrThrow(ParsingContextImpl.java:90)

Since that time, I cannot display the user, the same error appears again.
I cannot even see its XML in "Repository objects" in GUI or download it in the midPoint Studio IDEA plugin.

What am I doing wrong?

Best regards

Martin Kuba
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IT Infrastructure Division             Martin Kuba
Institute of Computer Science    email: makub at ics.muni.cz
Masaryk University             http://www.ics.muni.cz/~makub/
Šumavská 15, 60200 Brno, CZ     mobil: +420-603-533775
--------------------------------------------------------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4326 bytes
Desc: Elektronicky podpis S/MIME
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20210506/1c92c8ca/attachment.bin>


More information about the midPoint mailing list