test_class.declarator: activitiHelper
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private ActivitiHelper activitiHelper;
test_class.type: ActivitiHelper
test_class.var_name: activitiHelper
test_class.declarator: activitiRuntimeHelper
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private ActivitiRuntimeHelper activitiRuntimeHelper;
test_class.type: ActivitiRuntimeHelper
test_class.var_name: activitiRuntimeHelper
test_class.declarator: activitiService
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private ActivitiService activitiService;
test_class.type: ActivitiService
test_class.var_name: activitiService
test_class.declarator: baseJavaDelegate
test_class.modifier: @Autowired
      @InjectMocks
      private
test_class.original_string: @Autowired
      @InjectMocks
      private MockJavaDelegate baseJavaDelegate;
test_class.type: MockJavaDelegate
test_class.var_name: baseJavaDelegate
test_class.declarator: configurationDaoHelper
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private ConfigurationDaoHelper configurationDaoHelper;
test_class.type: ConfigurationDaoHelper
test_class.var_name: configurationDaoHelper
test_class.declarator: delegateExecution
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private DelegateExecution delegateExecution;
test_class.type: DelegateExecution
test_class.var_name: delegateExecution
test_class.declarator: jobDefinitionDaoHelper
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private JobDefinitionDaoHelper jobDefinitionDaoHelper;
test_class.type: JobDefinitionDaoHelper
test_class.var_name: jobDefinitionDaoHelper
test_class.declarator: userNamespaceAuthorizationHelper
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private UserNamespaceAuthorizationHelper userNamespaceAuthorizationHelper;
test_class.type: UserNamespaceAuthorizationHelper
test_class.var_name: userNamespaceAuthorizationHelper
test_class.file: herd-code/herd-service/src/test/java/org/finra/herd/service/activiti/task/BaseJavaDelegateTest.java
test_class.identifier: BaseJavaDelegateTest
test_class.superclass: extends AbstractServiceTest
test_case.body: @Test
      public void testExecute() throws Exception
      {
          // Set up expected values.
          String jobDefinitionNamespace = "jobDefinitionNamespace";
          String jobDefinitionName = "jobDefinitionName";
          String processDefinitionId = "processDefinitionId";
          String processDefinitionKey = String.format("%s.%s", jobDefinitionNamespace, jobDefinitionName);
          String updatedBy = "updatedBy";
          JobDefinitionEntity jobDefinitionEntity = new JobDefinitionEntity();
          jobDefinitionEntity.setUpdatedBy(updatedBy);
  
          // Mock dependency methods.
          when(delegateExecution.getProcessDefinitionId()).thenReturn(processDefinitionId);
          ProcessDefinition processDefinition = mock(ProcessDefinition.class);
          when(processDefinition.getKey()).thenReturn(processDefinitionKey);
          when(activitiService.getProcessDefinitionById(any())).thenReturn(processDefinition);
          when(jobDefinitionDaoHelper.getJobDefinitionEntity(any(), any())).thenReturn(jobDefinitionEntity);
  
          // Execute test method.
          baseJavaDelegate.execute(delegateExecution);
  
          // Verify dependencies were invoked correctly.
          InOrder inOrder = inOrder(configurationDaoHelper, activitiService, jobDefinitionDaoHelper, userNamespaceAuthorizationHelper, activitiRuntimeHelper);
          inOrder.verify(configurationDaoHelper).checkNotAllowedMethod(baseJavaDelegate.getClass().getCanonicalName());
          inOrder.verify(activitiService).getProcessDefinitionById(processDefinitionId);
          inOrder.verify(jobDefinitionDaoHelper).getJobDefinitionEntity(jobDefinitionNamespace, jobDefinitionName);
          inOrder.verify(userNamespaceAuthorizationHelper).buildNamespaceAuthorizations(applicationUserUserIdEq(updatedBy));
          inOrder.verify(activitiRuntimeHelper).setTaskSuccessInWorkflow(delegateExecution);
          inOrder.verifyNoMoreInteractions();
          verifyNoMoreInteractions(configurationDaoHelper, activitiService, jobDefinitionDaoHelper, userNamespaceAuthorizationHelper, activitiRuntimeHelper);
  
          // Assert that security context is cleared at the end of execute.
          assertNull(SecurityContextHolder.getContext().getAuthentication());
      }
test_case.class_method_signature: BaseJavaDelegateTest.testExecute()
test_case.full_signature: @Test public void testExecute()
test_case.identifier: testExecute
test_case.invocations: format setUpdatedBy thenReturn when getProcessDefinitionId mock thenReturn when getKey thenReturn when getProcessDefinitionById any thenReturn when getJobDefinitionEntity any any execute inOrder checkNotAllowedMethod verify getCanonicalName getClass getProcessDefinitionById verify getJobDefinitionEntity verify buildNamespaceAuthorizations verify applicationUserUserIdEq setTaskSuccessInWorkflow verify verifyNoMoreInteractions verifyNoMoreInteractions assertNull getAuthentication getContext
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testExecute()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(BaseJavaDelegate.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(BaseJavaDelegate.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: ACTIVITI_PROCESS_INSTANCE_ID_KEY = "activitiProcessInstanceId"
focal_class.modifier: private static final
focal_class.original_string: private static final String ACTIVITI_PROCESS_INSTANCE_ID_KEY = "activitiProcessInstanceId";
focal_class.type: String
focal_class.var_name: ACTIVITI_PROCESS_INSTANCE_ID_KEY
focal_class.declarator: USER_ID_KEY = "uid"
focal_class.modifier: private static final
focal_class.original_string: private static final String USER_ID_KEY = "uid";
focal_class.type: String
focal_class.var_name: USER_ID_KEY
focal_class.declarator: ACTIVITI_LOG_MESSAGE_PREFIX = "HerdTimingLog timingSource=Activiti"
focal_class.modifier: private static final
focal_class.original_string: private static final String ACTIVITI_LOG_MESSAGE_PREFIX = "HerdTimingLog timingSource=Activiti";
focal_class.type: String
focal_class.var_name: ACTIVITI_LOG_MESSAGE_PREFIX
focal_class.declarator: activitiService
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected ActivitiService activitiService;
focal_class.type: ActivitiService
focal_class.var_name: activitiService
focal_class.declarator: configurationDaoHelper
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected ConfigurationDaoHelper configurationDaoHelper;
focal_class.type: ConfigurationDaoHelper
focal_class.var_name: configurationDaoHelper
focal_class.declarator: daoHelper
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected HerdStringHelper daoHelper;
focal_class.type: HerdStringHelper
focal_class.var_name: daoHelper
focal_class.declarator: herdStringHelper
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected HerdStringHelper herdStringHelper;
focal_class.type: HerdStringHelper
focal_class.var_name: herdStringHelper
focal_class.declarator: jobDefinitionDao
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected JobDefinitionDao jobDefinitionDao;
focal_class.type: JobDefinitionDao
focal_class.var_name: jobDefinitionDao
focal_class.declarator: jobDefinitionDaoHelper
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected JobDefinitionDaoHelper jobDefinitionDaoHelper;
focal_class.type: JobDefinitionDaoHelper
focal_class.var_name: jobDefinitionDaoHelper
focal_class.declarator: jobDefinitionHelper
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected JobDefinitionHelper jobDefinitionHelper;
focal_class.type: JobDefinitionHelper
focal_class.var_name: jobDefinitionHelper
focal_class.declarator: jsonHelper
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected JsonHelper jsonHelper;
focal_class.type: JsonHelper
focal_class.var_name: jsonHelper
focal_class.declarator: userNamespaceAuthorizationHelper
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected UserNamespaceAuthorizationHelper userNamespaceAuthorizationHelper;
focal_class.type: UserNamespaceAuthorizationHelper
focal_class.var_name: userNamespaceAuthorizationHelper
focal_class.declarator: xmlHelper
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected XmlHelper xmlHelper;
focal_class.type: XmlHelper
focal_class.var_name: xmlHelper
focal_class.declarator: VARIABLE_JSON_RESPONSE = "jsonResponse"
focal_class.modifier: public static final
focal_class.original_string: public static final String VARIABLE_JSON_RESPONSE = "jsonResponse";
focal_class.type: String
focal_class.var_name: VARIABLE_JSON_RESPONSE
focal_class.declarator: springInitialized
focal_class.modifier: private
focal_class.original_string: private boolean springInitialized;
focal_class.type: boolean
focal_class.var_name: springInitialized
focal_class.declarator: activitiHelper
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected ActivitiHelper activitiHelper;
focal_class.type: ActivitiHelper
focal_class.var_name: activitiHelper
focal_class.declarator: activitiRuntimeHelper
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected ActivitiRuntimeHelper activitiRuntimeHelper;
focal_class.type: ActivitiRuntimeHelper
focal_class.var_name: activitiRuntimeHelper
focal_class.declarator: errorInformationExceptionHandler
focal_class.modifier: @Autowired
      @Qualifier("herdErrorInformationExceptionHandler") // This is to ensure we get the base class bean rather than any classes that extend it.
      private
focal_class.original_string: @Autowired
      @Qualifier("herdErrorInformationExceptionHandler") // This is to ensure we get the base class bean rather than any classes that extend it.
      private HerdErrorInformationExceptionHandler errorInformationExceptionHandler;
focal_class.type: HerdErrorInformationExceptionHandler
focal_class.var_name: errorInformationExceptionHandler
focal_class.file: herd-code/herd-service/src/main/java/org/finra/herd/service/activiti/task/BaseJavaDelegate.java
focal_class.identifier: BaseJavaDelegate
focal_class.interfaces: implements JavaDelegate
focal_class.class_method_signature: BaseJavaDelegate.executeImpl(DelegateExecution execution)
focal_class.full_signature: public abstract void executeImpl(DelegateExecution execution)
focal_class.identifier: executeImpl
focal_class.modifiers: public abstract
focal_class.parameters: (DelegateExecution execution)
focal_class.return: void
focal_class.signature: void executeImpl(DelegateExecution execution)
focal_class.class_method_signature: BaseJavaDelegate.execute(DelegateExecution execution)
focal_class.full_signature: @Override public final void execute(DelegateExecution execution)
focal_class.identifier: execute
focal_class.modifiers: @Override public final
focal_class.parameters: (DelegateExecution execution)
focal_class.return: void
focal_class.signature: void execute(DelegateExecution execution)
focal_class.class_method_signature: BaseJavaDelegate.logTaskExecutionTime(long taskBeginTimeMillis, boolean taskSuccessFlag)
focal_class.full_signature: protected void logTaskExecutionTime(long taskBeginTimeMillis, boolean taskSuccessFlag)
focal_class.identifier: logTaskExecutionTime
focal_class.modifiers: protected
focal_class.parameters: (long taskBeginTimeMillis, boolean taskSuccessFlag)
focal_class.return: void
focal_class.signature: void logTaskExecutionTime(long taskBeginTimeMillis, boolean taskSuccessFlag)
focal_class.class_method_signature: BaseJavaDelegate.setSecurityContext(ApplicationUser applicationUser)
focal_class.full_signature: protected void setSecurityContext(ApplicationUser applicationUser)
focal_class.identifier: setSecurityContext
focal_class.modifiers: protected
focal_class.parameters: (ApplicationUser applicationUser)
focal_class.return: void
focal_class.signature: void setSecurityContext(ApplicationUser applicationUser)
focal_class.class_method_signature: BaseJavaDelegate.getApplicationUser(DelegateExecution execution)
focal_class.full_signature: protected ApplicationUser getApplicationUser(DelegateExecution execution)
focal_class.identifier: getApplicationUser
focal_class.modifiers: protected
focal_class.parameters: (DelegateExecution execution)
focal_class.return: ApplicationUser
focal_class.signature: ApplicationUser getApplicationUser(DelegateExecution execution)
focal_class.class_method_signature: BaseJavaDelegate.handleException(DelegateExecution execution, Exception exception)
focal_class.full_signature: protected void handleException(DelegateExecution execution, Exception exception)
focal_class.identifier: handleException
focal_class.modifiers: protected
focal_class.parameters: (DelegateExecution execution, Exception exception)
focal_class.return: void
focal_class.signature: void handleException(DelegateExecution execution, Exception exception)
focal_class.class_method_signature: BaseJavaDelegate.setJsonResponseAsWorkflowVariable(Object responseObject, DelegateExecution execution)
focal_class.full_signature: public void setJsonResponseAsWorkflowVariable(Object responseObject, DelegateExecution execution)
focal_class.identifier: setJsonResponseAsWorkflowVariable
focal_class.modifiers: public
focal_class.parameters: (Object responseObject, DelegateExecution execution)
focal_class.return: void
focal_class.signature: void setJsonResponseAsWorkflowVariable(Object responseObject, DelegateExecution execution)
focal_class.class_method_signature: BaseJavaDelegate.setJsonResponseAsWorkflowVariable(Object responseObject, String executionId, String activitiId)
focal_class.full_signature: public void setJsonResponseAsWorkflowVariable(Object responseObject, String executionId, String activitiId)
focal_class.identifier: setJsonResponseAsWorkflowVariable
focal_class.modifiers: public
focal_class.parameters: (Object responseObject, String executionId, String activitiId)
focal_class.return: void
focal_class.signature: void setJsonResponseAsWorkflowVariable(Object responseObject, String executionId, String activitiId)
focal_class.class_method_signature: BaseJavaDelegate.isSpringInitialized()
focal_class.full_signature: public boolean isSpringInitialized()
focal_class.identifier: isSpringInitialized
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isSpringInitialized()
focal_class.class_method_signature: BaseJavaDelegate.setSpringInitialized(boolean springInitialized)
focal_class.full_signature: public void setSpringInitialized(boolean springInitialized)
focal_class.identifier: setSpringInitialized
focal_class.modifiers: public
focal_class.parameters: (boolean springInitialized)
focal_class.return: void
focal_class.signature: void setSpringInitialized(boolean springInitialized)
focal_class.class_method_signature: BaseJavaDelegate.setTaskWorkflowVariable(DelegateExecution execution, String variableName, Object variableValue)
focal_class.full_signature: protected void setTaskWorkflowVariable(DelegateExecution execution, String variableName, Object variableValue)
focal_class.identifier: setTaskWorkflowVariable
focal_class.modifiers: protected
focal_class.parameters: (DelegateExecution execution, String variableName, Object variableValue)
focal_class.return: void
focal_class.signature: void setTaskWorkflowVariable(DelegateExecution execution, String variableName, Object variableValue)
focal_class.class_method_signature: BaseJavaDelegate.setTaskWorkflowVariable(String executionId, String activitiId, String variableName, Object variableValue)
focal_class.full_signature: protected void setTaskWorkflowVariable(String executionId, String activitiId, String variableName, Object variableValue)
focal_class.identifier: setTaskWorkflowVariable
focal_class.modifiers: protected
focal_class.parameters: (String executionId, String activitiId, String variableName, Object variableValue)
focal_class.return: void
focal_class.signature: void setTaskWorkflowVariable(String executionId, String activitiId, String variableName, Object variableValue)
focal_class.class_method_signature: BaseJavaDelegate.getRequestObject(String contentType, String requestString, Class xsdClass)
focal_class.full_signature: @SuppressWarnings({"unchecked", "rawtypes"}) protected T getRequestObject(String contentType, String requestString, Class xsdClass)
focal_class.identifier: getRequestObject
focal_class.modifiers: @SuppressWarnings({"unchecked", "rawtypes"}) protected
focal_class.parameters: (String contentType, String requestString, Class xsdClass)
focal_class.return: T
focal_class.signature: T getRequestObject(String contentType, String requestString, Class xsdClass)
focal_class.class_method_signature: BaseJavaDelegate.logInputParameters(DelegateExecution execution)
focal_class.full_signature: protected void logInputParameters(DelegateExecution execution)
focal_class.identifier: logInputParameters
focal_class.modifiers: protected
focal_class.parameters: (DelegateExecution execution)
focal_class.return: void
focal_class.signature: void logInputParameters(DelegateExecution execution)
focal_method.body: @Override
      public final void execute(DelegateExecution execution) throws Exception
      {
          long taskBeginTimeMillis = 0;
          boolean taskSuccessFlag = false;
          try
          {
              // Set the task begin time
              taskBeginTimeMillis = System.currentTimeMillis();
              
              // Need to clear the security context here since the current thread may have been reused,
              // which may might have left over its security context. If we do not clear the security
              // context, any subsequent calls may be restricted by the permissions given
              // to the previous thread's security context.
              SecurityContextHolder.clearContext();
  
              // Check if method is not allowed.
              configurationDaoHelper.checkNotAllowedMethod(this.getClass().getCanonicalName());
  
              // Set the security context per last updater of the current process instance's job definition.
              ApplicationUser applicationUser = getApplicationUser(execution);
              setSecurityContext(applicationUser);
  
              // Set the MDC property for the Activiti process instance ID and user ID.
              MDC.put(ACTIVITI_PROCESS_INSTANCE_ID_KEY, "activitiProcessInstanceId=" + execution.getProcessInstanceId());
              MDC.put(USER_ID_KEY, "userId=" + (applicationUser.getUserId() == null ? "" : applicationUser.getUserId()));
  
              // Log all input variables from the execution (before the execution starts).
              logInputParameters(execution);
  
              // Perform the execution implementation handled in the sub-class.
              executeImpl(execution);
  
              // Set a success status as a workflow variable.
              activitiRuntimeHelper.setTaskSuccessInWorkflow(execution);
  
              // Set the flag to true since there is no exception thrown
              taskSuccessFlag = true;
          }
          catch (Exception ex)
          {
              handleException(execution, ex);
          }
          finally
          {
              // Log the task execution time
              logTaskExecutionTime(taskBeginTimeMillis, taskSuccessFlag);
  
              // Remove the MDC property to ensure they don't accidentally get used by anybody else.
              MDC.remove(ACTIVITI_PROCESS_INSTANCE_ID_KEY);
              MDC.remove(USER_ID_KEY);
  
              // Clear up the security context.
              SecurityContextHolder.clearContext();
          }
      }
focal_method.class_method_signature: BaseJavaDelegate.execute(DelegateExecution execution)
focal_method.full_signature: @Override public final void execute(DelegateExecution execution)
focal_method.identifier: execute
focal_method.invocations: currentTimeMillis clearContext checkNotAllowedMethod getCanonicalName getClass getApplicationUser setSecurityContext put getProcessInstanceId put getUserId getUserId logInputParameters executeImpl setTaskSuccessInWorkflow handleException logTaskExecutionTime remove remove clearContext
focal_method.modifiers: @Override public final
focal_method.parameters: (DelegateExecution execution)
focal_method.return: void
focal_method.signature: void execute(DelegateExecution execution)