Class ModuleAssignmentService


  • @Service
    public class ModuleAssignmentService
    extends java.lang.Object
    • Constructor Detail

      • ModuleAssignmentService

        public ModuleAssignmentService()
    • Method Detail

      • getAssignedModules

        @PreAuthorize("hasRole(\'ROLE_ASSIGN_MODULES\')")
        public AssignedModules getAssignedModules​(java.util.UUID chwId)
        Get modules assinged to CHW.
        Parameters:
        chwId - Id of CHW
        Returns:
        modules assigned to CHW with given Id
        Throws:
        EntityNotFoundException - if no assigned modules found for CHW with given id
      • unassignOldModulesVersions

        public void unassignOldModulesVersions​(java.util.List<Module> newModules)
      • updateModuleProgress

        public void updateModuleProgress​(java.util.List<CourseModule> releasedCourseModules)
      • assignModulesToChwsInLocation

        @Transactional
        @PreAuthorize("hasRole(\'ROLE_ASSIGN_MODULES\')")
        public boolean assignModulesToChwsInLocation​(DistrictAssignmentDto assignmentDto)
        Creates DistrictAssignmentLog for District/ Sector/ Facility assignment, and assigns modules to each CHW from a location: district/sector/facility.
        Parameters:
        assignmentDto - dto with district id, list of modules assigned to it and start and end dates
        Returns:
        true if any module was assigned, false otherwise
      • assignModulesToGroup

        @Transactional
        @PreAuthorize("hasRole(\'ROLE_ASSIGN_MODULES\')")
        public boolean assignModulesToGroup​(GroupAssignmentDto assignmentDto)
        Assigns modules to each CHW from a group.
        Parameters:
        assignmentDto - dto with group id, list of modules assigned to it and start and end dates.
        Returns:
        true if any module was assigned, false otherwise