Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The custom schema extension is specified in the XML Schema Description (XSD) format similarly similar to other schemas in midPoint. It is using XSD annotations to specify details that XSD cannot specify. E.g. it is using an a:extension annotation to bind the complex type definition to the midPoint object type.

...

Attribute name is the name by which midPoint knows the attribute. It is used in mappings and configuration. Display name is what midPoint will display in forms and reports. Attribute type determines the type and range or attribute values. The schema may also define attribute multiplicity, whether it is mandatory or optional, define the order in which it will be displayed in forms, define a help text, etc. Most of that is defined using XSD annotations and it is optional.

Defining the schema extension is all that midPoint needs to make full use of the attribute. Once it is defined in the schema midPoint will display the attribute in the GUI and it will be displayed using suitable user field, checked for mandatory value, the attribute may be used in mappings, etc. It will behave as if it always was a part of midPoint. The small additional configuration is required only when these attributes are used in mappings. Then you have to give let configuration know in which namespace it should look for an attribute definition. This is namespace introduced in field targetNamespace from a header of the extension xsd file.

...

Currently the custom schema extension has to be available to midPoint at the startup time. Therefore it is not stored in the identity repository (database) and cannot be dynamically changed when the system is running.

The schema files has have to be placed in the schema subdirectory of midpoint.home directory. The name of the file does not matter as long as it ends with .xsd extension. There also may be subdirectories. When MidPoint starts it scans the directory and all subdirectories and loads all the schemas that it finds there.

...

It is possible to define custom attributes using midPoint types. For example, if there is a need to specify various activation status types for users in your environment, it is possible to define a custom attribute for activation using ActivationStatusType type. If there is another requirement e.g. for supporting more than one password for the user, ProtectedStringType can be use used in such a case. To allow using of midPoint types, proper schemas have to be added to the extension schema definition using import element as the example bellow below shows:

 

Code Block
languagexml
<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: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:complexType name="UserExtensionType">
        <xsd:annotation>
            <xsd:appinfo>
                <a:extension ref="c:UserType"/>
            </xsd:appinfo>
        </xsd:annotation>
        <xsd:sequence>
          	<xsd:element name="customAdministrativeStatus" type="c:ActivationStatusType" minOccurs="0">
                <xsd:annotation>
                    <xsd:appinfo>
                        <a:indexed>true</a:indexed>
                        <a:displayName>Custom Administrative status</a:displayName>
                        <a:displayOrder>250</a:displayOrder>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
			<xsd:element name="secondaryPassword" type="t:ProtectedStringType" minOccurs="0">
                <xsd:annotation>
                    <xsd:appinfo>
                        <a:indexed>false</a:indexed>
                        <a:displayName>Secondary Password</a:displayName>
                        <a:displayOrder>260</a:displayOrder>
                    </xsd:appinfo>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

</xsd:schema>

...