|
This page lists agent-filter scripts that are directly defined by the scripting site. These scripts were taken straight from the [https://bugs.urbancode.com/secure/IssueNavigator.jspa?reset=true&&pid=10110&sorter/field=issuekey&sorter/order=ASC public JIRA site]. Please note that some scripts may be ''snippets'' and '''probably WILL need''' modification to work properly for your situation. Treat these as templates that you can modify from. |
|
This page lists agent-filter scripts that are directly defined by the scripting site. These scripts were taken straight from the [https://bugs.urbancode.com/secure/IssueNavigator.jspa?reset=true&&pid=10110&sorter/field=issuekey&sorter/order=ASC public JIRA site]. Please note that some scripts may be ''snippets'' and '''probably WILL need''' modification to work properly for your situation. Treat these as templates that you can modify from. |
|
|
+ |
= Agent Filter based on a property that contains the value of an agent property =
|
|
|
+ |
* A general case: <pre>String propValue = PropertyLookup.get("property");
|
|
|
+ |
return Where.is(Variable.equals("property", propValue)); </pre>
|
|
|
+ |
<pre>import com.urbancode.anthill3.domain.agent.Agent;
|
|
|
+ |
import com.urbancode.anthill3.runtime.scripting.helpers.*;
|
|
|
+ |
public class PropertyEqualsAgentVar extends VariableEqualsCriteria {
|
|
|
+ |
public PropertyEqualsAgentVar(String propertyname, String varName) {
|
|
|
+ |
this.propertyname = propertyname;
|
|
|
+ |
public Agent[] filter(Agent[] agents){
|
|
|
+ |
String platform = PropertyLookup.get(propertyname);
|
|
|
+ |
return super.filter(agents);
|
|
|
+ |
// 'my.property.name' is the name of a project or workflow property that contains the value
|
|
|
+ |
// of the agent property named 'agent.property.name'
|
|
|
+ |
return Where.is(new PropertyEqualsAgentVar("my.property.name", "agent.property.name")); </pre>
|