Class StandardAdvancementService
java.lang.Object
dev.getelements.elements.service.advancement.StandardAdvancementService
- All Implemented Interfaces:
AdvancementService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadvanceProgress
(Profile profile, String missionNameOrId, int amount) AdvancesProgress
by decrementing the value specified by the amount, and returning the prizes rewarded in the form of anAdvancement
object.void
setMapper
(MapperRegistry mapperRegistry) void
setMissionDao
(MissionDao missionDao) void
setProfileDao
(ProfileDao profileDao) void
setProgressDao
(ProgressDao progressDao) startMission
(Profile profile, String missionNameOrId)
-
Constructor Details
-
StandardAdvancementService
public StandardAdvancementService()
-
-
Method Details
-
startMission
Description copied from interface:AdvancementService
Begins aMission
by assigning and creating a new instance ofProgress
. This is shorthand for looking up a mission by name (Mission.getName()
), setting theProfile
and saving to the database.- Specified by:
startMission
in interfaceAdvancementService
- Parameters:
profile
- theProfile
of the person starting the missionmissionNameOrId
- the unique name of theMission
, as determined byMission.getName()
-
advanceProgress
Description copied from interface:AdvancementService
AdvancesProgress
by decrementing the value specified by the amount, and returning the prizes rewarded in the form of anAdvancement
object. Specifically, this will involve the follwing operations:- If the Profile has no
Progress
for the supplied mission, then there shall be no side-effects. - Otherwise, decrement the value tracked by
Progress.getRemaining()
using the specified amount - If, after subtraction, the result is <= 0 advance to the next
Step
in theMission
- Carry over any remaining actions to the next step.
- Continue rewarding
Reward
instances until all actions are consumed - Continue tracking complete
Step
s until all actions are consumed
- Specified by:
advanceProgress
in interfaceAdvancementService
- Parameters:
profile
- theProfile
tracking theMission
missionNameOrId
- theMission
's name as determined byMission.getName()
.amount
- the amount of actions to apply to theProgress.getRemaining()
- Returns:
- the
Advancement
, never null
- If the Profile has no
-
getMapper
-
setMapper
-
getProfileDao
-
setProfileDao
-
getMissionDao
-
setMissionDao
-
getProgressDao
-
setProgressDao
-