• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

openmrs / openmrs-module-webservices.rest / 17263834497

27 Aug 2025 10:12AM UTC coverage: 68.44% (-1.5%) from 69.946%
17263834497

push

github

web-flow
RESTWS-988: Update to OpenMRS Platform 2.7.x and Support Java 21 (#670)

* Update to Platform 2.7.x

* Merge 2.5 and 2.7

* Merge 2.4 and 2.7

* Merge omod and omod-2.7

* Update ChangePasswordController1_8

* Move InitPathMatcher2_4 to the correct package

* Address review comments

* Add the licence header

* Revert AnimalResource_1_11

* Update tests

* Update tests

* Update AnimalClassResourceLegacy

* Remove setCurrentOpenMRSVersion method

* Revert formatting changes

* Revert formatting changes

* Revert formatting changes

* Merge omod and commons

* Revert "Merge omod and commons"

This reverts commit c68ef20d3.

* Move RestServiceImplTest to omod

* Remove AnimalClassResourceLegacy.java

* fix doSearch_shouldProcessIncludeAll

* update doSearch_shouldProcessIncludeAll

* update doSearch_shouldProcessIncludeAll

* Use hamcrest in ProviderController2_0Test

10 of 15 new or added lines in 5 files covered. (66.67%)

239 existing lines in 7 files now uncovered.

9572 of 13986 relevant lines covered (68.44%)

0.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/omod-common/src/main/java/org/openmrs/module/webservices/helper/TaskServiceWrapper.java
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
3
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
4
 * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
5
 * the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
6
 *
7
 * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
8
 * graphic logo is a trademark of OpenMRS Inc.
9
 */
10

11
package org.openmrs.module.webservices.helper;
12

13
import org.openmrs.scheduler.TaskDefinition;
14
import org.openmrs.scheduler.TaskFactory;
15
import org.openmrs.scheduler.SchedulerException;
16
import org.openmrs.scheduler.Task;
17
import org.openmrs.api.context.Context;
18

19
import java.util.Collection;
20
import java.util.concurrent.ExecutionException;
21

22
/**
23
 * Wrapping the required task information between related resource and SchedulerService
24
 */
25
public class TaskServiceWrapper {
×
26
        
27
        public TaskDefinition getTaskById(Integer id) {
28
                return Context.getSchedulerService().getTask(id);
×
29
        }
30
        
31
        public TaskDefinition getTaskByName(String taskName) {
32
                return Context.getSchedulerService().getTaskByName(taskName);
×
33
        }
34
        
35
        public Collection<TaskDefinition> getScheduledTasks() {
36
                return Context.getSchedulerService().getScheduledTasks();
×
37
        }
38
        
39
        public Collection<TaskDefinition> getRegisteredTasks() {
40
                return Context.getSchedulerService().getRegisteredTasks();
×
41
        }
42
        
43
        /**
44
         * Save the new task in the service
45
         * 
46
         * @param task will contain the taskDefinition to be saved
47
         */
48
        public void saveTaskDefinition(TaskDefinition task) {
49
                Context.getSchedulerService().saveTaskDefinition(task);
×
50
        }
×
51
        
52
        /**
53
         * It will delete the task from the service
54
         * 
55
         * @param task will contain the taskDefinition to be deleted
56
         * @throws SchedulerException - It will throw in case of any SchedulerService exceptions
57
         */
58
        public void deleteTask(TaskDefinition task) throws SchedulerException {
59
                Context.getSchedulerService().deleteTask(task.getId());
×
60
        }
×
61
        
62
        /**
63
         * It will schedule a task which is registered in the service
64
         * 
65
         * @param task contains the taskDefinition to be scheduled
66
         * @throws SchedulerException - It will throw in case of any SchedulerService exceptions
67
         */
68
        public void scheduleTask(TaskDefinition task) throws SchedulerException {
69
                Context.getSchedulerService().scheduleTask(task);
×
70
                
71
        }
×
72
        
73
        /**
74
         * It will shutdown a task which is scheduled in the service
75
         * 
76
         * @param task contains the taskDefinition to be shutdown
77
         * @throws SchedulerException - It will throw in case of any SchedulerService exceptions
78
         */
79
        public void shutDownTask(TaskDefinition task) throws SchedulerException {
80
                Context.getSchedulerService().shutdownTask(task);
×
81
        }
×
82
        
83
        /**
84
         * It will re-schedule a task which is registered in the service
85
         * 
86
         * @param task contains the taskDefinition to be re-scheduled
87
         * @throws SchedulerException - It will throw in case of any SchedulerService exceptions
88
         */
89
        public void reScheduleTask(TaskDefinition task) throws SchedulerException {
90
                Context.getSchedulerService().rescheduleTask(task);
×
91
        }
×
92
        
93
        /**
94
         * It will re-schedule all the tasks which are registered in the service
95
         * 
96
         * @throws SchedulerException - It will throw in case of any SchedulerService exceptions
97
         */
98
        public void reScheduleAllTasks() throws SchedulerException {
99
                Context.getSchedulerService().rescheduleAllTasks();
×
100
        }
×
101
        
102
        /**
103
         * It will run the task from the service
104
         * 
105
         * @param task will contain the taskDefinition to be run
106
         * @throws SchedulerException - It will throw in case of any SchedulerService exceptions
107
         */
108
        public void runTask(TaskDefinition taskDefinition) throws SchedulerException {
109
                Task task = TaskFactory.getInstance().createInstance(taskDefinition);
×
110
        try {
NEW
111
            task.execute();
×
NEW
112
        } catch (InterruptedException | ExecutionException e) {
×
NEW
113
            throw new RuntimeException(e);
×
NEW
114
        }
×
NEW
115
    }
×
116
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc