A value info is necessary when you want to attach a value provider to a BOM member. The value info interface defines methods for referencing a custom value provider.
To create a value provider:
-
Implement the interface
IlrValueProvider.
-
Implement the interface
IlrValueInfo and declare your value provider class.
-
Open the BOM Editor in Rule Studio.
-
In the BOM Editor, open the member for which you define the value info.
-
In the Custom Properties section, click Add.
A new custom property is created.
-
For a BOM attribute or a return value, in the Name column, click
newProp and type valueInfo. In the Value column, type the key that you will use in Rule Studio and Rule Team Server to reference your value info class.
For a BOM method, in the
Name column, click
newProp and type
valueInfo[<arg index>],
<arg index> being the index of the argument for which the value info is used. In the
Value column, type the key that you will use in Rule Studio and Rule Team Server to reference your value info class.
You then need to integrate this implementation into Rule Studio and Rule Team Server.
To integrate a value info (and value provider) into Rule Studio:
-
Create an Eclipse plug-in project using the extension point
ilog.rules.studio.model.brl.valueInfo.
-
In the extension point, use the key attribute to specify the name of the key you used for the property
valueInfo, and use the attribute class to specify the fully-qualified name of the value info class.
| Note |
| We recommend that you use the fully-qualified name of the implementation class as the name of the key attribute. If the key is the same as the fully-qualified name of the implementation class, you do not need to integrate the value info into Rule Team Server, it is done automatically.
|
-
Place the value info and value provider classes into the plug-in project.
-
Select your plug-in project, and, on the File menu, click Export.
-
In the Export wizard, in the Plug-in Development folder, select Deployable plug-ins and fragments, and then click Next.
-
In the Available Plug-ins and Fragments section, click Select All.
-
In the Destination tab, in the Directory field, Browse to the directory
<InstallDir>/studio/eclipse.
-
Click the Options tab and select Package plug-ins as individual JAR archives.
-
Click Finish.
The value info and value provider are now implemented into your Rule Studio installation.
To integrate a value info (and value provider) into Rule Team Server:
-
Package a
preferences.properties file into the lib directory of the Rule Team Server EAR.
-
In this file, add a mapping between the key you defined for the
valueInfo property in the BOM Editor and your interface implementation.
myPackage.MyValueInfoImplementation
-
Repackage the Rule Team Server EAR. See Customizing Rule Team Server.
The value info (and value provider) is now implemented into your Rule Team Server installation.
Suppose you need to declare a value provider for a role or phrase that represents a city. The predefined cities need to be structured hierachically by state.
To implement this state/city value provider:
-
Define a class that implements
IlrValueProvider:
// Represents a city, this city is owned by a state
public class City implements Named {
public final State state;
public final String name;
public City(State state, String name) {
public String getName() {
// Represents a state, a state has a list of cities
public class State implements Named {
private final String name;
public State(String name) {
public String getName() {
// Represents a hierarchical predefined set of values for cities
// The hierarchy has two levels, at the root level there are states,
// and each state has a list of cities as children
public class StateCityValueProvider extends IlrAbstractValueProvider {
// The predefined list of states
public static State[] STATES;
// Returns the root level of the hierarchy (all the states)
public Object[] getValues() {
// Returns the children of a predefined value,
// in this case only a state can have children
public Object[] getChildren(Object parent) {
return parent instanceof State ? ((State) parent).cities : null;
// Returns the parent of a predefined value, in this case only a city
// can have a parent (a state)
public Object getParent(Object element) {
return element instanceof City ? ((City) element).state : null;
// Returns true, if a predefined value has children,
// in this case only a state can have children
public boolean hasChildren(Object element) {
return element instanceof State;
// Returns the text to be displayed
// in the drop-down list for that predefined value
public String getDisplayText(Object element, Locale locale) {
return ((Named) element).getName();
// Returns the text to be inserted in
// the text of the rule for that predefined value.
// In this case only a city value can be inserted.
public String getText(Object element, Locale locale) {
return element instanceof City ? ('"' + ((City) element).name + '"') : null;
// The predefined set of cities is not exclusive
public boolean isExclusive() {
-
Declare a value info that provides the
StateCityValueProvider as value provider:
public class StateCityValueInfo implements IlrValueInfo {
public String getValueDescriptor() {
return IlrValueDescriptorConstants.STRING;
private StateCityValueProvider valueProvider;
public IlrValueProvider getValueProvider() {
if (valueProvider == null)
valueProvider = new StateCityValueProvider();
-
To attach the value info to the BOM member, for example if you have a class
Customer with a method that assigns a city to this customer void setCity(String city), define a custom property valueInfo[<arg index>] on this method:
valueInfo[0] = sample.valueInfo.StateCity
-
To integrate the value info into Rule Studio, declare an extension point
ilog.rules.studio.model.brl.valueInfos:
ID:
sample.valueInfo.StateCity
Key:
sample.valueInfo.StateCity
Class:
sample.StateCityValueInfo
Related Concepts
Related Tasks
Related Reference
Related Samples and Tutorials