View Javadoc

1   /**
2    * Copyright 2005-2012 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  package org.kuali.rice.krms.api.engine;
17  
18  /**
19   * Defines various possible flags that can be used to control how the rules
20   * engine executes and performs it's evaluation of rules.  These flags are
21   * meant to be set to either true or false.  This is done using the
22   * {@link ExecutionOptions} that are passed to the engine at execution time.
23   * 
24   * @see ExecutionOptions
25   * 
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   *
28   */
29  public enum ExecutionFlag {
30  
31  	/**
32  	 * Indicates that the engine should perform default logging by recording
33  	 * each {@link ResultEvent} in the {@link EngineResults}.  Default value
34  	 * is false.
35  	 * 
36  	 * @see EngineResults
37  	 */
38  	LOG_EXECUTION(false),
39  	
40  	/**
41  	 * Indicates that the selection criteria which is passed to the engine
42  	 * at the time of execution must be able to select a valid context in
43  	 * order for engine execution to proceed.  Default value is false,
44  	 * when false the engine will simply not execute if no valid context
45  	 * can be located for the specified selection criteria.
46  	 * 
47  	 * @see SelectionCriteria
48  	 */
49  	CONTEXT_MUST_EXIST(false),
50  	
51  	/**
52  	 * Instructs the engine to evaluate all propositions.  If this value is
53  	 * set to false, the engine may skip (aka short circuit) propositions that 
54  	 * do not influence the overall outcome of the proposition tree.  
55  	 */
56  	EVALUATE_ALL_PROPOSITIONS(false);
57  	
58  	private final boolean defaultValue;
59  
60      /**
61       * Create an ExecutionFlag with the given value
62       * @param defaultValue to set the defaultValue to
63       */
64  	private ExecutionFlag(boolean defaultValue) {
65  		this.defaultValue = defaultValue;
66  	}
67  	
68  	/**
69  	 * Returns the default value for the flag if it has not been explicitly set.
70  	 * 
71  	 * @return the default value for the flag
72  	 */
73  	public boolean getDefaultValue() {
74  		return this.defaultValue;
75  	}
76  	
77  }