0 Replies Latest reply on Sep 6, 2006 8:43 AM by Kurt Edegger

    Issue with instance variable not being injected/created in D

    Kurt Edegger Newbie

      Hi,

      I'm implementing a DecisionHandler for a workflow definition.
      The class should act just as a demonstrator and is really simple.

      @Name("bpm.patientRegisterGoalHandler")
      @Interceptors(SeamInterceptor.class)
      public class PatientRegisterGoalHandler implements DecisionHandler{
      
       @In(value="registryData", create=true)
       private RegistryData data;
      
       public PatientRegisterGoalHandler() {
       log.debug("===== PatientenRegisterGoalHandler constructor");
       }
      
       public String decide(ExecutionContext arg0) throws Exception {
       log.debug("===== PatientRegisterGoalHandler decide called");
       log.debug("RegistryData: "+data);
       if (data.getCountPatient()>10) return "true";
       return "false";
       }
      }
      


      Whenever the corresponding workflow instance is created, the decide methode is called, but throws an NullPointerException at the point "data" is being accessed.
      My impression was that seam should instantiate the injected value, if it's null (when invoked with create=true). I added the debug logging and it shows, that the variable data is indeed null [1].

      Two questions:
      1) What could be the reason for seam not instantiating the variable (class RegistryData: the constructor is never called)?
      2) Do I need to have the @Name and @Interceptors annotation for injection to work?

      Thank you in advance,

      Kurt

      [1]: the relevant part of the console output
      14:32:04,808 DEBUG [org.hibernate.loader.hql.QueryLoader] bindNamedParameters() registerPatients -> name [1]
      14:32:04,871 DEBUG [at.arcsmed.jbpm.PatientRegisterGoalHandler] ===== PatientenRegisterGoalHandler constructor
      14:32:04,871 DEBUG [at.arcsmed.jbpm.PatientRegisterGoalHandler] ===== PatientRegisterGoalHandler decide called
      14:32:04,871 DEBUG [at.arcsmed.jbpm.PatientRegisterGoalHandler] RegistryData: null