10-19-2012 07:49 AM
hi @ all,
I'm tring to add extra data to "File" core DocumentType. To achive this i have created a schema with extra informations. like:
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://nuxeo.com/schemas/com/nuxeo/myproject/metadata/extra/"
xmlns:nxs="http://nuxeo.com/schemas/com/nuxeo/myproject/metadata/extra/"
>
<xs:element name="test1" type="xs:string"/>
<xs:element name="test2" type="xs:string"/>
</xs:schema>
And added a contrib xml file for extend "schema" and "doctype":
<extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
<schema name="extra" src="schemas/extra.xsd" prefix="extra" />
</extension>
<extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">
<doctype name="File" extends="Document">
<schema name="common"/>
<schema name="uid"/>
<schema name="dublincore"/>
<schema name="file"/>
<schema name="file_schema"/>
<schema name="files"/>
<schema name="extra"/>
<facet name="Versionable"/>
</doctype>
</extension>
Also, i have created a new table to add extra metadata and i have added the contrib in the xml file:
<extension target="org.nuxeo.ecm.directory.sql.SQLDirectoryFactory" point="directories">
<directory name="myextrametadata">
<schema>vocabulary</schema>
<dataSource>java:/nxsqldirectory</dataSource>
<cacheTimeout>3600</cacheTimeout>
<cacheMaxSize>1000</cacheMaxSize>
<table>my_extrametadata</table>
<idField>id</idField>
<autoincrementIdField>true</autoincrementIdField>
<dataFile>directories/myextrametadata-def.csv</dataFile>
<createTablePolicy>on_missing_columns</createTablePolicy>
</directory>
</extension>
I want to add extra metadata that no one (using webinterface) can use, but that can be usable by me via nuxeo automation client. Using a call like:
PropertyMap props = new PropertyMap();
props.set("dc:title","MyTest");
props.set("dc:description", "Descr of my Test");
props.set("extra:test1", "myextrainfo");
nuxeosession.newRequest("Document.Create").setInput(new PathRef(workspacepath)).set("type", "File").set("name", "MyTest").set("properties", props).execute();
But when i try to create a "File" into workspace via Web user interface i have a runtime error with this full stacktrace:
To make more readable the post i have pasted the stacktrace here: http://pastebin.com/7pCzE26Z
Can you help me? There is a way to "extend" metadata for Document Type "File" ? What's my fault?
Thank you!!!
I have followed this nuxeo official howto: http://doc.nuxeo.com/display/NXDOC/How-to+configure+document+types%2C+actions+and+operation+chains#H...
10-25-2012 10:45 AM
Ok, I tried your base schema and doc contribs on a test 5.6 system and they worked.
schema file:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://nuxeo.com/schemas/com/nuxeo/myproject/metadata/extra/"
xmlns:extra="http://nuxeo.com/schemas/com/nuxeo/myproject/metadata/extra/">
<xs:element name="test1" type="xs:string" />
<xs:element name="test2" type="xs:string" />
</xs:schema>
And the schema/doc contrib:
<?xml version="1.0" encoding="UTF-8"?>
<component name="test">
<require>org.nuxeo.ecm.directory.types</require>
<require>org.nuxeo.runtime.started</require>
<extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
<schema name="extra" src="data/schemas/extra.xsd" prefix="extra" />
</extension>
<extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">
<doctype name="File" extends="Document">
<schema name="common" />
<schema name="uid" />
<schema name="dublincore" />
<schema name="file" />
<schema name="files" />
<schema name="extra" />
<facet name="Versionable" />
</doctype>
</extension>
</component>
I had to remove the "file_schema" schema because I dont have that defined. I created a new File doc and confirmed in Postgres that the extra table is created. So if your contribs look like those above then they are not the issue.
10-22-2012 11:12 AM
can you share or just send me your config files (bruce@concena.com) and I will have a look later today
10-23-2012 01:44 PM
what kind of config file? Every config file i have created are added to the first answer. Are you think that i missed some config file or other stuff to create my contrib bundle? I have followed all the steps from official howto, only the widget creation and user interface is (intentionally) not added because i want access this extra information only via automation client (more general via CMIS)
10-25-2012 10:45 AM
Ok, I tried your base schema and doc contribs on a test 5.6 system and they worked.
schema file:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://nuxeo.com/schemas/com/nuxeo/myproject/metadata/extra/"
xmlns:extra="http://nuxeo.com/schemas/com/nuxeo/myproject/metadata/extra/">
<xs:element name="test1" type="xs:string" />
<xs:element name="test2" type="xs:string" />
</xs:schema>
And the schema/doc contrib:
<?xml version="1.0" encoding="UTF-8"?>
<component name="test">
<require>org.nuxeo.ecm.directory.types</require>
<require>org.nuxeo.runtime.started</require>
<extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
<schema name="extra" src="data/schemas/extra.xsd" prefix="extra" />
</extension>
<extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">
<doctype name="File" extends="Document">
<schema name="common" />
<schema name="uid" />
<schema name="dublincore" />
<schema name="file" />
<schema name="files" />
<schema name="extra" />
<facet name="Versionable" />
</doctype>
</extension>
</component>
I had to remove the "file_schema" schema because I dont have that defined. I created a new File doc and confirmed in Postgres that the extra table is created. So if your contribs look like those above then they are not the issue.
10-25-2012 11:19 AM
Ok, confirm that now works for me! So thank you for your time, you are my guru now! 🙂
I don't know why but i think that in the last part of my test i have missed the "files" schema and all other works broke against this problem. In the meanwhile i have decided to create another File Type but, in my latest test, i have tried to extend "File" (based on my first question) and all works fine 🙂 So:
Thank you!
[1]
Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: java.lang.NullPointerException. message: null
at org.nuxeo.ecm.core.api.impl.DataModelImpl.getSchema(DataModelImpl.java:86)
at org.nuxeo.ecm.core.api.impl.DocumentModelImpl.addDataModel(DocumentModelImpl.java:569)
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.