1 Reply Latest reply on Apr 28, 2010 11:19 AM by tonylopes

    Are Seam jBPM's annotations of @StartTask and @BeginTask duplicated?

    alartin

      Hi all,
      I am confused about the two annotaitons of @StartTask and @BeginTask. It seems that they do the same job. I check the BusinessProcessInterceptor which process these two annotations and found:



       if ( method.isAnnotationPresent(StartTask.class) ) 
            {
               log.trace( "encountered @StartTask" );
               StartTask tag = method.getAnnotation(StartTask.class);
               Long taskId = getProcessOrTaskId( tag.taskIdParameter(), tag.taskId() );
               return BusinessProcess.instance().resumeTask(taskId);
            }
            else if ( method.isAnnotationPresent(BeginTask.class) ) 
            {
               log.trace( "encountered @BeginTask" );
               BeginTask tag = method.getAnnotation(BeginTask.class);
               Long taskId = getProcessOrTaskId( tag.taskIdParameter(), tag.taskId() );
               return BusinessProcess.instance().resumeTask(taskId);
            }


      At the backend, they all resume a task. So, why we need two annotations here? Are they actually same? Thanks.

        • 1. Re: Are Seam jBPM's annotations of @StartTask and @BeginTask duplicated?

          Not really the same. The StartTask annotation do this on the afterInvocation part:


           if ( method.isAnnotationPresent(StartTask.class) ){
                      log.trace( "encountered @StartTask" );
                      BusinessProcess.instance().startTask();
          }



          The difference is that with this the StartTask this will set the start time, assign the actor current actor and fire any task-start events defined.