Package org.nuxeo.ecm.core.uidgen
Class UIDGeneratorComponent
- java.lang.Object
 - 
- org.nuxeo.runtime.model.DefaultComponent
 - 
- org.nuxeo.ecm.core.uidgen.UIDGeneratorComponent
 
 
 
- 
- All Implemented Interfaces:
 UIDGeneratorService,Adaptable,Component,Extensible,TimestampedService
public class UIDGeneratorComponent extends DefaultComponent implements UIDGeneratorService
Service that writes MetaData. 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected StringdefaultSequencerstatic StringEXTENSION_POINT_SEQUENCER_FACTORYExtension point is deprecated should be removed - preserved for now only for startup warnings.protected Map<String,UIDGenerator>generatorsstatic StringIDprotected LinkedHashMap<String,UIDSequencerProviderDescriptor>sequencerContribsprotected Map<String,UIDSequencer>sequencersstatic StringSEQUENCERS_EXTENSION_POINTstatic StringUID_GENERATORS_EXTENSION_POINT- 
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name 
 - 
 
- 
Constructor Summary
Constructors Constructor Description UIDGeneratorComponent() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcomputeDefault()StringcreateUID(DocumentModel doc)<T> TgetAdapter(Class<T> adapter)Returns an object which is an instance of the given class associated with this object.UIDSequencergetSequencer()Retrieves the defaultUIDSequencerUIDSequencergetSequencer(String name)RetrievesUIDSequencerby it's nameUIDGeneratorgetUIDGeneratorFor(DocumentModel doc)Returns the uid generator to use for this document.voidregisterExtension(Extension extension)Registers the given extension.protected voidregisterGenerators(Extension extension, Object[] contribs)protected voidregisterSequencers(Extension extension, Object[] contribs)voidsetUID(DocumentModel doc)Creates a new UID for the given doc and sets the field configured in the generator component with this value.voidstart(ComponentContext context)Start the component.voidstop(ComponentContext context)Stop the component.voidunregisterExtension(Extension extension)Unregisters the given extension.protected voidunregisterSequencers(Extension extension, Object[] contribs)- 
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, setLastModified, setModifiedNow, setName, unregister, unregisterContribution 
- 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface org.nuxeo.runtime.model.Component
applicationStarted, getApplicationStartedOrder 
 - 
 
 - 
 
- 
- 
Field Detail
- 
ID
public static final String ID
- See Also:
 - Constant Field Values
 
 
- 
UID_GENERATORS_EXTENSION_POINT
public static final String UID_GENERATORS_EXTENSION_POINT
- See Also:
 - Constant Field Values
 
 
- 
SEQUENCERS_EXTENSION_POINT
public static final String SEQUENCERS_EXTENSION_POINT
- See Also:
 - Constant Field Values
 
 
- 
EXTENSION_POINT_SEQUENCER_FACTORY
public static final String EXTENSION_POINT_SEQUENCER_FACTORY
Extension point is deprecated should be removed - preserved for now only for startup warnings.- See Also:
 - Constant Field Values
 
 
- 
generators
protected final Map<String,UIDGenerator> generators
 
- 
sequencers
protected final Map<String,UIDSequencer> sequencers
 
- 
sequencerContribs
protected final LinkedHashMap<String,UIDSequencerProviderDescriptor> sequencerContribs
 
- 
defaultSequencer
protected String defaultSequencer
 
 - 
 
- 
Method Detail
- 
start
public void start(ComponentContext context)
Description copied from interface:ComponentStart the component. This method is called after all the components were resolved and activated- Specified by:
 startin interfaceComponent- Overrides:
 startin classDefaultComponent
 
- 
stop
public void stop(ComponentContext context)
Description copied from interface:ComponentStop the component.- Specified by:
 stopin interfaceComponent- Overrides:
 stopin classDefaultComponent
 
- 
registerExtension
public void registerExtension(Extension extension)
Description copied from interface:ExtensibleRegisters the given extension.- Specified by:
 registerExtensionin interfaceExtensible- Overrides:
 registerExtensionin classDefaultComponent- Parameters:
 extension- the extension to register
 
- 
unregisterExtension
public void unregisterExtension(Extension extension)
Description copied from interface:ExtensibleUnregisters the given extension.- Specified by:
 unregisterExtensionin interfaceExtensible- Overrides:
 unregisterExtensionin classDefaultComponent- Parameters:
 extension- the extension to unregister
 
- 
computeDefault
protected void computeDefault()
 
- 
getUIDGeneratorFor
public UIDGenerator getUIDGeneratorFor(DocumentModel doc)
Returns the uid generator to use for this document.Choice is made following the document type and the generator configuration.
- Specified by:
 getUIDGeneratorForin interfaceUIDGeneratorService
 
- 
setUID
public void setUID(DocumentModel doc) throws PropertyNotFoundException
Creates a new UID for the given doc and sets the field configured in the generator component with this value.- Specified by:
 setUIDin interfaceUIDGeneratorService- Throws:
 PropertyNotFoundException
 
- 
createUID
public String createUID(DocumentModel doc)
- Specified by:
 createUIDin interfaceUIDGeneratorService- Returns:
 - a new UID for the given document
 
 
- 
getAdapter
public <T> T getAdapter(Class<T> adapter)
Description copied from interface:AdaptableReturns an object which is an instance of the given class associated with this object. Returnsnullif no such object can be found.- Specified by:
 getAdapterin interfaceAdaptable- Overrides:
 getAdapterin classDefaultComponent- Parameters:
 adapter- the adapter class to look up- Returns:
 - a object castable to the given class, or 
nullif this object does not have an adapter for the given class 
 
- 
getSequencer
public UIDSequencer getSequencer()
Description copied from interface:UIDGeneratorServiceRetrieves the defaultUIDSequencer- Specified by:
 getSequencerin interfaceUIDGeneratorService- Returns:
 - the default 
UIDSequencer 
 
- 
getSequencer
public UIDSequencer getSequencer(String name)
Description copied from interface:UIDGeneratorServiceRetrievesUIDSequencerby it's name- Specified by:
 getSequencerin interfaceUIDGeneratorService- Parameters:
 name- the name of theUIDSequencer- Returns:
 - the 
UIDSequencermatching the name 
 
 - 
 
 -