Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
titleA trivial implementation of Predicate<Attribute>
<ConditionScript>
    <Script>
    <![CDATA[
        "use strict";
        false;
    ]]>
    </Script>
</ A trivial implementation of Predicate<Attribute>ConditionScript>

A more complex example might use the custom object to help the operation.

Code Block
<Script>
    <![CDATA[
        "use strict";
        var someCondition = function(attributeValueCount) {
            // appliedGood stuff
to the input argument     }
   //      
   // The input argument is ofvar type:result;
        // org.opensaml.saml.saml2.core.Attribute
        // CustomObjectRef points to a <util:map> where the key is a string and the value is an 'interesting bean'
        if (function (attributesomeCondition(input.getValues.size()) { return false; }(input))
            result = custom["myAttributePredicate"].someFunction(input);
        } else {
            result = custom["myOtherAttributePredicate"].someOtherFunction(input);
        }
        result;
    ]]>
    </Script>
</ConditionScript>

...


<Script>
    <![CDATA[
        "use strict";
        var someCondition = function(entityID) {
            // Good stuff
        }
         
        var result;
        // CustomObjectRef points to a <util:map> where the key is a string and the value is an 'interesting bean'
        if (someCondition(input.getEntityID())) {
            result = custom["myFirstBean"].someFunction(input);
        } else {
            result = custom["mySecondBean"].someOtherFunction(input);
        }
        result;
    ]]>
    </Script>

<Script>
    <![CDATA[
        "use strict";
        var someCondition = function(entityID) {
            // Good stuff
        }
         
        var result;
        // CustomObjectRef points to a <util:map> where the key is a string and the value is an 'interesting bean'
        if (someCondition(input.getEntityID())) {
            result = custom["myFirstBean"].someFunction(input);
        } else {
            result = custom["mySecondBean"].someOtherFunction(input);
        }
        result;
    ]]>
    </Script>