Class MongoMultiMatchDao
java.lang.Object
dev.getelements.elements.dao.mongo.match.MongoMultiMatchDao
- All Implemented Interfaces:
MultiMatchDao
-
Field Summary
Fields inherited from interface dev.getelements.elements.sdk.dao.MultiMatchDao
MULTI_MATCH_ADD_PROFILE, MULTI_MATCH_CREATED, MULTI_MATCH_DELETED, MULTI_MATCH_EXPIRED, MULTI_MATCH_REMOVE_PROFILE, MULTI_MATCH_UPDATED, MULTI_MATCHES_TRUNCATED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddProfile(String multiMatchId, Profile profile) Adds a newProfileto theMultiMatch.closeMatch(String multiMatchId) Flags theMultiMatchas closed, disallowing players to join.createMultiMatch(MultiMatch multiMatch) Creates a newMultiMatchwith no players.createMultiMatch(MultiMatch multiMatch, UniqueCodeDao.GenerationParameters joinCodeGenerationParameters) Creates a newMultiMatchwith no players.voidDeletes all of theMultiMatchinstances.Flags theMultiMatchas ended, disallowing players to join.findMongoMultiMatch(String multiMatchId) findMultiMatch(String multiMatchId) Finds aMultiMatchby its ID.findMultiMatchByJoinCode(String joinCode) Finds aMultiMatchby its ID.findOldestAvailableMultiMatchCandidate(MatchmakingApplicationConfiguration configuration, String profileId, String search) Finds the latestMultiMatchfor the given configuration and profile ID.getAllMultiMatches(String search) Gets allMultiMatchinstances.dev.morphia.query.Query<MongoMultiMatch> dev.morphia.DatastoregetMultiMatches(int offset, int count, String search) Fetches a paginated subset ofMultiMatchinstances matching the search.getProfiles(String multiMatchId) Gets allProfileinstances in theMultiMatch.Flags theMultiMatchas open, allowing players to join.refreshMatch(String multiMatchId) Refreshes theMultiMatch, resetting its expiry timer.removeProfile(String multiMatchId, Profile profile) Removes theProfileto theMultiMatch.voidsetBooleanQueryParser(BooleanQueryParser booleanQueryParser) voidsetDatastore(dev.morphia.Datastore datastore) voidsetDozerMapper(MapperRegistry dozerMapperRegistry) voidsetEventPublisher(Consumer<Event> eventPublisher) voidsetMapperRegistry(MapperRegistry mapperRegistry) voidsetMongoApplicationConfigurationDao(MongoApplicationConfigurationDao mongoApplicationConfigurationDao) voidsetMongoApplicationDao(MongoApplicationDao mongoApplicationDao) voidsetMongoDBUtils(MongoDBUtils mongoDBUtils) voidsetMongoProfileDao(MongoProfileDao mongoProfileDao) voidsetMongoUniqueCodeDao(MongoUniqueCodeDao mongoUniqueCodeDao) voidsetValidationHelper(ValidationHelper validationHelper) booleantryDeleteMultiMatch(String multiMatchId) Deletes theMultiMatchwith the given ID, returning true if it was deleted, false if it did not exist.updateMultiMatch(String matchId, MultiMatch multiMatch) Creates a newMultiMatchwith no players.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.getelements.elements.sdk.dao.MultiMatchDao
deleteMultiMatch, getAllMultiMatches, getMultiMatch, getMultiMatchByJoinCode, getMultiMatches
-
Constructor Details
-
MongoMultiMatchDao
public MongoMultiMatchDao()
-
-
Method Details
-
getAllMultiMatches
Description copied from interface:MultiMatchDaoGets allMultiMatchinstances.- Specified by:
getAllMultiMatchesin interfaceMultiMatchDao- Parameters:
search- the query to execute- Returns:
- a
ListofMultiMatchinstances
-
getMultiMatches
Description copied from interface:MultiMatchDaoFetches a paginated subset ofMultiMatchinstances matching the search.- Specified by:
getMultiMatchesin interfaceMultiMatchDao- Parameters:
offset- - Pagination offsetcount- - Maximum objects in resultssearch- - Search query to filter results- Returns:
- Pagination of
MultiMatch
-
findMultiMatch
Description copied from interface:MultiMatchDaoFinds aMultiMatchby its ID.- Specified by:
findMultiMatchin interfaceMultiMatchDao- Parameters:
multiMatchId- the ID of the multi-match to find.- Returns:
- the found
MultiMatch, or an empty Optional if not found.
-
findMultiMatchByJoinCode
Description copied from interface:MultiMatchDaoFinds aMultiMatchby its ID.- Specified by:
findMultiMatchByJoinCodein interfaceMultiMatchDao- Parameters:
joinCode- the join code of the multi match.- Returns:
- the found
MultiMatch, or an empty Optional if not found.
-
findMongoMultiMatch
-
findOldestAvailableMultiMatchCandidate
public Optional<MultiMatch> findOldestAvailableMultiMatchCandidate(MatchmakingApplicationConfiguration configuration, String profileId, String search) Description copied from interface:MultiMatchDaoFinds the latestMultiMatchfor the given configuration and profile ID. This method will exclude any matches that the specific profile currently not participating in. If no match meets the criteria, then an empty optional is returned allowing downstream code to create a new match. Additionally, a query can be provided to further filter the matches that are considered. The query is appended to the supplied criteria.- Specified by:
findOldestAvailableMultiMatchCandidatein interfaceMultiMatchDao- Parameters:
configuration- the matchmaking configurationprofileId- the profile ID to find the latest match forsearch- the query to execute when searching for a match- Returns:
- the found
MultiMatch, or an empty Optional if not found.
-
addProfile
Description copied from interface:MultiMatchDaoAdds a newProfileto theMultiMatch. Automatically sets the match status toMultiMatchStatus.FULLif the match reaches capacity.- Specified by:
addProfilein interfaceMultiMatchDao- Parameters:
multiMatchId- the multi-match id receiving the profileprofile- the profile to add- Returns:
- the updated
MultiMatch
-
removeProfile
Description copied from interface:MultiMatchDaoRemoves theProfileto theMultiMatch. Automatically sets the match status toMultiMatchStatus.OPENif the match was previously full and notMultiMatchStatus.CLOSED.- Specified by:
removeProfilein interfaceMultiMatchDao- Parameters:
multiMatchId- the multi-match id receiving the profileprofile- the profile to add- Returns:
- the updated
MultiMatch
-
getProfiles
Description copied from interface:MultiMatchDaoGets allProfileinstances in theMultiMatch.- Specified by:
getProfilesin interfaceMultiMatchDao- Parameters:
multiMatchId- tbe multi-match id to get profiles from- Returns:
- the
ListofProfileinstances in theMultiMatch
-
createMultiMatch
Description copied from interface:MultiMatchDaoCreates a newMultiMatchwith no players.- Specified by:
createMultiMatchin interfaceMultiMatchDao- Parameters:
multiMatch- theMultiMatchto create- Returns:
- the newly created
MultiMatch
-
createMultiMatch
public MultiMatch createMultiMatch(MultiMatch multiMatch, UniqueCodeDao.GenerationParameters joinCodeGenerationParameters) Description copied from interface:MultiMatchDaoCreates a newMultiMatchwith no players.- Specified by:
createMultiMatchin interfaceMultiMatchDao- Parameters:
multiMatch- theMultiMatchto createjoinCodeGenerationParameters- theUniqueCodeDao.GenerationParametersto use when generating the join code- Returns:
- the newly created
MultiMatch
-
updateMultiMatch
Description copied from interface:MultiMatchDaoCreates a newMultiMatchwith no players.- Specified by:
updateMultiMatchin interfaceMultiMatchDao- Parameters:
multiMatch- theMatchmakingApplicationConfigurationto use- Returns:
- the newly created
MultiMatch
-
openMatch
Description copied from interface:MultiMatchDaoFlags theMultiMatchas open, allowing players to join. If the match is currently full, then this operation will set the match asMultiMatchStatus.FULL, otherwise it will set the match toMultiMatchStatus.OPEN.- Specified by:
openMatchin interfaceMultiMatchDao- Parameters:
multiMatchId- theMultiMatch- Returns:
- the updated
MultiMatch
-
closeMatch
Description copied from interface:MultiMatchDaoFlags theMultiMatchas closed, disallowing players to join. This operation will set the match asMultiMatchStatus.CLOSED. Fails if the match isMultiMatchStatus.ENDED.- Specified by:
closeMatchin interfaceMultiMatchDao- Parameters:
multiMatchId- the multi-match id to refresh- Returns:
- the updated
MultiMatch
-
endMatch
Description copied from interface:MultiMatchDaoFlags theMultiMatchas ended, disallowing players to join. This operation will set the match asMultiMatchStatus.ENDED. Fails if the match is alreadyMultiMatchStatus.ENDED.- Specified by:
endMatchin interfaceMultiMatchDao- Parameters:
multiMatchId- the multi-match id to refresh- Returns:
- the updated
MultiMatch
-
refreshMatch
Description copied from interface:MultiMatchDaoRefreshes theMultiMatch, resetting its expiry timer.- Specified by:
refreshMatchin interfaceMultiMatchDao- Parameters:
multiMatchId- the multi-match id to refresh- Returns:
- the updated
MultiMatch
-
tryDeleteMultiMatch
Description copied from interface:MultiMatchDaoDeletes theMultiMatchwith the given ID, returning true if it was deleted, false if it did not exist.- Specified by:
tryDeleteMultiMatchin interfaceMultiMatchDao
-
deleteAllMultiMatches
public void deleteAllMultiMatches()Description copied from interface:MultiMatchDaoDeletes all of theMultiMatchinstances.- Specified by:
deleteAllMultiMatchesin interfaceMultiMatchDao
-
getBaseQuery
-
getDatastore
public dev.morphia.Datastore getDatastore() -
setDatastore
@Inject public void setDatastore(dev.morphia.Datastore datastore) -
getMongoDBUtils
-
setMongoDBUtils
-
getMapperRegistry
-
setMapperRegistry
-
getBooleanQueryParser
-
setBooleanQueryParser
-
getValidationHelper
-
setValidationHelper
-
getMongoProfileDao
-
setMongoProfileDao
-
getMongoApplicationDao
-
setMongoApplicationDao
-
getMongoApplicationConfigurationDao
-
setMongoApplicationConfigurationDao
@Inject public void setMongoApplicationConfigurationDao(MongoApplicationConfigurationDao mongoApplicationConfigurationDao) -
getDozerMapper
-
setDozerMapper
-
getEventPublisher
-
setEventPublisher
-
getMongoUniqueCodeDao
-
setMongoUniqueCodeDao
-