# script-finder handler

<span class="notranslate">It is responsible for retrieve business objects from the persistence layer using BSH scripts. The following attributes are supported</span>

<div id="bkmrk-attribute-usage-if-e"><table class="confluenceTable tablesorter tablesorter-default stickyTableHeaders" role="grid" style="height: 98px; width: 689px;"><thead class="tableFloatingHeaderOriginal"><tr class="tablesorter-headerRow" role="row" style="height: 28px;"><th aria-disabled="false" aria-label="Attribute: No sort applied, activate to apply an ascending sort" aria-sort="none" class="confluenceTh tablesorter-header sortableHeader tablesorter-headerUnSorted" data-column="0" role="columnheader" scope="col" style="height: 28px; width: 118px;" tabindex="0"><div><div>**Attribute**</div></div></th><th aria-disabled="false" aria-label="Usage: No sort applied, activate to apply an ascending sort" aria-sort="none" class="confluenceTh tablesorter-header sortableHeader tablesorter-headerUnSorted" data-column="1" role="columnheader" scope="col" style="height: 28px; width: 571px;" tabindex="0"><div><div>**Usage**</div></div></th></tr></thead><tbody aria-live="polite" aria-relevant="all"><tr role="row" style="height: 35px;"><td class="confluenceTd" style="height: 35px; width: 118px;">if

</td><td class="confluenceTd" style="height: 35px; width: 571px;">EL expression that must be evaluated to true prior to handler action

</td></tr><tr role="row" style="height: 35px;"><td class="confluenceTd" style="height: 35px; width: 118px;">unless

</td><td class="confluenceTd" style="height: 35px; width: 571px;"> EL expression that must be evaluated to false prior to handler action</td></tr></tbody></table>

</div><span class="notranslate">The contained bsh script must return a collection of business objects. If the returned object is not a collection object, the engine will treat the returned object as a singleton.</span>

<span class="notranslate">In the following example, the script finder retrives all countries saved to disk in the previous example:</span>

```western
<datanode name="root">
    ...
    <finder name="country" type="country" >
        <script-finder >
            import java.io.*;
            files[] = new File(".").listFiles ( new FilenameFilter () {
                public boolean accept (File dir, String name) {
                    return name.startsWith("coutnry.");
                }
            );
            v = new java.util.Vector();
            for (int i = 0; i < files.length; i++)
            {
                f = new FileInputStream (files[i]);
                ois = new ObjectInputStream (f);
                v.add (ois.readObject ();
                ois.close ();
                f.close();
            }
            return v;
        </script-finder>
    </finder>
    ...
</datanode>
```