Class DeviceDAO
java.lang.Object
ru.bgcrm.dao.CommonDAO
org.bgerp.plugin.inventoru.dao.DeviceDAO
-
Nested Class Summary
Nested classes/interfaces inherited from class CommonDAO
CommonDAO.ObjectExtractor<T>, CommonDAO.RecordUpdater<T> -
Field Summary
Fields inherited from class CommonDAO
con, SQL_AND, SQL_DELETE, SQL_DELETE_FROM, SQL_DESC, SQL_DISTINCT, SQL_FROM, SQL_GROUP_BY, SQL_INNER_JOIN, SQL_INSERT_IGNORE_INTO, SQL_INSERT_INTO, SQL_LEFT_JOIN, SQL_LIMIT, SQL_ON_DUP_KEY_UPDATE, SQL_ORDER_BY, SQL_REPLACE, SQL_SELECT, SQL_SELECT_ALL_FROM, SQL_SELECT_COUNT_ROWS, SQL_SET, SQL_UNION_ALL, SQL_UPDATE, SQL_VALUES, SQL_VALUES_1, SQL_VALUES_2, SQL_VALUES_3, SQL_VALUES_4, SQL_VALUES_5, SQL_WHERE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddelete(int id, int userId) Soft-delete.static Deviceget(int id) getBySerial(String serialNumber) getBySerialLocked(String serialNumber) The unit with this serial, read under a lock the transaction holds until it ends.getList(boolean includeDeleted) getList(boolean includeDeleted, int equipTypeId) getListByParent(int parentDeviceId) getListByStatus(String status) getListByStore(int storeId) The units standing on a warehouse — every one of them, whether or not it is tied to a position of the nomenclature.getSerialsByStore(int storeId) Serial numbers standing on a store, grouped by nomenclature — what the store card shows under a serial-tracked position instead of just a number.voidLogs a change whose writes happened in several steps:beforeas the unit was (null — created),afteras it ended up.voidrestore(int id) Restore soft-deleted device.voidInserts or updates a device.voidMethods inherited from class CommonDAO
deleteById, foundRows, getById, getGroupedIds, getGroupedIds, getIds, getIds, getPageLimit, getPeriodSql, lastInsertId, setPeriodParamValue, setRecordCount, update, updateColumn, updateIds, updateIds, updateOrInsert
-
Constructor Details
-
DeviceDAO
-
-
Method Details
-
getList
- Throws:
SQLException
-
getList
- Parameters:
equipTypeId- filters by exact equipment type id; 0 = no filter (all types)- Throws:
SQLException
-
getListByStatus
- Throws:
SQLException
-
getListByParent
- Throws:
SQLException
-
get
- Throws:
SQLException
-
getListByStore
The units standing on a warehouse — every one of them, whether or not it is tied to a position of the nomenclature. The card used to show units only as serial numbers under a stock row (getSerialsByStore(int)), which needsitem_idfilled in and the position tracked per unit. Equipment imported without a position is invisible that way: a warehouse holding 63 units of an installer reported "warehouse is empty".- Throws:
SQLException
-
getSerialsByStore
Serial numbers standing on a store, grouped by nomenclature — what the store card shows under a serial-tracked position instead of just a number.- Throws:
SQLException
-
getBySerial
- Throws:
SQLException
-
getBySerialLocked
The unit with this serial, read under a lock the transaction holds until it ends. A plain read decides "no such unit — create one" from a snapshot, and two imports running at the same second both decide it: a file applied twice by a double click made 158 cards out of 79 serial numbers, because neither request saw what the other was inserting. What the lock changes depends on when the second request arrives. Started after the first has committed, it reads the current row and updates the unit instead of creating a twin. Started at the same moment, on a serial that exists nowhere yet, both take a gap lock — those do not conflict with each other — and collide on the insert, where the database throws one of them away whole. Either way no duplicate survives; the caller turns that refusal into an answer a person can act on.- Throws:
SQLException
-
update
Inserts or updates a device. Setsidon the object when inserting.- Throws:
SQLException
-
update
- Parameters:
logChange-falsefor an intermediate write whose outcome is logged later withlogChange(Device, Device, int)— a unit saved off-store for a moment before a receipt puts it on one must not show "store: 0" as its history- Throws:
SQLException
-
logChange
-
delete
-
restore
-
fromRs
- Throws:
SQLException
-