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.term.TermRepositoryService;
24  import org.kuali.rice.krms.api.repository.type.KrmsTypeRepositoryService;
25  
26  /**
27   *
28   * @author nwright
29   */
30  public class KrmsConfigurationLoader {
31  
32      private KrmsTypeRepositoryService krmsTypeRepositoryService = null;
33      private RuleManagementService ruleManagementService = null;
34      private TermRepositoryService termRepositoryService = null;
35  
36      public KrmsTypeRepositoryService getKrmsTypeRepositoryService() {
37  
38          return krmsTypeRepositoryService;
39      }
40  
41      public void setKrmsTypeRepositoryService(KrmsTypeRepositoryService krmsTypeRepositoryService) {
42          this.krmsTypeRepositoryService = krmsTypeRepositoryService;
43      }
44  
45      public RuleManagementService getRuleManagementService() {
46          return ruleManagementService;
47      }
48  
49      public void setRuleManagementService(RuleManagementService ruleManagementService) {
50          this.ruleManagementService = ruleManagementService;
51      }
52  
53      public TermRepositoryService getTermRepositoryService() {
54          return termRepositoryService;
55      }
56  
57      public void setTermRepositoryService(TermRepositoryService termRepositoryService) {
58          this.termRepositoryService = termRepositoryService;
59      }
60  
61      public void loadConfiguration() {
62          this.loadTypes();
63          this.loadTypeRelations();
64          this.loadNlUsages();
65          this.loadNaturalLanguateTemplates();
66          this.loadTermSpecs();
67          this.loadTermResolvers();
68          this.loadContexts();
69      }
70  
71      private void loadTypes() {
72          KrmsTypeLoader loader = new KrmsTypeLoader();
73          loader.setKrmsTypeRepositoryService(krmsTypeRepositoryService);
74          loader.load();
75      }
76  
77      private void loadTypeRelations() {
78          KrmsTypeRelationLoader loader = new KrmsTypeRelationLoader();
79          loader.setKrmsTypeRepositoryService(krmsTypeRepositoryService);
80          loader.load();
81      }
82  
83      private void loadNlUsages() {
84          KrmsNaturalLanguageUsageLoader loader = new KrmsNaturalLanguageUsageLoader();
85          loader.setRuleManagementService(this.ruleManagementService);
86          loader.load();
87      }
88  
89      private void loadNaturalLanguateTemplates() {
90          KrmsNaturalLanguageTemplateLoader loader = new KrmsNaturalLanguageTemplateLoader();
91          loader.setRuleManagementService(this.ruleManagementService);
92          loader.load();
93      }
94  
95      private void loadTermSpecs() {
96          KrmsTermSpecificationLoader loader = new KrmsTermSpecificationLoader();
97          loader.setTermRepositoryService(this.termRepositoryService);
98          loader.load();
99      }
100 
101     private void loadTermResolvers() {
102         KrmsTermResolverLoader loader = new KrmsTermResolverLoader();
103         loader.setTermRepositoryService(this.termRepositoryService);
104         loader.load();
105     }
106     // TODO: decide if we should even load these instead of find/create them as needed
107 
108     private void loadContexts() {
109         KrmsContextLoader loader = new KrmsContextLoader();
110         loader.setRuleManagementService(this.ruleManagementService);
111         loader.load();
112     }
113 }