Rule Designer API

ilog.rules.shared.bom
Class IlrPropertyBOMDomainValueProvider

java.lang.Object
  extended by ilog.rules.shared.bom.IlrPropertyBOMDomainValueProvider
All Implemented Interfaces:
IlrBOMDomainValueProvider
Direct Known Subclasses:
IlrPropertyBOMDomainValueProvider

public class IlrPropertyBOMDomainValueProvider
extends Object
implements IlrBOMDomainValueProvider

This class is an implementation of BOM Domain Value Provider that takes its data from a property file. To provides values for a BOM Domain associated to the BOM Class sample.Book, you must specify the set of Enumerated values that are part of the domain and then properties of this values The syntax of the property file is the following: # this property specifies the list of values that are part of the BOM domain. Values are also names of # the static attributes that will be added to the BOM class. sample.Book.values = Book1, Book2 # This property specified the label to be used for the element Book1. This label is given for the Locale associated to # this property file sample.Book.Book1.label = Book1 # This property specifies the documentation of the element Book1 sample.Book.Book1.documentation = Documentation of the book1 # This property specifies the BOM to XOM mapping statement that will be associated to the BOM static attribute sample.Book.Book1.b2x = return sample.Book.getBook("book1"); # whatever property can be added to any element. In this example, the deprecated property is added to Book1 sample.Book1.deprecated = true


Constructor Summary
IlrPropertyBOMDomainValueProvider(ResourceBundle resources)
          This constructor initializes a property BOM domain value provider from a resource bundle.
IlrPropertyBOMDomainValueProvider(String resourceFile, ClassLoader classLoader)
          This constructor initializes a property BOM domain value provider from a resource file and a class loader.
 
Method Summary
 String getBOM2XOMMapping(String valueName)
          Returns the BOM to XOM mapping of the given value name.
 String getDisplayText(String valueName, Locale locale)
          Returns the display text of the given value name.
 String getDocumentation(String valueName, Locale locale)
          Returns the documentation of the given value name.
 Map getProperties(String valueName)
          Returns a map of properties associated to the given value name.
 String getTranslation(String valueName)
          Returns the translation of the given value name.
 Collection getValues(IlrClass clazz)
          This implementation of IlrBOMDomainValueProvider.getValues() retrieves values stored in the resource file associated to this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ilog.rules.shared.bom.IlrBOMDomainValueProvider
dispose
 

Constructor Detail

IlrPropertyBOMDomainValueProvider

public IlrPropertyBOMDomainValueProvider(ResourceBundle resources)
This constructor initializes a property BOM domain value provider from a resource bundle.

Parameters:
resources -

IlrPropertyBOMDomainValueProvider

public IlrPropertyBOMDomainValueProvider(String resourceFile,
                                         ClassLoader classLoader)
This constructor initializes a property BOM domain value provider from a resource file and a class loader.

Parameters:
resourceFile - the .properties file containing the values
classLoader - the class loader to be used to load the resource file
Method Detail

getValues

public Collection getValues(IlrClass clazz)
This implementation of IlrBOMDomainValueProvider.getValues() retrieves values stored in the resource file associated to this object. List of values can be both specified by a <fqn>.values property, where fqn is the fully qualified name of the class Value of this property is a list of comma-separated elements. If no <fqn>.values is provided, this method retrieves all values from all registered keys in this resource file.

Specified by:
getValues in interface IlrBOMDomainValueProvider
Parameters:
clazz - The BOM class for which this value provider is used.
Returns:
A collection of values (String).

getDisplayText

public String getDisplayText(String valueName,
                             Locale locale)
Returns the display text of the given value name. The value of a property named <fqn>.<valueName>.label is looked-up in the resource file and returned. <fqn> is the fully-qualified name of the BOM class to which this value provider is associated to. The Resource file used is the one that corresponds to the given locale (see ResourceBundle locale resolution).

Specified by:
getDisplayText in interface IlrBOMDomainValueProvider
Parameters:
valueName - the name of the value
locale - the Locale for which this label is asked
Returns:
the label of the given value

getDocumentation

public String getDocumentation(String valueName,
                               Locale locale)
Returns the documentation of the given value name. The value of a property named <fqn>.<valueName>.documentation is looked-up in the resource file and returned. <fqn> is the fully-qualified name of the BOM class to which this value provider is associated to. The Resource file used is the one that corresponds to the given locale (see ResourceBundle locale resolution).

Specified by:
getDocumentation in interface IlrBOMDomainValueProvider
Parameters:
valueName - the name of the value
locale - the Locale for which this documentation is asked
Returns:
the documentation of the given value

getProperties

public Map getProperties(String valueName)
Returns a map of properties associated to the given value name. Properties must be of the form <fqn>.<valueName>.xxx.

Specified by:
getProperties in interface IlrBOMDomainValueProvider
Parameters:
valueName - the name of the value
Returns:
a map of all properties associated to the given value, except label, documentation, BOM to XOM mapping and translation

getTranslation

public String getTranslation(String valueName)
Returns the translation of the given value name. The value of a property named <fqn>.<valueName>.translation is looked-up in the resource file and returned. <fqn> is the fully-qualified name of the BOM class to which this value provider is associated to. Note that BOM to XOM mapping is preferred to provide a translation for the given value.

Specified by:
getTranslation in interface IlrBOMDomainValueProvider
Parameters:
valueName - the name of the value
Returns:
the translation of the given value

getBOM2XOMMapping

public String getBOM2XOMMapping(String valueName)
Returns the BOM to XOM mapping of the given value name. The value of a property named <fqn>.<valueName>.b2x is looked-up in the resource file and returned. <fqn> is the fully-qualified name of the BOM class to which this value provider is associated to.

Specified by:
getBOM2XOMMapping in interface IlrBOMDomainValueProvider
Parameters:
valueName - The name of the value.
Returns:
The BOM to XOM mapping of the given value.

Rule Designer API

© Copyright IBM Corp. 1987, 2013