View Javadoc

1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   package org.kuali.rice.krms.impl.repository.mock;
6   
7   import org.kuali.rice.krms.api.repository.RuleManagementService;
8   import org.kuali.rice.krms.api.repository.context.ContextDefinition;
9   
10  /**
11   *
12   * @author nwright
13   */
14  public class KrmsContextLoader {
15  
16      private RuleManagementService ruleManagementService = null;
17  
18      public RuleManagementService getRuleManagementService() {
19          return ruleManagementService;
20      }
21  
22      public void setRuleManagementService(RuleManagementService ruleManagementService) {
23          this.ruleManagementService = ruleManagementService;
24      }
25      
26      public void loadContext(String id, String namespace, String name, String typeId, String description) {
27  //        CNTXT_ID	NMSPC_CD	NM	TYP_ID	???? What kind of type	ACTV	VER_NBR	DESC_TXT
28          ContextDefinition.Builder bldr = ContextDefinition.Builder.create(namespace, name);
29          bldr.setId(id);
30          bldr.setActive(true);
31          bldr.setTypeId(typeId);
32          bldr.setDescription(description);
33          this.getRuleManagementService().createContext(bldr.build());
34      }
35  
36      public void load() {
37          loadContext("10000", "KS-SYS", "Course Requirements", "T1004", "Course Requirements");
38          loadContext("10001", "KS-SYS", "Program Requirements", "T1004", "Program Requirements");
39      }
40  
41  }