Package dev.getelements.elements.sdk.dao
Interface SaveDataDocumentDao
- All Known Implementing Classes:
MongoSaveDataDocumentDao
public interface SaveDataDocumentDao
Accesses save data documents from the database.
-
Method Summary
Modifier and TypeMethodDescriptioncheckedUpdate
(SaveDataDocument document) Updates an existingSaveDataDocument
.createSaveDataDocument
(SaveDataDocument document) Creates a newSaveDataDocument
in the database.void
deleteSaveDocument
(String saveDataDocumentId) Deletes the save game document.findProfileSaveDataDocumentBySlot
(String profileId, int slot) Finds the profile scoped save data document supplying the user id and the slot.findSaveDataDocument
(String saveDataDocumentId) Finds aSaveDataDocument
from the supplied id.findUserSaveDataDocumentBySlot
(String userId, int slot) Finds the user-scoped save data document supplying the user id and the slot.forceUpdateSaveDataDocument
(SaveDataDocument document) Updates an existingSaveDataDocument
.default SaveDataDocument
getProfileSaveDataDocumentBySlot
(String profileId, int slot) Gets the profile scoped save data document supplying the user id and the slot.default SaveDataDocument
getSaveDataDocument
(String saveDataDocumentId) Gets aSaveDataDocument
from the supplied id.getSaveDataDocuments
(int offset, int count, String userId, String profileId) Gets all save data documents matching the supplied criteria.getSaveDataDocuments
(int offset, int count, String userId, String profileId, String query) Gets all save data documents matching the supplied criteria.default SaveDataDocument
getUserSaveDataDocumentBySlot
(String userId, int slot) Gets the user-scoped save data document supplying the user id and the slot.
-
Method Details
-
getSaveDataDocument
Gets aSaveDataDocument
from the supplied id.- Parameters:
saveDataDocumentId
- the database-assigned unique id of the save document- Returns:
- the save data document, never null
- Throws:
SaveDataNotFoundException
- if no such save document exists
-
getUserSaveDataDocumentBySlot
Gets the user-scoped save data document supplying the user id and the slot.- Parameters:
userId
-slot
-- Returns:
- the
SaveDataDocument
-
getProfileSaveDataDocumentBySlot
Gets the profile scoped save data document supplying the user id and the slot.- Parameters:
profileId
- the profile Idslot
- the slot- Returns:
- the
SaveDataDocument
-
findSaveDataDocument
Finds aSaveDataDocument
from the supplied id.- Parameters:
saveDataDocumentId
- the save data document ID- Returns:
- an
Optional<SaveDataDocument>
with the data
-
findUserSaveDataDocumentBySlot
Finds the user-scoped save data document supplying the user id and the slot.- Parameters:
userId
-slot
-- Returns:
- the
SaveDataDocument
-
findProfileSaveDataDocumentBySlot
Finds the profile scoped save data document supplying the user id and the slot.- Parameters:
profileId
- the profile Idslot
- the slot- Returns:
- the
SaveDataDocument
-
getSaveDataDocuments
Pagination<SaveDataDocument> getSaveDataDocuments(int offset, int count, String userId, String profileId) Gets all save data documents matching the supplied criteria.- Parameters:
offset
- the index of the offsetcount
- the count of documents immediately following the offsetuserId
- the user id, specify null or empty string to exclude filtering by user idprofileId
- the profile idk specify null or empty string to exclude filtering by profile id- Returns:
- a
Pagination<SaveDataDocument>
of all documents matching the query
-
getSaveDataDocuments
Pagination<SaveDataDocument> getSaveDataDocuments(int offset, int count, String userId, String profileId, String query) Gets all save data documents matching the supplied criteria.- Parameters:
offset
- the index of the offsetcount
- the count of documents immediately following the offsetuserId
- the user id, specify null or empty string to exclude filtering by user idprofileId
- the profile idk specify null or empty string to exclude filtering by profile idquery
- the search query to use when filtering results.- Returns:
- a
Pagination<SaveDataDocument>
of all documents matching the query
-
createSaveDataDocument
Creates a newSaveDataDocument
in the database.- Parameters:
document
- the document to create- Returns:
- the document as it was created in the database
-
forceUpdateSaveDataDocument
Updates an existingSaveDataDocument
. This method ignores the version check and will forcibly overwrite the contents of the save file.- Parameters:
document
- the document to update- Returns:
- the document as it was written to the database
-
checkedUpdate
Updates an existingSaveDataDocument
. This method ensures that the supplied version matches that of the database before the write takes.- Parameters:
document
- the document- Returns:
- the document as it was written to the database
- Throws:
SaveDataNotFoundException
- if the document was not found, or the version mismatched
-
deleteSaveDocument
Deletes the save game document.- Parameters:
saveDataDocumentId
- the save game document ID
-