Is it possible to declaratively specify that child names for a given parent must be unique (like a file system)?

If not, this would be an useful feature to support in both the repository and the web ui.

In Studio, this feature might appear as a third checkbox entitled “Enforce Child Name Uniqueness” on the “Definition” tab of the “Document Type” screen.

You might also consider allowing a developer or Studio user to declaratively specify that modification timestamps on children should propagate to the parent. This might be a fourth Studio checkbox.

0 votes

1 answers

1228 views

ANSWER



Yes this is easy, and you can do that with Nuxeo Studio and Nuxeo IDE.

Here is the steps to that:

  • Create an Document Listener with Nuxeo IDE
  • bind your listener to events documentAboutToCreate and DocumentAboutToModify with your listener synchronously.
  • check into your listener that into the parent there is no child with same name
  • if there is a child with the same name throw an Exception

This is a first way, but quickly like that I have to look more precisely about which exception you have to send, and what about information to show into the UI (name already exists). I'm not sure this case will cover the move of documents.

But you can start to test that and tell me your trouble :D

0 votes



ron
After perusing JIRA, I think I am looking for a more comprehensive solution like the one described in JIRA https://jira.nuxeo.com/browse/NXP-6681.
01/19/2012

rg1
A nuxeo-unicity-folder marketplace add-on that defines a new document type, 'Unicity Folder', that prevents its children from having duplicate dc:titles would be a solution.
03/28/2015