Package org.motechproject.mots.service
Class ModuleAssignmentService
- java.lang.Object
-
- org.motechproject.mots.service.ModuleAssignmentService
-
@Service public class ModuleAssignmentService extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ModuleAssignmentService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assignModules(ModuleAssignmentDto assignmentDto)
Assign modules to CHW and sends module assignment notification.boolean
assignModulesToChwsInLocation(DistrictAssignmentDto assignmentDto)
CreatesDistrictAssignmentLog
forDistrict
/Sector
/Facility
assignment, and assigns modules to each CHW from a location: district/sector/facility.boolean
assignModulesToGroup(GroupAssignmentDto assignmentDto)
Assigns modules to each CHW from a group.AssignedModules
getAssignedModules(java.util.UUID chwId)
Get modules assinged to CHW.void
unassignOldModulesVersions(java.util.List<Module> newModules)
void
updateModuleProgress(java.util.List<CourseModule> releasedCourseModules)
-
-
-
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
-
assignModules
@Transactional @PreAuthorize("hasRole(\'ROLE_ASSIGN_MODULES\')") public void assignModules(ModuleAssignmentDto assignmentDto)
Assign modules to CHW and sends module assignment notification.- Parameters:
assignmentDto
- modules assigned for CHW- Throws:
ModuleAssignmentException
- ifCommunityHealthWorker
's IVR id is nullModuleAssignmentException
- in case of IVR module assignment errorEntityNotFoundException
- if no module found for any module id from assigment modules
-
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)
CreatesDistrictAssignmentLog
forDistrict
/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
-
-