org.kuali.rice.krms.api.engine
Class ExecutionOptions

java.lang.Object
  extended by org.kuali.rice.krms.api.engine.ExecutionOptions

public final class ExecutionOptions
extends Object

The ExecutionOptions contain a set of options that can be passed to the KRMS engine to control certain aspects related to it's execution. It supports two different types of options:

  1. flags - a map of pre-defined boolean ExecutionFlag instances which can be either true or false
  2. options - a general-purpose map of Strings which can be used to define optinos that have non-boolen values

The options map can be used to pass user-defined or provider-specific options. The ExecutionOptions are made available as part of the ExecutionEnvironment during engine execution.

Instances of ExecutionOptions are not safe for use by multiple threads.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Constructor Summary
ExecutionOptions()
          Construct an empty set of execution options.
ExecutionOptions(ExecutionOptions executionOptions)
          Constructs a new set of execution options, initialized with all options and flags copied from the given set of execution options.
 
Method Summary
 boolean getFlag(ExecutionFlag flag)
          Returns the value the given flag.
 Map<ExecutionFlag,Boolean> getFlags()
          Returns an immutable map of the flags that have been set on this object.
 String getOption(String optionName)
          Returns the value for the option with the given name, or null if the option is not set.
 Map<String,String> getOptions()
          Returns an immutable map of the options that have been set on this object.
 boolean isFlagSet(ExecutionFlag flag)
          Checks whether or not the given flag is set.
 boolean isOptionSet(String optionName)
          Checks whether or not the option with the given name has been set.
 ExecutionOptions removeFlag(ExecutionFlag flag)
          Removes the specified flag (if it has been set) from the set of execution options.
 ExecutionOptions removeOption(String optionName)
          Removes the option with the specified name (if it has been set) from the set of execution options.
 ExecutionOptions setFlag(ExecutionFlag flag, boolean value)
          Sets the value for the given flag to the given boolean value.
 ExecutionOptions setOption(String optionName, String value)
          Sets the value for the given option name to the given value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecutionOptions

public ExecutionOptions()
Construct an empty set of execution options.


ExecutionOptions

public ExecutionOptions(ExecutionOptions executionOptions)
Constructs a new set of execution options, initialized with all options and flags copied from the given set of execution options.

Parameters:
executionOptions - the execution options from which to copy into the newly created instance. If the given execution options are null, then this constructor is equivalent to ExecutionOptions()
Method Detail

setFlag

public ExecutionOptions setFlag(ExecutionFlag flag,
                                boolean value)
Sets the value for the given flag to the given boolean value.

Parameters:
flag - the flag to set
value - the flag value to set
Returns:
a reference to this object
Throws:
IllegalArgumentException - if the given flag is null

setOption

public ExecutionOptions setOption(String optionName,
                                  String value)
Sets the value for the given option name to the given value.

Parameters:
optionName - the name of the option to set
value - the value of the option to set
Returns:
a reference to this object
Throws:
IllegalArgumentException - if the given optionName is blank

removeFlag

public ExecutionOptions removeFlag(ExecutionFlag flag)
Removes the specified flag (if it has been set) from the set of execution options. If the flag is not currently set, this method will do nothing.

Parameters:
flag - the flag to remove
Returns:
a reference to this object
Throws:
IllegalArgumentException - if the given flag is null

removeOption

public ExecutionOptions removeOption(String optionName)
Removes the option with the specified name (if it has been set) from the set of execution options. If the option is not currently set, this method will do nothing.

Parameters:
optionName - the name of the option to remove
Returns:
a reference to this object
Throws:
IllegalArgumentException - if the given optionName is blank

getFlag

public boolean getFlag(ExecutionFlag flag)
Returns the value the given flag. If the specified flag has not been set on this object, then ExecutionFlag.getDefaultValue() will be returned.

Parameters:
flag - the flag to check
Returns:
the value of the flag, or the flag's default value if the flag value is not currently set on this object
Throws:
IllegalArgumentException - if the given flag is null

getOption

public String getOption(String optionName)
Returns the value for the option with the given name, or null if the option is not set.

Parameters:
optionName - the name of the option for which to retrieve the value
Returns:
the value of the option, or null if the option is not set
Throws:
IllegalArgumentException - if the given optionName is blank

isFlagSet

public boolean isFlagSet(ExecutionFlag flag)
Checks whether or not the given flag is set.

Parameters:
flag - the flag to check
Returns:
true if the flag is set, false if not
Throws:
IllegalArgumentException - if the given flag is null

isOptionSet

public boolean isOptionSet(String optionName)
Checks whether or not the option with the given name has been set.

Parameters:
optionName - the name of the option to check
Returns:
true if the option is set, false if not
Throws:
IllegalArgumentException - if the given optionName is blank

getFlags

public Map<ExecutionFlag,Boolean> getFlags()
Returns an immutable map of the flags that have been set on this object.

Returns:
the flags that have been set, this map be empty but will never be null

getOptions

public Map<String,String> getOptions()
Returns an immutable map of the options that have been set on this object.

Returns:
the options that have been set, this map be empty but will never be null


Copyright © 2005-2014 The Kuali Foundation. All Rights Reserved.