3 Replies Latest reply on Apr 25, 2010 7:55 AM by granite2009

    How to access SEAM session variable from jbpm

    granite2009
      I am working on SEAM 2.2 and jbpm. I run into a problem with the custom email address resolution class loaded by jbpm. Apparently, I can create any class to convert actid to an email address. My need is to convert them by looking my AD list already populated from other session bean. I thought it is easy by using @In. However, since this class is loaded by jbpm, it does not see any SEAM session variable. Under debug, the session variable users is always null. Anybody can help me.


           <string name="resource.mail.properties" value="jbpm.mail.properties" />
           <string name="resource.mail.templates" value="jbpm.mail.templates.xml" />
           <bean name="jbpm.mail.address.resolver" class="com.gcinc.itapproval.session.GetEmail"
                singleton="true" />

      import java.util.ArrayList;
      import java.util.Iterator;

      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Name;
      import org.jbpm.mail.AddressResolver;
      import com.gcinc.itapproval.entity.Ldap;

      @Name("getEmail")
      public class GetEmail implements AddressResolver {

           /**
            *
            */
           private static final long serialVersionUID = 1L;

           @In
           private ArrayList<Ldap> users;

           public Object resolveAddress(String actor) {
                if (actor.trim().length() == 0) {
                     return null;
                }
                Iterator<Ldap> iterator = users.iterator();
                while (iterator.hasNext()) {
                     Ldap elem = ((Ldap) iterator.next());

                     if ((elem.getUserid() != null && elem.getUserid().toLowerCase()
                               .equals(actor.toLowerCase()))) {
                          return elem.getEmail();
                     }
                }

                return null;
           }