How do I override user schema and add a property that is a list of complex type?

Hello,

I am trying to override the User schema and add a property that is a list of complex type. I have been able to override the schema and add properties that are simple types (i.e. a string property), but when I tried adding a property that is a list of complex type I run into this error.

2020-06-25T16:25:49,959 ERROR [main] [org.nuxeo.runtime.model.ComponentManager] Component service:org.nuxeo.ecm.directory.DirectoryServiceImpl notification of application started failed: Invalid primitive type: org.nuxeo.ecm.core.schema.types.ListTypeImpl
java.lang.RuntimeException: Invalid primitive type: org.nuxeo.ecm.core.schema.types.ListTypeImpl
    at org.nuxeo.ecm.core.storage.sql.ColumnType.fromFieldType(ColumnType.java:229) ~[nuxeo-core-storage-sql-10.10-HF27.jar:?]

Here is the code. I've attached the full log file to this post in case that could be useful.

<?xml version="1.0"?>
<xs:schema targetNamespace="http://www.nuxeo.org/ecm/schemas/user" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:nxs="http://www.nuxeo.org/ecm/schemas/user">  
    <xs:include schemaLocation="base.xsd"/>  
    <xs:element name="username" type="xs:string"/>  
    <xs:element name="password" type="xs:string"/>  
    <xs:element name="firstName" type="xs:string"/>  
    <xs:element name="lastName" type="xs:string"/>  
    <xs:element name="company" type="xs:string"/>  
    <xs:element name="email" type="xs:string"/>  
    <!-- inverse reference -->  
    <xs:element name="groups" type="nxs:stringList"/>  
    <!-- tenant id for the user -->  
    <xs:element name="tenantId" type="xs:string"/>  
    <xs:element name="mainTeamId" type="xs:string"/>  
    <xs:element name="teams" type="nxs:teamUser_teamsListType"/>  
    <xs:complexType name="teamUser_teamsListType">    
        <xs:sequence>      
            <xs:element name="item" type="nxs:teamUser_teamsType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>  
    </xs:complexType>  
    <xs:complexType name="teamUser_teamsType">    
        <xs:sequence>      
            <xs:element name="teamId" type="xs:string"/>      
            <xs:element name="teamRoles" type="nxs:teamUser_teamRolesListType"/>    
        </xs:sequence>  
    </xs:complexType>  
    <xs:complexType name="teamUser_teamRolesListType">    
        <xs:sequence>      
            <xs:element name="item" type="nxs:teamUser_teamRolesType" minOccurs="0" maxOccurs="unbounded"/>    
        </xs:sequence>  
    </xs:complexType>  
    <xs:complexType name="teamUser_teamRolesType">    
        <xs:sequence>      
            <xs:element name="inheritedGroupId" type="xs:string"/>      
            <xs:element name="role" type="xs:string"/>      
            <xs:element name="isActive" type="xs:boolean"/>    
        </xs:sequence>  
    </xs:complexType>
</xs:schema>

I used this article as a starting point. https://doc.nuxeo.com/nxdoc/how-to-add-new-fields-to-the-user-profile-or-group-profile/

is there something special about the user schema? I've even tried generating these properties in another xsd file and attaching them to another document type and that worked. Here is that file.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:nxs="http://www.nuxeo.org/ecm/project/schemas/ioi-andrewlam-sandbox/teamUser" xmlns:nxsv="http://www.nuxeo.org/ecm/schemas/core/validation/" xmlns:ref="http://www.nuxeo.org/ecm/schemas/core/external-references/" targetNamespace="http://www.nuxeo.org/ecm/project/schemas/ioi-andrewlam-sandbox/teamUser">    
    <!-- helper XSD definitions for list types -->    
    <xs:complexType name="content">        
        <xs:sequence>            
            <xs:element name="encoding" type="xs:string"/>            
            <xs:element name="mime-type" type="xs:string"/>            
            <xs:element name="data" type="xs:base64Binary"/>            
            <xs:element name="name" type="xs:string"/>            
            <xs:element name="length" type="xs:long"/>            
            <xs:element name="digest" type="xs:string"/>        
        </xs:sequence>    
    </xs:complexType>    
    <xs:simpleType name="stringList">        
        <xs:list itemType="xs:string"/>    
    </xs:simpleType>    
    <xs:simpleType name="doubleList">        
        <xs:list itemType="xs:double"/>    
    </xs:simpleType>    
    <xs:simpleType name="dateList">        
        <xs:list itemType="xs:date"/>    
    </xs:simpleType>    
    <xs:simpleType name="integerList">        
        <xs:list itemType="xs:integer"/>    
    </xs:simpleType>    
    <xs:simpleType name="booleanList">        
        <xs:list itemType="xs:boolean"/>    
    </xs:simpleType>    
    <xs:complexType name="blobList">        
        <xs:sequence>            
            <xs:element name="item" type="nxs:content" minOccurs="0" maxOccurs="unbounded"/>       
        </xs:sequence>    
    </xs:complexType>    
    <xs:element name="mainTeamId" type="xs:string"/>    
    <xs:element name="teams" type="nxs:teamUser_teamsListType"/>    
    <xs:complexType name="teamUser_teamsListType">        
        <xs:sequence>            
            <xs:element name="item" type="nxs:teamUser_teamsType" minOccurs="0" maxOccurs="unbounded"/>        
        </xs:sequence>    
    </xs:complexType>    
    <xs:complexType name="teamUser_teamsType">        
        <xs:sequence>            
            <xs:element name="teamId" type="xs:string"/>            
            <xs:element name="teamRoles" type="nxs:teamUser_teamRolesListType"/>        
        </xs:sequence>    
    </xs:complexType>    
    <xs:complexType name="teamUser_teamRolesListType">        
        <xs:sequence>            
            <xs:element name="item" type="nxs:teamUser_teamRolesType" minOccurs="0" maxOccurs="unbounded"/>        
        </xs:sequence>    
    </xs:complexType>    
    <xs:complexType name="teamUser_teamRolesType">        
        <xs:sequence>            
            <xs:element name="inheritedGroupId" type="xs:string"/>            
            <xs:element name="role" type="xs:string"/>            
            <xs:element name="isActive" type="xs:boolean"/>        
        </xs:sequence>    
    </xs:complexType>
</xs:schema>

Please let me know if I am doing something wrong or if this is something that just isn't possible. Also please let me know if there are any questions I can answer or any more information I can give to help figure this problem out.

Thank you,

Andrew

FILES:   error_log.txt
0 votes

0 answers

89 views

ANSWER