public class UIDGeneratorComponent extends DefaultComponent implements UIDGeneratorService
Modifier and Type | Field and Description |
---|---|
protected String |
defaultSequencer |
static String |
EXTENSION_POINT_SEQUENCER_FACTORY
Extension point is deprecated should be removed - preserved for now only for startup warnings.
|
protected Map<String,UIDGenerator> |
generators |
static String |
ID |
protected LinkedHashMap<String,UIDSequencerProviderDescriptor> |
sequencerContribs |
protected Map<String,UIDSequencer> |
sequencers |
static String |
SEQUENCERS_EXTENSION_POINT |
static String |
UID_GENERATORS_EXTENSION_POINT |
lastModified
Constructor and Description |
---|
UIDGeneratorComponent() |
Modifier and Type | Method and Description |
---|---|
void |
activate(ComponentContext context)
Activates the component.
|
protected void |
computeDefault() |
String |
createUID(DocumentModel doc) |
void |
deactivate(ComponentContext context)
Deactivates the component.
|
<T> T |
getAdapter(Class<T> adapter)
Returns an object which is an instance of the given class associated with this object.
|
UIDSequencer |
getSequencer()
Retrieves the default
UIDSequencer |
UIDSequencer |
getSequencer(String name)
Retrieves
UIDSequencer by it's name |
UIDGenerator |
getUIDGeneratorFor(DocumentModel doc)
Returns the uid generator to use for this document.
|
void |
registerExtension(Extension extension)
Registers the given extension.
|
protected void |
registerGenerators(Extension extension,
Object[] contribs) |
protected void |
registerSequencers(Extension extension,
Object[] contribs) |
void |
setUID(DocumentModel doc)
Creates a new UID for the given doc and sets the field configured in the generator component with this value.
|
void |
unregisterExtension(Extension extension)
Unregisters the given extension.
|
protected void |
unregisterSequencers(Extension extension,
Object[] contribs) |
applicationStarted, getApplicationStartedOrder, getLastModified, registerContribution, setLastModified, setModifiedNow, unregisterContribution
public static final String ID
public static final String UID_GENERATORS_EXTENSION_POINT
public static final String SEQUENCERS_EXTENSION_POINT
public static final String EXTENSION_POINT_SEQUENCER_FACTORY
protected final Map<String,UIDGenerator> generators
protected final Map<String,UIDSequencer> sequencers
protected final LinkedHashMap<String,UIDSequencerProviderDescriptor> sequencerContribs
protected String defaultSequencer
public UIDGeneratorComponent()
public void activate(ComponentContext context)
Component
This method is called by the runtime when a component is activated.
activate
in interface Component
activate
in class DefaultComponent
context
- the runtime contextpublic void deactivate(ComponentContext context)
Component
This method is called by the runtime when a component is deactivated.
deactivate
in interface Component
deactivate
in class DefaultComponent
context
- the runtime contextpublic void registerExtension(Extension extension)
Extensible
registerExtension
in interface Extensible
registerExtension
in class DefaultComponent
extension
- the extension to registerpublic void unregisterExtension(Extension extension)
Extensible
unregisterExtension
in interface Extensible
unregisterExtension
in class DefaultComponent
extension
- the extension to unregisterprotected void computeDefault()
protected void registerSequencers(Extension extension, Object[] contribs)
protected void unregisterSequencers(Extension extension, Object[] contribs)
protected void registerGenerators(Extension extension, Object[] contribs)
public UIDGenerator getUIDGeneratorFor(DocumentModel doc)
Choice is made following the document type and the generator configuration.
getUIDGeneratorFor
in interface UIDGeneratorService
public void setUID(DocumentModel doc) throws PropertyNotFoundException
setUID
in interface UIDGeneratorService
PropertyNotFoundException
public String createUID(DocumentModel doc)
createUID
in interface UIDGeneratorService
public <T> T getAdapter(Class<T> adapter)
Adaptable
null
if no such object can be found.getAdapter
in interface Adaptable
getAdapter
in class DefaultComponent
adapter
- the adapter class to look upnull
if this object does not have an adapter for
the given classpublic UIDSequencer getSequencer()
UIDGeneratorService
UIDSequencer
getSequencer
in interface UIDGeneratorService
UIDSequencer
public UIDSequencer getSequencer(String name)
UIDGeneratorService
UIDSequencer
by it's namegetSequencer
in interface UIDGeneratorService
name
- the name of the UIDSequencer
UIDSequencer
matching the nameCopyright © 2016 Nuxeo SA. All rights reserved.