Class EntryNumberingDAO

java.lang.Object
fr.paris.lutece.plugins.genericattributes.business.EntryNumberingDAO
All Implemented Interfaces:
IEntryNumberingDAO

@ApplicationScoped public class EntryNumberingDAO extends Object implements IEntryNumberingDAO
Counter of the numbering entries in the table genatt_entry_numbering. The increment is an atomic UPDATE read back in the same transaction (the row stays locked until the commit), so two submissions on two instances never get the same value. The first counter of an entry is created under a lock of the row of the entry, so a concurrent submission waits for it instead of inserting it a second time.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    delete(int nIdEntry, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Removes the counter of an entry
    int
    nextValue(int nIdEntry, IntSupplier currentValue, fr.paris.lutece.portal.service.plugin.Plugin plugin)
    Increments the counter of an entry and returns the new value.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • EntryNumberingDAO

      public EntryNumberingDAO()
  • Method Details

    • nextValue

      public int nextValue(int nIdEntry, IntSupplier currentValue, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Increments the counter of an entry and returns the new value. The counter is created when missing, from the given current value.
      Specified by:
      nextValue in interface IEntryNumberingDAO
      Parameters:
      nIdEntry - The entry id
      currentValue - Supplies the current value of the counter when it does not exist yet (the highest value already used)
      plugin - The plugin
      Returns:
      the next value
    • delete

      public void delete(int nIdEntry, fr.paris.lutece.portal.service.plugin.Plugin plugin)
      Removes the counter of an entry
      Specified by:
      delete in interface IEntryNumberingDAO
      Parameters:
      nIdEntry - The entry id
      plugin - The plugin