View Javadoc

1   /**
2    * Copyright 2005-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  /*
17   * To change this template, choose Tools | Templates
18   * and open the template in the editor.
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   * @author nwright
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  //        CNTXT_ID	NMSPC_CD	NM	TYP_ID	???? What kind of type	ACTV	VER_NBR	DESC_TXT
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  }