[midPoint] Add complex type element to user type
Pavol Mederly
mederly at evolveum.com
Wed Mar 1 18:07:54 CET 2017
Dmitriy,
I'm afraid you are out of luck here. Although midPoint can (most
probably) store custom complex types in objects' extensions, I'm almost
sure it cannot display them correctly in the GUI. I suggest you to
somehow "break" the data into primitive - multivalued if needed - items.
Pavol Mederly
Software developer
evolveum.com
On 01.03.2017 15:51, Dmitriy Berezkin wrote:
> Hi!
>
> Thank you for example!
>
> Yes, I checked this link
> https://github.com/Evolveum/midpoint/blob/master/samples/schema/extension-samples.xsd
> and didnt found how complex element used in UserExtensionType.
>
> I added my custom object “JobType” to UserExtensionType like this:
> <xsd:element name="jobs" type="tns:JobType" minOccurs="0"
> maxOccurs="unbounded”/>
>
> Here is xsd part for “JobType":
> <xsd:complexType name="JobType">
> <xsd:sequence>
> <xsd:element name="jobTitle" type="xsd:string" minOccurs="0"
> maxOccurs="1">
> <xsd:annotation>
> <xsd:appinfo>
> <a:indexed>true</a:indexed>
> <a:displayName>job title</a:displayName>
> <a:displayOrder>310</a:displayOrder>
> </xsd:appinfo>
> </xsd:annotation>
> </xsd:element>
> </xsd:sequence>
> </xsd:complexType>
>
> And now I can see custom fields in midpoint:
>
>
> But it gives me an error of I try to save them:
> Caused by: java.lang.IllegalStateException: Cannot parse as
> {http://example.com/xml/ns/mySchema}JobType: parser ValueParser(DOMe,
> {http://example.com/xml/ns/mySchema}jobs: 1)
>
> ---
> Dmitry
>
> On 22 февр. 2017 г., 21:31 +0300, Jason Everling <jeverling at bshp.edu>,
> wrote:
>> can you post what have so far? Here is ours, trimmed down of course
>> as we have many types from orgs, roles, and user types
>>
>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>>
>> <xsd:schema elementFormDefault="qualified"
>> targetNamespace="http://midpoint.bshp.edu/bshp"
>> xmlns:tns="http://midpoint.bshp.edu/bshp"
>>
>> xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
>>
>> xmlns:a="http://prism.evolveum.com/xml/ns/public/annotation-3"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>
>> <!-- Enumerated Objects -->
>> <xsd:simpleType name="bshpAffiliation">
>> <xsd:annotation>
>> <xsd:documentation>Choices for Affiliation</xsd:documentation>
>> </xsd:annotation>
>> <xsd:restriction base="xsd:string">
>> <xsd:enumeration value="faculty">
>> <xsd:annotation>
>> <xsd:appinfo>
>> <a:label>faculty</a:label>
>> </xsd:appinfo>
>> </xsd:annotation>
>> </xsd:enumeration>
>> <xsd:enumeration value="staff">
>> <xsd:annotation>
>> <xsd:appinfo>
>> <a:label>staff</a:label>
>> </xsd:appinfo>
>> </xsd:annotation>
>> </xsd:enumeration>
>> <xsd:enumeration value="student">
>> <xsd:annotation>
>> <xsd:appinfo>
>> <a:label>student</a:label>
>> </xsd:appinfo>
>> </xsd:annotation>
>> </xsd:enumeration>
>> <xsd:enumeration value="alumni">
>> <xsd:annotation>
>> <xsd:appinfo>
>> <a:label>alumni</a:label>
>> </xsd:appinfo>
>> </xsd:annotation>
>> </xsd:enumeration>
>> <xsd:enumeration value="external">
>> <xsd:annotation>
>> <xsd:appinfo>
>> <a:label>external</a:label>
>> </xsd:appinfo>
>> </xsd:annotation>
>> </xsd:enumeration>
>> </xsd:restriction>
>> </xsd:simpleType>
>>
>> <!-- User Extension -->
>>
>> <xsd:complexType name="UserTypeExtensionType">
>> <xsd:annotation>
>> <xsd:appinfo>
>> <a:extension ref="c:UserType"/>
>> </xsd:appinfo>
>> </xsd:annotation>
>> <xsd:sequence>
>> <xsd:element name="otherMailbox" type="xsd:string"
>> minOccurs="0" maxOccurs="unbounded">
>> <xsd:annotation>
>> <xsd:appinfo>
>> <a:indexed>true</a:indexed>
>> <a:displayName>Other Mailbox</a:displayName>
>> <a:displayOrder>120</a:displayOrder>
>> <a:help>someone at example.com
>> <mailto:someone at example.com></a:help>
>> </xsd:appinfo>
>> </xsd:annotation>
>> </xsd:element>
>> <xsd:element name="campus" type="xsd:string"
>> minOccurs="0" maxOccurs="1">
>> <xsd:annotation>
>> <xsd:appinfo>
>> <a:indexed>true</a:indexed>
>> <a:displayName>Campus</a:displayName>
>> <a:displayOrder>160</a:displayOrder>
>> </xsd:appinfo>
>> </xsd:annotation>
>> </xsd:element>
>> <xsd:element name="bshpAffiliation" type="tns:bshpAffiliation"
>> minOccurs="0" maxOccurs="1">
>> <xsd:annotation>
>> <xsd:appinfo>
>> <a:indexed>true</a:indexed>
>> <a:displayName>Affiliation</a:displayName>
>> <a:displayOrder>170</a:displayOrder>
>> </xsd:appinfo>
>> </xsd:annotation>
>> </xsd:element>
>> </xsd:sequence>
>> </xsd:complexType>
>> </xsd:schema>
>>
>> JASON
>>
>>
>> On Wed, Feb 22, 2017 at 12:24 PM, Pálos Gustáv
>> <gustav.palos at evolveum.com <mailto:gustav.palos at evolveum.com>> wrote:
>>
>> Hi Dmitry,
>>
>> do you checked for example this sample?
>> https://github.com/Evolveum/midpoint/blob/master/samples/schema/extension-samples.xsd
>> <https://github.com/Evolveum/midpoint/blob/master/samples/schema/extension-samples.xsd>
>>
>> best regards,
>>
>> Gustav
>>
>> 2017-02-22 18:49 GMT+01:00 Dmitriy Berezkin
>> <berezkin.dmitriy at gmail.com <mailto:berezkin.dmitriy at gmail.com>>:
>>
>> Hi!
>>
>> Could you tell me how I can extend UserType with
>> complexType object?
>>
>> I tried to add <xsd:complexType> under <xsd:sequence> of
>> my custom xsd but got error:
>>> org.springframework.beans.factory.BeanCreationException:
>>> Error creating bean with name 'repositoryFactory':
>>> Injection of autowired dependencies failed; nested
>>> exception is
>>> org.springframework.beans.factory.BeanCreationException:
>>> Could not autowire field: private
>>> com.evolveum.midpoint.prism.Pr
>>> <http://com.evolveum.midpoint.prism.Pr>ismContext
>>> com.evolveum.midpoint.init.RepositoryFactory.prismContext;
>>> nested exception is
>>> org.springframework.beans.factory.BeanCreationException:
>>> Error creating bean with name 'prismContext' defined in
>>> class path resource [ctx-configuration.xml]: Bean
>>> instantiation via factory method failed; nested
>>> exception is
>>> org.springframework.beans.BeanInstantiationException:
>>> Failed to instantiate
>>> [com.evolveum.midpoint.prism.PrismContext]: Factory
>>> method 'createInitializedPrismContext' threw exception;
>>> nested exception is
>>> com.evolveum.midpoint.util.exception.SchemaException:
>>> XML error during XSD schema parsing: *Unexpected
>>> <xsd:complexType> appears at line 65 column 42(embedded
>>> exception null)* in file C:\midpoint\schema\test1.xsd
>>
>> Do you have any example of using complexType attribute
>> with UserExtensionType?
>>
>> ---
>> Dmitry
>>
>> _______________________________________________
>> midPoint mailing list
>> midPoint at lists.evolveum.com
>> <mailto:midPoint at lists.evolveum.com>
>> http://lists.evolveum.com/mailman/listinfo/midpoint
>> <http://lists.evolveum.com/mailman/listinfo/midpoint>
>>
>>
>>
>>
>> --
>> s pozdravom
>>
>> Gustáv Pálos
>>
>>
>>
>>
>> --
>> Gustáv Pálos
>> Identity Engineer
>> evolveum.com <http://evolveum.com/>
>>
>> _______________________________________________
>> midPoint mailing list
>> midPoint at lists.evolveum.com <mailto:midPoint at lists.evolveum.com>
>> http://lists.evolveum.com/mailman/listinfo/midpoint
>> <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/20170301/07c77e26/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 28642 bytes
Desc: not available
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170301/07c77e26/attachment.png>
More information about the midPoint
mailing list