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.voiddeleteInventoryItem(String inventoryItemId) Deletes an inventory item.dev.morphia.DatastoregetInventoryItem(String inventoryItemId) Gets the specific inventory item with the id, or throws aNotFoundExceptionif 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 aNotFoundExceptionif 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 publicVisiblevoidsetDatastore(dev.morphia.Datastore datastore) voidsetDozerMapper(MapperRegistry dozerMapperRegistry) voidsetMongoConcurrentUtils(MongoConcurrentUtils mongoConcurrentUtils) voidsetMongoDBUtils(MongoDBUtils mongoDBUtils) voidsetMongoItemDao(MongoItemDao mongoItemDao) voidsetMongoUserDao(MongoUserDao mongoUserDao) setQuantityForItem(User user, String itemNameOrId, int priority, int quantity) Adjusts the quantity of the supplied item and user.voidsetValidationHelper(ValidationHelper validationHelper) updateInventoryItem(String inventoryItemId, int quantity) Updates the specific inventory item with the id, or throws aNotFoundExceptionif the inventory item can't be found.
-
Constructor Details
-
MongoInventoryItemDao
public MongoInventoryItemDao()
-
-
Method Details
-
getInventoryItem
Description copied from interface:InventoryItemDaoGets the specific inventory item with the id, or throws aNotFoundExceptionif the inventory item can't be found.- Specified by:
getInventoryItemin interfaceInventoryItemDao- Returns:
- the
InventoryItemthat was requested, never null
-
getInventoryItemByItemNameOrId
Description copied from interface:InventoryItemDaoGets the primary (single) inventory item for with the item name or id, or throws aNotFoundExceptionif the item or inventory item can't be found.- Specified by:
getInventoryItemByItemNameOrIdin interfaceInventoryItemDao- Parameters:
user- theUserthat owns the itemitemNameOrId- an item name or ID to limit the resultspriority-- Returns:
- the
InventoryItemthat was requested, never null
-
getUserPublicInventoryItems
Description copied from interface:InventoryItemDaoGets inventory items for specified user, which are flagged publicVisible- Specified by:
getUserPublicInventoryItemsin interfaceInventoryItemDao- Parameters:
offset- the offsetcount- the count- Returns:
- a
PaginationofInventoryItemobjects.
-
getInventoryItems
Description copied from interface:InventoryItemDaoGets inventory items specifying the offset and the count, specifying a search filter.- Specified by:
getInventoryItemsin interfaceInventoryItemDao- Parameters:
offset- the offsetcount- the countuser- theUserthat owns the itemssearch- a query to filter the results- Returns:
- a
PaginationofInventoryItemobjects.
-
getInventoryItems
Description copied from interface:InventoryItemDaoGets inventory items specifying the offset and the count.- Specified by:
getInventoryItemsin interfaceInventoryItemDao- Parameters:
offset- the offsetcount- the count- Returns:
- a
PaginationofInventoryItemobjects.
-
createInventoryItem
Description copied from interface:InventoryItemDaoCreates an inventory item. The value ofInventoryItem.getId()will be ignored.- Specified by:
createInventoryItemin interfaceInventoryItemDao- Returns:
- the
InventoryItemas it was written into the database
-
updateInventoryItem
Description copied from interface:InventoryItemDaoUpdates the specific inventory item with the id, or throws aNotFoundExceptionif the inventory item can't be found. TheInventoryItem.getId()is used to key the inventory item being updated.- Specified by:
updateInventoryItemin interfaceInventoryItemDao- Parameters:
inventoryItemId-quantity-- Returns:
- the
InventoryItemas it was written into the database
-
setQuantityForItem
Description copied from interface:InventoryItemDaoAdjusts the quantity of the supplied item and user.- Specified by:
setQuantityForItemin interfaceInventoryItemDao- Parameters:
user- theUserfor 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:InventoryItemDaoAdjusts the quantity of the supplied item and user.- Specified by:
adjustQuantityForItemin 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:InventoryItemDaoConvenience method which allows for invokingInventoryItemDao.adjustQuantityForItem(String, int)without needing to create the item first.- Specified by:
adjustQuantityForItemin 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:InventoryItemDaoDeletes an inventory item.- Specified by:
deleteInventoryItemin 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
-