[midPoint] Add complex type element to user type
Dmitriy Berezkin
berezkin.dmitriy at gmail.com
Wed Mar 1 15:51:24 CET 2017
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</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> wrote:
> > > > Hi Dmitry,
> > > >
> > > > do you checked for example this sample?
> > > > 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>:
> > > > > > > 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.PrismContext 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
> > > > > > > http://lists.evolveum.com/mailman/listinfo/midpoint
> > > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > s pozdravom
> > > > >
> > > > > Gustáv Pálos
> > >
> > >
> > >
> > > --
> > > Gustáv Pálos
> > > Identity Engineer
> > > evolveum.com
> > >
> > > _______________________________________________
> > > 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/7b1a1be9/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: =?utf-8?Q?=D0=A1=D0=BD=D0=B8=D0=BC=D0=BE=D0=BA_=D1=8D=D0=BA=D1=80=D0=B0=D0=BD=D0=B0_?=2017-03-01 =?utf-8?Q?=D0=B2_?=17.48.41.png
Type: image/png
Size: 28642 bytes
Desc: not available
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170301/7b1a1be9/attachment.png>
More information about the midPoint
mailing list