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) AdvancesProgressby decrementing the value specified by the amount, and returning the prizes rewarded in the form of anAdvancementobject.voidsetMapper(MapperRegistry mapperRegistry) voidsetMissionDao(MissionDao missionDao) voidsetProfileDao(ProfileDao profileDao) voidsetProgressDao(ProgressDao progressDao) startMission(Profile profile, String missionNameOrId)
-
Constructor Details
-
StandardAdvancementService
public StandardAdvancementService()
-
-
Method Details
-
startMission
Description copied from interface:AdvancementServiceBegins aMissionby assigning and creating a new instance ofProgress. This is shorthand for looking up a mission by name (Mission.getName()), setting theProfileand saving to the database.- Specified by:
startMissionin interfaceAdvancementService- Parameters:
profile- theProfileof the person starting the missionmissionNameOrId- the unique name of theMission, as determined byMission.getName()
-
advanceProgress
Description copied from interface:AdvancementServiceAdvancesProgressby decrementing the value specified by the amount, and returning the prizes rewarded in the form of anAdvancementobject. Specifically, this will involve the follwing operations:- If the Profile has no
Progressfor 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
Stepin theMission - Carry over any remaining actions to the next step.
- Continue rewarding
Rewardinstances until all actions are consumed - Continue tracking complete
Steps until all actions are consumed
- Specified by:
advanceProgressin interfaceAdvancementService- Parameters:
profile- theProfiletracking theMissionmissionNameOrId- 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
-