Class StandardAdvancementService

java.lang.Object
dev.getelements.elements.service.advancement.StandardAdvancementService
All Implemented Interfaces:
AdvancementService

public class StandardAdvancementService extends Object implements AdvancementService
  • Constructor Details

    • StandardAdvancementService

      public StandardAdvancementService()
  • Method Details

    • startMission

      public Progress startMission(Profile profile, String missionNameOrId)
      Description copied from interface: AdvancementService
      Begins a Mission by assigning and creating a new instance of Progress. This is shorthand for looking up a mission by name (Mission.getName()), setting the Profile and saving to the database.
      Specified by:
      startMission in interface AdvancementService
      Parameters:
      profile - the Profile of the person starting the mission
      missionNameOrId - the unique name of the Mission, as determined by Mission.getName()
    • advanceProgress

      public Progress advanceProgress(Profile profile, String missionNameOrId, int amount)
      Description copied from interface: AdvancementService
      Advances Progress by decrementing the value specified by the amount, and returning the prizes rewarded in the form of an Advancement 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 the Mission
      • Carry over any remaining actions to the next step.
      • Continue rewarding Reward instances until all actions are consumed
      • Continue tracking complete Steps until all actions are consumed
      Additionally, the operation must be performed atomically without fear of race conditions.
      Specified by:
      advanceProgress in interface AdvancementService
      Parameters:
      profile - the Profile tracking the Mission
      missionNameOrId - the Mission's name as determined by Mission.getName().
      amount - the amount of actions to apply to the Progress.getRemaining()
      Returns:
      the Advancement, never null
    • getMapper

      public MapperRegistry getMapper()
    • setMapper

      @Inject public void setMapper(MapperRegistry mapperRegistry)
    • getProfileDao

      public ProfileDao getProfileDao()
    • setProfileDao

      @Inject public void setProfileDao(ProfileDao profileDao)
    • getMissionDao

      public MissionDao getMissionDao()
    • setMissionDao

      @Inject public void setMissionDao(MissionDao missionDao)
    • getProgressDao

      public ProgressDao getProgressDao()
    • setProgressDao

      @Inject public void setProgressDao(ProgressDao progressDao)