This content has been marked as final.
Show 3 replies
-
1. Re: should activities get a chance to review the node config
jbarrez Jun 11, 2008 2:01 PM (in response to tom.baeyens)I don't really see how this feature could ehance the implementation of business logic.
Unless you you have a very good use case, I'm not convinced ;-) -
2. Re: should activities get a chance to review the node config
kukeltje Jun 11, 2008 7:56 PM (in response to tom.baeyens)me neither
-
3. Re: should activities get a chance to review the node config
jorgemoralespou_2 Jun 17, 2008 12:44 PM (in response to tom.baeyens)Sorry for stepping into this one, but we do this using parameters, and evaluating them in the execution, if needed. Example:
public class FindLdapSubscription implements Activity { public FindLdapSubscription(String capabilityId) { this.ldapCapabilityId = capabilityId; } public void execute(Execution execution) throws Exception { if (!validateParams(execution)) throw new Exception("Ldap parameters to Activity not valid"); // Connect to Ldap etc... } protected boolean validateActivity(Execution execution){ // If filterVariable is Set, evaluate it through ScriptEvaluator // and leave result value in filter .... } protected String ldapCapabilityId; protected int numResults = -1; protected int timeout = 1000; protected int scope = Scopes.OBJECT.ordinal(); protected Object dn = null; protected enum Scopes { OBJECT, ONE_LEVEL, SUBTREE } public String getLdapCapabilityId() { return ldapCapabilityId; } public FindLdapSubscription setLdapCapabilityId(String ldapCapabilityId) { this.ldapCapabilityId = ldapCapabilityId; return this; } protected String filter; protected String filterVariable; public String getFilter() { return filter; } public FindLdapSubscription setFilter(String filter) { this.filter = filter; return this; } public String getFilterVariable() { return filterVariable; } public FindLdapSubscription setFilterVariable(String filter) { this.filterVariable = filter; return this; } public int getNumResults() { return numResults; } public FindLdapSubscription setNumResults(int numResults) { this.numResults = numResults; return this; } public int getTimeout() { return timeout; } public FindLdapSubscription setTimeout(int timeout) { this.timeout = timeout; return this; } public int getScope() { return scope; } public FindLdapSubscription setScope(Scopes scope) { this.scope = scope.ordinal(); return this; } public Object getDn() { return dn; } public FindLdapSubscription setDn(Object dn) { this.dn = dn; return this; }; protected String targetVariableName; public FindLdapSubscription setTargetVariable(String targetVarName) { this.targetVariableName = targetVarName; return this; } protected List<String> attributes = new ArrayList<String>(); public List<String> getAttributes() { return attributes; } public FindLdapSubscription setAttributes(List<String> attributes) { this.attributes = attributes; return this; } public FindLdapSubscription addAttribute(String attribute) { this.attributes.add(attribute); return this; } }
This way, if we configure, for example setFilterVariable, we resolve it through JUEL. If we set, instead, setFilter, we use value set here. Any other case, we fail.
This can be done for setting isLocalScope in an Activity, if it is set a value in a script context, which can be used.
I hope I made myself clear, and that this has something to do with what you were talking.