Each Supplement object may contain three types of data: records, navigation references, and properties.
Records—Each dynamic business rule’s Supplement object has one or more records attached to it. These records are structurally identical to the records found in navigation record results. These code snippets get all records from a Supplement object. See the sample code sections below for more detail.
// Java example: // Get record list from a Supplement ERecList supRecs = sup.getERecs(); // Loop over the ERecList and get each record for (int j=0; j<supRecs.size(); j++) { ERec rec = (ERec)supRecs.get(j); ... } //.NET example: // Get record list from a Supplement ERecList supRecs = sup.ERecs; // Loop over the ERecList and get each record for (int j=0; j<supRecs.Count; j++) { ERec rec = (ERec)supRecs[j]; ... }
Navigation reference—Each Supplement object also contains a single reference to a navigation query. This navigation reference is a collection of dimension values. These dimension values create a navigation query that may be used to direct a user to a new location (usually the full result set that the promoted records were sampled from.) This is useful if you want to create a link from the rule’s title that displays the full result set of promoted records. These code snippets get the navigation reference from a Supplement object. See the sample code sections below for more detail.
// Java example: // Get navigation reference list NavigationRefsList refs = sup.getNavigationRefs(); // Loop over the references for (int j=0; j<refs.size(); j++) { DimValList ref = (DimValList)refs.get(j); // Loop over dimension vals for each nav reference for (int k=0; k<ref.size(); k++) { DimVal val = (DimVal)ref.get(k); ... } } // .NET example: // Get navigation reference list NavigationRefsList refs = sup.NavigationRefs; // Loop over the references for (int j=0; j<refs.Count; j++) { DimValList dimref = (DimValList)refs[j]; // Loop over dimension vals for each nav reference for (int k=0; k<dimref.Count; k++) { DimVal val = (DimVal)dimref[k]; ... } }
Properties—Each Supplement object contains multiple properties, and each property consists of a key/value pair. Properties are rule-specific, and are used to specify the style, zone, title, a redirect URL and so on. These code snippets get all the properties from a Supplement object. See the sample code sections below for more detail.
// Java example: // Get property map from the Supplement PropertyMap propsMap = sup.getProperties(); Iterator props = propsMap.entrySet().iterator(); // Loop over properties while (props.hasNext()) { // Get individual property Property prop = (Property)props.next(); ... } // .NET example: // Get property map from the Supplement PropertyMap propsMap2 = sup.Properties; System.Collections.IList props = propsMap2.EntrySet; // Loop over properties for (int j =0; j < props.Count; j++) { // Get individual property Property prop = (Property)props[j]; ... }