1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.kuali.rice.krms.impl.repository.mock;
21
22 import org.kuali.rice.krms.api.repository.RuleManagementService;
23 import org.kuali.rice.krms.api.repository.context.ContextDefinition;
24
25
26
27
28
29 public class KrmsContextLoader {
30
31 private RuleManagementService ruleManagementService = null;
32
33 public RuleManagementService getRuleManagementService() {
34 return ruleManagementService;
35 }
36
37 public void setRuleManagementService(RuleManagementService ruleManagementService) {
38 this.ruleManagementService = ruleManagementService;
39 }
40
41 public void loadContext(String id, String namespace, String name, String typeId, String description) {
42
43 ContextDefinition.Builder bldr = ContextDefinition.Builder.create(namespace, name);
44 bldr.setId(id);
45 bldr.setActive(true);
46 bldr.setTypeId(typeId);
47 bldr.setDescription(description);
48 this.getRuleManagementService().createContext(bldr.build());
49 }
50
51 public void load() {
52 loadContext("10000", "KS-SYS", "Course Requirements", "T1004", "Course Requirements");
53 loadContext("10001", "KS-SYS", "Program Requirements", "T1004", "Program Requirements");
54 }
55
56 }