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