Adding a new field to group and new relationship to a new directory

I'm trying to add a new field to groups and a new relationship to a new directory/schema for a MySQL Nuxeo schema, but the new column is never added to the MySql table. I've tried dropping the schema and going through the wizard and now the groups, user2group and group2Queue table are not created. The only error I get on startup is

ERROR [org.nuxeo.runtime.model.impl.RegistrationInfoImpl] Component notification of application started failed.

java.lang.RuntimeException: Invalid primitive type: org.nuxeo.ecm.core.schema.types.ListTypeImpl. When I try and login, I receeive: ERROR [org.nuxeo.ecm.platform.usermanager.UserService] Error fetching UserManager: no directory registered with name 'userDirectory' org.nuxeo.ecm.directory.DirectoryException: no directory registered with name 'userDirectory'

I have my includes and overrides, but the column and now the tables are not being created. Here is the snippets of code.

groups.xsd

  xmlns:nxs="http://www.nuxeo.org/ecm/schemas/group">

directory-schema-contrib.xml

<?xml version="1.0"?>

<require>org.nuxeo.ecm.directory.types</require>

<extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
    <schema name="group" override="true" src="schemas/group.xsd" />
</extension>

<require>org.nuxeo.ecm.directory.sql.storage</require>

<extension target="org.nuxeo.ecm.directory.sql.SQLDirectoryFactory" point="directories">
    <directory name="queueDirectory">
        <schema>Queue</schema>
        <dataSource>jdbc/nxsqldirectory</dataSource>
        <table>queue</table>
        <idField>queueId</idField>
        <createTablePolicy>never</createTablePolicy>
        <references>
            <inverseReference field="groupsInQueue" directory="groupDirectory"
                dualReferenceField="priorityQueues" />
        </references>
    </directory>
    <directory name="groupDirectory">
        <schema>group</schema>
        <dataSource>jdbc/nxsqldirectory</dataSource>
        <table>groups</table>
        <idField>groupname</idField>
        <autoincrementIdField>false</autoincrementIdField>
        <dataFile>/datafiles/groups.csv</dataFile>
        <createTablePolicy>on_missing_columns</createTablePolicy>
        <cacheTimeout>360</cacheTimeout>
        <cacheMaxSize>1000</cacheMaxSize>
        <references>
            <tableReference field="members" directory="userDirectory"
                table="user2group" sourceColumn="groupId" targetColumn="userId"
                schema="user2group" dataFile="/datafiles/user2group.csv" />
            <tableReference field="subGroups" directory="groupDirectory"
                table="group2group" sourceColumn="parentGroupId" targetColumn="childGroupId"
                schema="group2group" />
            <tableReference field="priorityQueues" directory="queueDirectory"
                table="queue2group" sourceColumn="groupId" targetColumn="queueId"
                schema="queue2group" dataFile="/datafiles/queue2group.csv" />
            <inverseReference field="parentGroups" directory="groupDirectory"
                dualReferenceField="subGroups" />
        </references>
    </directory>
</extension>

The Queue table was created by Studio with queueId as a string and groups as a stringList. The csv files were created with appropriate columns and defaults. And the directory-schema-contrib.xml was included in the MANIFEST.MF. I've tried changing the datasource for the directories to java:/nxsqldirectory since I have seen examples with that also.. Can you override the groups schema/directory without having to override the users? What is missing since I have everything according to your documentations and examples?

0 votes

1 answers

2081 views

ANSWER



It seems the problem is when a schema is created through Studio, it creates a table with a default ID field. But you can't use the ID for idField in the directories point because ID is not created in the schema. This is more of a problem where you can't create a schema/table and use it through the studio (I haven't found a way) or creating a schema through Studio and being able to state the PK,

0 votes