001 /**
002 * Copyright 2005-2011 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.rice.krms.api.engine;
017
018 /**
019 * Defines various possible flags that can be used to control how the rules
020 * engine executes and performs it's evaluation of rules. These flags are
021 * meant to be set to either true or false. This is done using the
022 * {@link ExecutionOptions} that are passed to the engine at execution time.
023 *
024 * @see ExecutionOptions
025 *
026 * @author Kuali Rice Team (rice.collab@kuali.org)
027 *
028 */
029 public enum ExecutionFlag {
030
031 /**
032 * Indicates that the engine should perform default logging by recording
033 * each {@link ResultEvent} in the {@link EngineResults}. Default value
034 * is false.
035 *
036 * @see EngineResults
037 */
038 LOG_EXECUTION(false),
039
040 /**
041 * Indicates that the selection criteria which is passed to the engine
042 * at the time of execution must be able to select a valid context in
043 * order for engine execution to proceed. Default value is false,
044 * when false the engine will simply not execute if no valid context
045 * can be located for the specified selection criteria.
046 *
047 * @see SelectionCriteria
048 */
049 CONTEXT_MUST_EXIST(false),
050
051 /**
052 * Instructs the engine to evaluate all propositions. If this value is
053 * set to false, the engine may skip (aka short circuit) propositions that
054 * do not influence the overall outcome of the proposition tree.
055 */
056 EVALUATE_ALL_PROPOSITIONS(false);
057
058 private final boolean defaultValue;
059
060 private ExecutionFlag(boolean defaultValue) {
061 this.defaultValue = defaultValue;
062 }
063
064 /**
065 * Returns the default value for the flag if it has not been explicitly set.
066 *
067 * @return the default value for the flag
068 */
069 public boolean getDefaultValue() {
070 return this.defaultValue;
071 }
072
073 }