Class ItemDAO

java.lang.Object
ru.bgcrm.dao.CommonDAO
org.bgerp.plugin.inventoru.dao.ItemDAO

public class ItemDAO extends CommonDAO
DAO for nomenclature Item. Soft delete via deleted_at / deleted_by.
  • Constructor Details

  • Method Details

    • getList

      public List<Item> getList(boolean includeDeleted) throws SQLException
      Throws:
      SQLException
    • get

      public Item get(int id) throws SQLException
      Throws:
      SQLException
    • update

      public void update(Item item, int userId) throws SQLException
      Throws:
      SQLException
    • getContents

      public List<String> getContents(int id) throws SQLException
      Where a position is still held: stock or reserves on warehouses, units of equipment. A deleted position drops out of every list, and whatever it still counted would be lost from sight with it.
      Returns:
      human-readable descriptions, empty when the position can be deleted.
      Throws:
      SQLException
    • delete

      public void delete(int id, int userId) throws SQLException
      Throws:
      SQLException
    • restore

      public void restore(int id) throws SQLException
      Undoes a delete: it is a soft one, and until now there was no way back from it.
      Throws:
      SQLException
    • getIdByExtIdParam

      public int getIdByExtIdParam(int extIdParamId, String extId) throws SQLException
      Looks up an item by ext_id parameter value in param_text.
      Parameters:
      extIdParamId - param_id of the ext_id parameter (configured per instance)
      extId - external ID value to search
      Returns:
      item id, or 0 if not found
      Throws:
      SQLException
    • getIdsByExtIdParam

      public List<Integer> getIdsByExtIdParam(int extIdParamId, String extId) throws SQLException
      All live items whose ext_id parameter holds the value. Unlike getIdByExtIdParam(int, String), which takes the first row, this lets the caller see that a code is not unique — the equipment import reports it instead of picking one of the positions.
      Throws:
      SQLException
    • fromRs

      public static Item fromRs(ResultSet rs) throws SQLException
      Throws:
      SQLException