Class EntryNumberingDAO
java.lang.Object
fr.paris.lutece.plugins.genericattributes.business.EntryNumberingDAO
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptionvoiddelete(int nIdEntry, fr.paris.lutece.portal.service.plugin.Plugin plugin) Removes the counter of an entryintnextValue(int nIdEntry, IntSupplier currentValue, fr.paris.lutece.portal.service.plugin.Plugin plugin) Increments the counter of an entry and returns the new value.
-
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:
nextValuein interfaceIEntryNumberingDAO- Parameters:
nIdEntry- The entry idcurrentValue- 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:
deletein interfaceIEntryNumberingDAO- Parameters:
nIdEntry- The entry idplugin- The plugin
-