3 Replies Latest reply on Jun 17, 2008 12:44 PM by Jorge Morales

    should activities get a chance to review the node configurat

    Tom Baeyens Master

      e.g. a sequence might require the isPreviousNeeded property of the node set to true.

      e.g. a sub process activity might require the isLocalScope property to be set to true

      Maybe activities should be able to supply the default node configurations or review the configurations that were made by the ProcessFactory or the process XML.

      would it be worth another method in the interface ?

      i would guess it's not worth. basically this is forcing all the implementors to go through a lot of trouble to implement the method and learn about it, while all it can do is prevent some errors. the process languages will be tested anyways for proper operation.

      what do others think ?

        • 1. Re: should activities get a chance to review the node config
          Joram Barrez Master

          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 ;-)

          • 3. Re: should activities get a chance to review the node config
            Jorge Morales Master

            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.