Survivorship Rule Source Objects Bind

The Survivorship Rule Source Objects bind can be used from business actions referenced from a 'business action survivorship rule' to access the source object for a golden record. The Current Object bind is always the target (surviving) golden record. For the 'merge approach' survivorship rule, this is the only way to access source records.

Match and Merge Considerations

  • The data type of the Survivorship Rule Source Objects bind is java.util.Set<com.stibo.core.domain.Node>.

  • In the execution of survivorship rules, the 'Set of Nodes' always contains exactly one entity.

  • For the Match and Merge Importer, the one entity represents the incoming message.

  • For a Merge Golden Record merge, in the matching event processor and in a clerical review merge from Web UI, the one entity represents the non-surviving golden record.

  • For clerical review tasks that are comprised of more than two golden records, each of the non-surviving golden records are merged into the surviving golden record sequentially. This results in exactly one entity in the Survivorship Rule Source Objects bind of type 'Set<Node>'.

The bind can be found within the 'Binds to' dropdown, as shown below.

Configuration

To use any bind:

  1. Create a business rule as defined in the Creating a Business Rule, Function, or Library topic.

  2. Edit the business rule as defined in the Editing a Business Rule or Function topic.

  3. In the Edit Operation dialog, add the bind to a business rule, as defined in the Adding a Bind topic in the Resource Materials online help documentation.

  4. In the Edit Operation dialog, optionally add Messages, as defined in the Localized Messages for JavaScript Business Rules topic.

  5. In the Edit Operation dialog, add JavaScript to call the bind.

Example

The following is an example JavaScript that uses this bind.

Important: Example scripts should not be used as-is without thorough testing, including updating the script to match object and link types that exist on your system. JavaScript variable names are case-sensitive.

The 'Survivorship Rule Source Objects bind is an instance of type Set<Rankscorable> created by Collections.unmodifiableSet.

In Match and Merge, the collection always holds only one object and so it is safe to access like:

var src = <bind variable>.iterator().next();

In Match and Link, the access must be done by iterator like in the example below.

Copy
var attr = golden.getManager().getAttributeHome().getAttributeByID('YOUR_OWN_ATTRIBUTE_ID_HERE');
var goldenValue = golden.getValue(attr.getID()).getSimpleValue();
var hasGoldenValue = (goldenValue != null);
for (var it = srcObjs.iterator(); it.hasNext();) {
    var src = it.next();
    var value = src.getValue(attr.getID());
    var srcValue = value.getSimpleValue();
    var hasSrcValue = (srcValue != null);
    if (hasSrcValue) {
        if (!hasGoldenValue || java.lang.Integer.parseInt(goldenValue) < java.lang.Integer.parseInt(srcValue)) {
            golden.setSimpleValue(attr, srcValue);
            goldenValue = srcValue;
        }
    }
}