1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.kernel.bi.rules;
24  
25  import java.util.List;
26  import java.util.Map;
27  
28  /**
29   * <a href="RulesEngineUtil.java.html"><b><i>View Source</i></b></a>
30   *
31   * @author Michael C. Han
32   */
33  public class RulesEngineUtil {
34  
35      public static void add(
36              String domainName, RulesResourceRetriever RulesResourceRetriever)
37          throws RulesEngineException {
38  
39          _rulesEngine.add(domainName, RulesResourceRetriever);
40      }
41  
42      public static void add(
43              String domainName, RulesResourceRetriever RulesResourceRetriever,
44              ClassLoader... classloaders)
45          throws RulesEngineException {
46  
47          _rulesEngine.add(domainName, RulesResourceRetriever, classloaders);
48      }
49  
50      public static boolean containsRuleDomain(String domainName)
51          throws RulesEngineException {
52  
53          return _rulesEngine.containsRuleDomain(domainName);
54      }
55  
56      public static void execute(
57              RulesResourceRetriever RulesResourceRetriever, List<Fact<?>> facts)
58          throws RulesEngineException {
59  
60          _rulesEngine.execute(RulesResourceRetriever, facts);
61      }
62  
63      public static void execute(
64              RulesResourceRetriever RulesResourceRetriever, List<Fact<?>> facts,
65              ClassLoader... classloaders)
66          throws RulesEngineException {
67  
68          _rulesEngine.execute(RulesResourceRetriever, facts, classloaders);
69      }
70  
71      public static Map<String, ?> execute(
72              RulesResourceRetriever RulesResourceRetriever, List<Fact<?>> facts,
73              Query query)
74          throws RulesEngineException {
75  
76          return _rulesEngine.execute(RulesResourceRetriever, facts, query);
77      }
78  
79      public static Map<String, ?> execute(
80              RulesResourceRetriever RulesResourceRetriever, List<Fact<?>> facts,
81              Query query, ClassLoader... classloaders)
82          throws RulesEngineException {
83  
84          return _rulesEngine.execute(
85              RulesResourceRetriever, facts, query, classloaders);
86      }
87  
88      public static void execute(String domainName, List<Fact<?>> facts)
89          throws RulesEngineException {
90  
91          _rulesEngine.execute(domainName, facts);
92      }
93  
94      public static void execute(
95              String domainName, List<Fact<?>> facts, ClassLoader... classloaders)
96          throws RulesEngineException {
97  
98          _rulesEngine.execute(domainName, facts, classloaders);
99      }
100 
101     public static Map<String, ?> execute(
102             String domainName, List<Fact<?>> facts, Query query)
103         throws RulesEngineException {
104 
105         return _rulesEngine.execute(domainName, facts, query);
106     }
107 
108     public static Map<String, ?> execute(
109             String domainName, List<Fact<?>> facts, Query query,
110             ClassLoader... classloaders)
111         throws RulesEngineException {
112 
113         return _rulesEngine.execute(domainName, facts, query, classloaders);
114     }
115 
116     public static void remove(String domainName) throws RulesEngineException {
117         _rulesEngine.remove(domainName);
118     }
119 
120     public static void update(
121             String domainName, RulesResourceRetriever RulesResourceRetriever)
122         throws RulesEngineException {
123 
124         _rulesEngine.update(domainName, RulesResourceRetriever);
125     }
126 
127     public static void update(
128             String domainName, RulesResourceRetriever RulesResourceRetriever,
129             ClassLoader... classloaders)
130         throws RulesEngineException {
131 
132         _rulesEngine.update(domainName, RulesResourceRetriever, classloaders);
133     }
134 
135     public void setRulesEngine(RulesEngine rulesEngine) {
136         _rulesEngine = rulesEngine;
137     }
138 
139     private static RulesEngine _rulesEngine;
140 
141 }