Class MongoRewardIssuanceDao
java.lang.Object
dev.getelements.elements.dao.mongo.MongoRewardIssuanceDao
- All Implemented Interfaces:
RewardIssuanceDao
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDeltes aRewardIssuancewith the supplied id.dev.morphia.DatastoregetOrCreateRewardIssuance(RewardIssuance rewardIssuance) Gets or creates an instance ofRewardIssuance.getRewardIssuance(User user, String context) Fetches the reward issuance for the given user and context.Fetches the instance ofRewardIssuance.getRewardIssuances(User user, int offset, int count, List<RewardIssuance.State> states, List<String> tags) Gets all reward issuances for the given user, optionally specifying the allowableRewardIssuance.States and/or .redeem(RewardIssuance rewardIssuance) Redeems theRewardIssuance.voidsetDatastore(dev.morphia.Datastore datastore) voidsetDozerMapper(MapperRegistry dozerMapperRegistry) voidsetMongoConcurrentUtils(MongoConcurrentUtils mongoConcurrentUtils) voidsetMongoDBUtils(MongoDBUtils mongoDBUtils) voidsetMongoItemDao(MongoItemDao mongoItemDao) voidsetMongoUserDao(MongoUserDao mongoUserDao) voidsetValidationHelper(ValidationHelper validationHelper) updateExpirationTimestamp(RewardIssuance rewardIssuance, long expirationTimestamp) Updates the given issuance to a new expiration timestamp.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.RewardIssuanceDao
getRewardIssuances
-
Constructor Details
-
MongoRewardIssuanceDao
public MongoRewardIssuanceDao()
-
-
Method Details
-
getRewardIssuance
Description copied from interface:RewardIssuanceDaoFetches the instance ofRewardIssuance.- Specified by:
getRewardIssuancein interfaceRewardIssuanceDao- Parameters:
id- the id of theRewardIssuanceas specified byRewardIssuance.getId().- Returns:
- the reward issuance
-
getRewardIssuance
Description copied from interface:RewardIssuanceDaoFetches the reward issuance for the given user and context.- Specified by:
getRewardIssuancein interfaceRewardIssuanceDao- Parameters:
user-context-- Returns:
- the reward issuance
-
getMongoRewardIssuance
-
getRewardIssuances
public Pagination<RewardIssuance> getRewardIssuances(User user, int offset, int count, List<RewardIssuance.State> states, List<String> tags) Description copied from interface:RewardIssuanceDaoGets all reward issuances for the given user, optionally specifying the allowableRewardIssuance.States and/or .- Specified by:
getRewardIssuancesin interfaceRewardIssuanceDao- Parameters:
offset- the offsetcount- the countstates- if non-empty, will include the requested states in the query. Otherwise states will be ignored in the query.tags- if non-empty, will include the requested set of tags in the query. Otherwise tags will be ignored in the query.- Returns:
- a
PaginationofRewardIssuance
-
getOrCreateRewardIssuance
Description copied from interface:RewardIssuanceDaoGets or creates an instance ofRewardIssuance. If created, the issuance will be set to a state ofRewardIssuance.State.ISSUED.- Specified by:
getOrCreateRewardIssuancein interfaceRewardIssuanceDao- Parameters:
rewardIssuance- the instance ofRewardIssuanceto create- Returns:
- the
RewardIssuanceinstance
-
updateExpirationTimestamp
public RewardIssuance updateExpirationTimestamp(RewardIssuance rewardIssuance, long expirationTimestamp) Description copied from interface:RewardIssuanceDaoUpdates the given issuance to a new expiration timestamp. If a negative value is provided, the value will be unset in the db.- Specified by:
updateExpirationTimestampin interfaceRewardIssuanceDao- Parameters:
rewardIssuance- the issuance to updateexpirationTimestamp- the expiration, in ms- Returns:
-
redeem
Description copied from interface:RewardIssuanceDaoRedeems theRewardIssuance. Once redeemed, the reward will be placed into the associated user's inventory. This method will select anInventoryItemwith a priority of value zero to accept theRewardIssuance.Additionally this method must guarantee that applying the same
RewardIssuancemultiple times will only credit the user once.- Specified by:
redeemin interfaceRewardIssuanceDao- Parameters:
rewardIssuance- the reward to redeem- Returns:
- the
InventoryItemto which thisRewardIssuancewas applied.
-
delete
Description copied from interface:RewardIssuanceDaoDeltes aRewardIssuancewith the supplied id.- Specified by:
deletein interfaceRewardIssuanceDao- Parameters:
id- the id
-
getDozerMapper
-
setDozerMapper
-
getMongoDBUtils
-
setMongoDBUtils
-
getDatastore
public dev.morphia.Datastore getDatastore() -
setDatastore
@Inject public void setDatastore(dev.morphia.Datastore datastore) -
getMongoUserDao
-
setMongoUserDao
-
getMongoItemDao
-
setMongoItemDao
-
getMongoConcurrentUtils
-
setMongoConcurrentUtils
-
getValidationHelper
-
setValidationHelper
-