Class MongoRewardIssuanceDao
java.lang.Object
dev.getelements.elements.dao.mongo.MongoRewardIssuanceDao
- All Implemented Interfaces:
RewardIssuanceDao
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Deltes aRewardIssuance
with the supplied id.dev.morphia.Datastore
getOrCreateRewardIssuance
(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.State
s and/or .redeem
(RewardIssuance rewardIssuance) Redeems theRewardIssuance
.void
setDatastore
(dev.morphia.Datastore datastore) void
setDozerMapper
(MapperRegistry dozerMapperRegistry) void
setMongoConcurrentUtils
(MongoConcurrentUtils mongoConcurrentUtils) void
setMongoDBUtils
(MongoDBUtils mongoDBUtils) void
setMongoItemDao
(MongoItemDao mongoItemDao) void
setMongoUserDao
(MongoUserDao mongoUserDao) void
setValidationHelper
(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, wait
Methods inherited from interface dev.getelements.elements.sdk.dao.RewardIssuanceDao
getRewardIssuances
-
Constructor Details
-
MongoRewardIssuanceDao
public MongoRewardIssuanceDao()
-
-
Method Details
-
getRewardIssuance
Description copied from interface:RewardIssuanceDao
Fetches the instance ofRewardIssuance
.- Specified by:
getRewardIssuance
in interfaceRewardIssuanceDao
- Parameters:
id
- the id of theRewardIssuance
as specified byRewardIssuance.getId()
.- Returns:
- the reward issuance
-
getRewardIssuance
Description copied from interface:RewardIssuanceDao
Fetches the reward issuance for the given user and context.- Specified by:
getRewardIssuance
in 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:RewardIssuanceDao
Gets all reward issuances for the given user, optionally specifying the allowableRewardIssuance.State
s and/or .- Specified by:
getRewardIssuances
in 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
Pagination
ofRewardIssuance
-
getOrCreateRewardIssuance
Description copied from interface:RewardIssuanceDao
Gets or creates an instance ofRewardIssuance
. If created, the issuance will be set to a state ofRewardIssuance.State.ISSUED
.- Specified by:
getOrCreateRewardIssuance
in interfaceRewardIssuanceDao
- Parameters:
rewardIssuance
- the instance ofRewardIssuance
to create- Returns:
- the
RewardIssuance
instance
-
updateExpirationTimestamp
public RewardIssuance updateExpirationTimestamp(RewardIssuance rewardIssuance, long expirationTimestamp) Description copied from interface:RewardIssuanceDao
Updates the given issuance to a new expiration timestamp. If a negative value is provided, the value will be unset in the db.- Specified by:
updateExpirationTimestamp
in interfaceRewardIssuanceDao
- Parameters:
rewardIssuance
- the issuance to updateexpirationTimestamp
- the expiration, in ms- Returns:
-
redeem
Description copied from interface:RewardIssuanceDao
Redeems theRewardIssuance
. Once redeemed, the reward will be placed into the associated user's inventory. This method will select anInventoryItem
with a priority of value zero to accept theRewardIssuance
.Additionally this method must guarantee that applying the same
RewardIssuance
multiple times will only credit the user once.- Specified by:
redeem
in interfaceRewardIssuanceDao
- Parameters:
rewardIssuance
- the reward to redeem- Returns:
- the
InventoryItem
to which thisRewardIssuance
was applied.
-
delete
Description copied from interface:RewardIssuanceDao
Deltes aRewardIssuance
with the supplied id.- Specified by:
delete
in 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
-