Package dev.getelements.elements.sdk.dao
Interface ItemDao
- All Known Implementing Classes:
MongoItemDao
public interface ItemDao
-
Method Summary
Modifier and TypeMethodDescriptioncreateItem
(Item item) Creates a new Item.getItemByIdOrName
(String identifier) Retrieves a single Item from the database by its id property or name property.Returns all Items in the subset of items filtered by tags and the given offset position.updateItem
(Item item) Updates a given Item.
-
Method Details
-
getItemByIdOrName
Retrieves a single Item from the database by its id property or name property.- Parameters:
identifier
- Either an id or name of the Item- Returns:
- An representation of the Item as it exists in the database.
- Throws:
NotFoundException
- if the backing data store does not have an Item that is identified by the passed in identifier
-
getItems
Returns all Items in the subset of items filtered by tags and the given offset position. The count parameter should be greater than 0, but may also be overridden by a system defined limit on the number of records that can be returned at once.- Parameters:
offset
- the offset, which should be a positive integercount
- a maximum amount of items to be returned, which should be a positive integer greater than 0tags
- A set of tags to filter items bycategory
-query
- A search query to filter items by- Returns:
- A
Pagination
of allItem
records within the range specified by the offset and count parameters.
-
updateItem
Updates a given Item.- Parameters:
item
- An Item to be updated.- Returns:
- The updated representation of the Item as it exists in the database
- Throws:
InvalidDataException
- if the state of the passed in Item is invalid
-
createItem
Creates a new Item. All properties except for the Id property must be set to valid values. The name property must also be unique in order for this call to succeed.- Parameters:
item
- A new Item- Returns:
- A representation of the Item as it exists in the database after a successful write.
- Throws:
InvalidDataException
- if the state of the passed in Item is invalidDuplicateException
- if the passed in Item has a name that already exists
-