How to validate the document creation with unique uid using automation chain

Hello, I need validate the creation of documents with unique uid. I need to use a condition on automation chain for verify the uid on documents in the repository but I don´t know how to do that? I have reviewed all operations in studio but I don't see something with conditions

0 votes

3 answers

1978 views

ANSWER



Another way of doing it is to create the id automatically using Fn.getNextId (maybe using the metadata of the document) so that you will be sure to have a unique id. Find here an example on custom doc id generation : http://doc.nuxeo.com/x/pQM7

1 votes



what I want to do is first search in the repository for a document with uid = metadata value in my current document, if I find another document with the same uid then my current document shouldn't be created. This uid always is get from another value of metadata that user write
02/09/2012


Doing the “count” fo your select is something that can be done easily with automation (using This.size() for exemple) but the problem is more that we don't currently any operation that would break the transaction nicely. The best option would be to write a JSF validator that does what you meant and reference it in the “validator” property of your widget. This is development with Nuxeo IDE.

1 votes



Hi,

Since studio is using MVEL, i guess you can use the usual MVEL synthx for conditions: http://docs.codehaus.org/display/MVEL/MVEL+2.0+Control+Flow

0 votes