Class JPAUIDSequencerImpl

java.lang.Object
org.nuxeo.ecm.core.uidgen.AbstractUIDSequencer
org.nuxeo.ecm.platform.uidgen.JPAUIDSequencerImpl
All Implemented Interfaces:
UIDSequencer

public class JPAUIDSequencerImpl extends AbstractUIDSequencer
This implementation uses a static persistence provider to be able to instantiate this class without passing by Framework.getService -> this is to avoid potential problems do to sequencer factories. Anyway sequencer factories should be removed (I don't think they are really needed).
Author:
Bogdan Stefanescu
  • Field Details

  • Constructor Details

    • JPAUIDSequencerImpl

      public JPAUIDSequencerImpl()
  • Method Details

    • init

      public void init()
      Description copied from interface: UIDSequencer
      Init Sequencer
    • dispose

      public void dispose()
      Must be called when the service is no longer needed
    • getOrCreatePersistenceProvider

      protected PersistenceProvider getOrCreatePersistenceProvider()
    • activatePersistenceProvider

      protected static void activatePersistenceProvider()
    • initSequence

      public void initSequence(String key, long id)
      Description copied from interface: UIDSequencer
      Initializes the sequencer with the given key to at least the given long id.

      A sequence can only be incremented, so if its current id is greater than the given id the sequence won't be decremented to reach the given id.

      Specified by:
      initSequence in interface UIDSequencer
      Overrides:
      initSequence in class AbstractUIDSequencer
    • getKeys

      public List<String> getKeys()
      Returns:
      all keys known to this sequencer
    • getCurrent

      public long getCurrent(String key)
      Returns:
      the current sequence value for the given key, or UIDSequencer.SEQUENCE_DOES_NOT_EXIST if the sequence doesn't exist
    • getNextLong

      public long getNextLong(String key)
      Description copied from interface: UIDSequencer
      For the given key returns the incremented UID which is also stored in the same sequence entry. This is a "one time use" function for a document.
    • executeSeqRunnable

      protected long executeSeqRunnable(JPAUIDSequencerImpl.SeqRunnable runnable)
    • doGet

      protected int doGet(String key)
    • get

      protected int get(javax.persistence.EntityManager em, String key)
    • doGetNext

      protected int doGetNext(String key)
    • getNext

      protected int getNext(javax.persistence.EntityManager em, String key)