cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a property to all documents?

jeremie_
Confirmed Champ
Confirmed Champ

hi,

i m trying to extends all my documents with a new directory item (which looks like Subjects) and get rid of Coverage one.

so, i choose a custom dublincore schema that override default one, making a widget and extends the layout...but i get errors, almost everywhere.
/> May be it's not as simple as overriding dublincore ?
/> Do y have to register a new schema and extend all types of documents ?

thanks, jérémie

5 REPLIES 5

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

Overriding dublincore is evil 🙂

Dublincore is the schema that store all the mandatory fields of Nuxeo Document. This is a standard schema, if you want to see a bit more on this point go there.

But that's not only for that. for maintenance of your code, if we update something on this part of our code, you will have to take care of our updates to push them into your code.

And last, but no least your error may happens because when you has overridden the schema you remove some fields but you didn't update the layout that wait for this field...

Anyway I hope, I convince you to not go to this way.

A better way is to:

  • Create your own schema
  • Override File and Folder docType definition to just add this new schema. As all documents extends that docTypes you must have all Doc Type implementing your schema.
  • Override the "dublincore" layout to add your widget (mmmh... ) or create your own layout and add it in all your document presentation definition.

To override the core type definition, I think you just have to do something like:

<require>org.nuxeo.ecm.core.CoreExtensions</require>
<extension target="org.nuxeo.ecm.core.schema.TypeService"
    point="configuration">
<doctype name="Folder" extends="Document">
  <schema name="myschema"/>
</doctype>

<doctype name="File" extends="Document">
  <schema name="myschema"/>
</doctype>
...

To override dublincore layout, you will have something like that:

<require>org.nuxeo.ecm.platform.forms.layouts.webapp</require>
<extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
    point="layouts">
    <layout name="dublincore">

I hope that will help you.

ok, you convince me.

Did you define your location schema

here is the whole thing

All seems good can you please give us some information of your error. Please refer to [this answer][1] item if you don't know how.