Class MongoInventoryItemDao
java.lang.Object
dev.getelements.elements.dao.mongo.goods.MongoInventoryItemDao
- All Implemented Interfaces:
InventoryItemDao
-
Field Summary
Fields inherited from interface dev.getelements.elements.sdk.dao.InventoryItemDao
SIMPLE_PRIORITY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadjustQuantityForItem
(MongoInventoryItemId objectId, int quantityDelta) adjustQuantityForItem
(User user, String itemNameOrId, int priority, int quantityDelta) Convenience method which allows for invokingInventoryItemDao.adjustQuantityForItem(String, int)
without needing to create the item first.adjustQuantityForItem
(String inventoryItemId, int quantityDelta) Adjusts the quantity of the supplied item and user.createInventoryItem
(InventoryItem inventoryItem) Creates an inventory item.void
deleteInventoryItem
(String inventoryItemId) Deletes an inventory item.dev.morphia.Datastore
getInventoryItem
(String inventoryItemId) Gets the specific inventory item with the id, or throws aNotFoundException
if the inventory item can't be found.getInventoryItemByItemNameOrId
(User user, String itemNameOrId, int priority) Gets the primary (single) inventory item for with the item name or id, or throws aNotFoundException
if the item or inventory item can't be found.getInventoryItems
(int offset, int count) Gets inventory items specifying the offset and the count.getInventoryItems
(int offset, int count, User user, String search) Gets inventory items specifying the offset and the count, specifying a search filter.getUserPublicInventoryItems
(int offset, int count, User user) Gets inventory items for specified user, which are flagged publicVisiblevoid
setDatastore
(dev.morphia.Datastore datastore) void
setDozerMapper
(MapperRegistry dozerMapperRegistry) void
setMongoConcurrentUtils
(MongoConcurrentUtils mongoConcurrentUtils) void
setMongoDBUtils
(MongoDBUtils mongoDBUtils) void
setMongoItemDao
(MongoItemDao mongoItemDao) void
setMongoUserDao
(MongoUserDao mongoUserDao) setQuantityForItem
(User user, String itemNameOrId, int priority, int quantity) Adjusts the quantity of the supplied item and user.void
setValidationHelper
(ValidationHelper validationHelper) updateInventoryItem
(String inventoryItemId, int quantity) Updates the specific inventory item with the id, or throws aNotFoundException
if the inventory item can't be found.
-
Constructor Details
-
MongoInventoryItemDao
public MongoInventoryItemDao()
-
-
Method Details
-
getInventoryItem
Description copied from interface:InventoryItemDao
Gets the specific inventory item with the id, or throws aNotFoundException
if the inventory item can't be found.- Specified by:
getInventoryItem
in interfaceInventoryItemDao
- Returns:
- the
InventoryItem
that was requested, never null
-
getInventoryItemByItemNameOrId
Description copied from interface:InventoryItemDao
Gets the primary (single) inventory item for with the item name or id, or throws aNotFoundException
if the item or inventory item can't be found.- Specified by:
getInventoryItemByItemNameOrId
in interfaceInventoryItemDao
- Parameters:
user
- theUser
that owns the itemitemNameOrId
- an item name or ID to limit the resultspriority
-- Returns:
- the
InventoryItem
that was requested, never null
-
getUserPublicInventoryItems
Description copied from interface:InventoryItemDao
Gets inventory items for specified user, which are flagged publicVisible- Specified by:
getUserPublicInventoryItems
in interfaceInventoryItemDao
- Parameters:
offset
- the offsetcount
- the count- Returns:
- a
Pagination
ofInventoryItem
objects.
-
getInventoryItems
Description copied from interface:InventoryItemDao
Gets inventory items specifying the offset and the count, specifying a search filter.- Specified by:
getInventoryItems
in interfaceInventoryItemDao
- Parameters:
offset
- the offsetcount
- the countuser
- theUser
that owns the itemssearch
- a query to filter the results- Returns:
- a
Pagination
ofInventoryItem
objects.
-
getInventoryItems
Description copied from interface:InventoryItemDao
Gets inventory items specifying the offset and the count.- Specified by:
getInventoryItems
in interfaceInventoryItemDao
- Parameters:
offset
- the offsetcount
- the count- Returns:
- a
Pagination
ofInventoryItem
objects.
-
createInventoryItem
Description copied from interface:InventoryItemDao
Creates an inventory item. The value ofInventoryItem.getId()
will be ignored.- Specified by:
createInventoryItem
in interfaceInventoryItemDao
- Returns:
- the
InventoryItem
as it was written into the database
-
updateInventoryItem
Description copied from interface:InventoryItemDao
Updates the specific inventory item with the id, or throws aNotFoundException
if the inventory item can't be found. TheInventoryItem.getId()
is used to key the inventory item being updated.- Specified by:
updateInventoryItem
in interfaceInventoryItemDao
- Parameters:
inventoryItemId
-quantity
-- Returns:
- the
InventoryItem
as it was written into the database
-
setQuantityForItem
Description copied from interface:InventoryItemDao
Adjusts the quantity of the supplied item and user.- Specified by:
setQuantityForItem
in interfaceInventoryItemDao
- Parameters:
user
- theUser
for which to adjust the item.itemNameOrId
- theItem.getName()
orItem.getId()
priority
- the priority of the item slotquantity
- the amount to adjust the quantity by- Returns:
- the updated
InventoryItem
-
adjustQuantityForItem
Description copied from interface:InventoryItemDao
Adjusts the quantity of the supplied item and user.- Specified by:
adjustQuantityForItem
in interfaceInventoryItemDao
- Parameters:
inventoryItemId
- theItem.getName()
orItem.getId()
quantityDelta
- the amount to adjust the quantity by- Returns:
- the updated
InventoryItem
-
adjustQuantityForItem
public InventoryItem adjustQuantityForItem(User user, String itemNameOrId, int priority, int quantityDelta) Description copied from interface:InventoryItemDao
Convenience method which allows for invokingInventoryItemDao.adjustQuantityForItem(String, int)
without needing to create the item first.- Specified by:
adjustQuantityForItem
in interfaceInventoryItemDao
- Parameters:
user
- the user object to adjustitemNameOrId
- the item name or identifierpriority
- the priority slotquantityDelta
- the quantity delta- Returns:
- the updated
InventoryItem
-
adjustQuantityForItem
-
deleteInventoryItem
Description copied from interface:InventoryItemDao
Deletes an inventory item.- Specified by:
deleteInventoryItem
in interfaceInventoryItemDao
- Parameters:
inventoryItemId
- theInventoryItem
's id.
-
getDatastore
public dev.morphia.Datastore getDatastore() -
setDatastore
@Inject public void setDatastore(dev.morphia.Datastore datastore) -
getDozerMapper
-
setDozerMapper
-
getValidationHelper
-
setValidationHelper
-
getMongoDBUtils
-
setMongoDBUtils
-
getMongoItemDao
-
setMongoItemDao
-
getMongoUserDao
-
setMongoUserDao
-
getMongoConcurrentUtils
-
setMongoConcurrentUtils
-