In a situation like this, one presumes that there will be searches on this generated ID. Does the Nuxeo framework do anything to index this column in the underlying repository, so that performance is reasonable? Or must we add an index to this column ourselves in the DB?
> -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of [email protected] > Sent: Wednesday, April 27, 2011 9:17 AM > To: [email protected] > Subject: Re: [Ecm] Steps For activation UIDGenerator1 > > I did it like the following: > > <extension target="org.nuxeo.ecm.core.schema.TypeService" > point="schema"> > <schema name="my_schema" src="schemas/my_schema.xsd" /> > </extension> > > [ ... ] > > <extension target="org.nuxeo.ecm.core.schema.TypeService" > point="doctype"> > <doctype name="my_document" extends="Document"> > <schema name="my_schema" /> > </doctype> > > </extension> > > [ ... ] > > <extension target > ="org.nuxeo.ecm.platform.uidgen.service.UIDGeneratorService" > > point="generators"> > <generator name="my_generator" > class="org.blablabla.UIDMyDocumentGenerator"> > <propertyName>my_schema:my_uid</propertyName> > <docType>my_document</docType> > </generator> > </extension> > > > And then, you have to implement UIDMyDocumentGenerator... > something like this: > > [ ... ] > > public class UIDMyDocumentGenerator extends AbstractUIDGenerator { > > [ ... ] > > private static final String NFORMAT = "%05d"; > > public String getSequenceKey(DocumentModel doc) throws > DocumentException { > > Calendar cal = new GregorianCalendar(); > return Integer.toString(cal.get(Calendar.YEAR)); > > } > > public String createUID(DocumentModel doc) throws > DocumentException { > > int index = getNext(doc); > String n = String.format(NFORMAT, index); > log.warn(doc); > > final String seqKey = getSequenceKey(doc); > > return seqKey + "/" + n; > > } > > } > > I hope it helps you build yours. > --- > Mailing list: [email protected] > Forum: http://forum.nuxeo.org/f/1/ > --- Mailing list: [email protected] Forum: http://forum.nuxeo.org/f/1/
