Java Code Examples for org.activiti.engine.delegate.DelegateExecution#getProcessInstanceId()

The following examples show how to use org.activiti.engine.delegate.DelegateExecution#getProcessInstanceId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ListenerNotificationHelper.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void planTransactionDependentExecutionListener(ListenerFactory listenerFactory, DelegateExecution execution, TransactionDependentExecutionListener executionListener, ActivitiListener activitiListener) {
  Map<String, Object> executionVariablesToUse = execution.getVariables();
  CustomPropertiesResolver customPropertiesResolver = createCustomPropertiesResolver(activitiListener);
  Map<String, Object> customPropertiesMapToUse = invokeCustomPropertiesResolver(execution, customPropertiesResolver);

  TransactionDependentExecutionListenerExecutionScope scope = new TransactionDependentExecutionListenerExecutionScope(
      execution.getProcessInstanceId(), execution.getId(), execution.getCurrentFlowElement(), executionVariablesToUse, customPropertiesMapToUse);
  
  addTransactionListener(activitiListener, new ExecuteExecutionListenerTransactionListener(executionListener, scope));
}
 
Example 2
Source File: ListenerNotificationHelper.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
protected void planTransactionDependentTaskListener(DelegateExecution execution, TransactionDependentTaskListener taskListener, ActivitiListener activitiListener) {
  Map<String, Object> executionVariablesToUse = execution.getVariables();
  CustomPropertiesResolver customPropertiesResolver = createCustomPropertiesResolver(activitiListener);
  Map<String, Object> customPropertiesMapToUse = invokeCustomPropertiesResolver(execution, customPropertiesResolver);
  
  TransactionDependentTaskListenerExecutionScope scope = new TransactionDependentTaskListenerExecutionScope(
      execution.getProcessInstanceId(), execution.getId(), (Task) execution.getCurrentFlowElement(), executionVariablesToUse, customPropertiesMapToUse);
  addTransactionListener(activitiListener, new ExecuteTaskListenerTransactionListener(taskListener, scope));
}
 
Example 3
Source File: TestService.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Override
public void execute(DelegateExecution execution) {
  TestService.processDefinitionId = execution.getProcessDefinitionId();
  TestService.processInstanceId = execution.getProcessInstanceId();
  TestService.executionId = execution.getId();
  TestService.businessKey = execution.getProcessInstanceBusinessKey();

  throw new RuntimeException("test");

}
 
Example 4
Source File: TestService.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Override
public void execute(DelegateExecution execution) {
	TestService.processDefinitionId = execution.getProcessDefinitionId();
	TestService.processInstanceId =  execution.getProcessInstanceId();
	TestService.executionId = execution.getId();
	TestService.businessKey = execution.getProcessInstanceBusinessKey();
	
	throw new RuntimeException("test");
}
 
Example 5
Source File: ResetPasswordServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void sendResetPasswordEmail(DelegateExecution execution, String fallbackEmailTemplatePath, String emailSubject)
{
    Map<String, Object> variables = execution.getVariables();
    final String userName = (String) variables.get(WorkflowModelResetPassword.WF_PROP_USERNAME_ACTIVITI);
    final String toEmail = (String) variables.get(WorkflowModelResetPassword.WF_PROP_USER_EMAIL_ACTIVITI);
    final String clientName = (String) variables.get(WorkflowModelResetPassword.WF_PROP_CLIENT_NAME_ACTIVITI);
    final String key = (String) variables.get(WorkflowModelResetPassword.WF_PROP_KEY_ACTIVITI);
    final String id = execution.getProcessInstanceId();

    final ClientApp clientApp = getClientAppConfig(clientName);
    Map<String, Serializable> emailTemplateModel = Collections.singletonMap(FTL_RESET_PASSWORD_URL,
                createResetPasswordUrl(clientApp, id, key));

    final String templatePath = emailHelper.getEmailTemplate(clientName,
                getResetPasswordEmailTemplate(clientApp),
                fallbackEmailTemplatePath);

    ResetPasswordEmailDetails emailRequest = new ResetPasswordEmailDetails()
                .setUserName(userName)
                .setUserEmail(toEmail)
                .setTemplatePath(templatePath)
                .setTemplateAssetsUrl(clientApp.getTemplateAssetsUrl())
                .setEmailSubject(emailSubject)
                .setTemplateModel(emailTemplateModel);

    sendEmail(emailRequest);
}
 
Example 6
Source File: RejectNominatedInviteDelegate.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void execute(DelegateExecution execution) throws Exception
{
    // Get the invitee user name
    String invitee = (String) execution.getVariable(WorkflowModelNominatedInvitation.wfVarInviteeUserName);
    String invitationId = ActivitiConstants.ENGINE_ID + "$" + execution.getProcessInstanceId();
    invitationService.deleteAuthenticationIfUnused(invitee, invitationId);
}
 
Example 7
Source File: SendModeratedInviteDelegate.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void execute(DelegateExecution execution) throws Exception
{
    String invitationId = ActivitiConstants.ENGINE_ID + "$" + execution.getProcessInstanceId();
    Map<String, Object> variables = execution.getVariables();
    invitationService.sendModeratedInvitation(invitationId, emailTemplatePath, EMAIL_SUBJECT_KEY, variables);
}
 
Example 8
Source File: SendNominatedInviteDelegate.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void execute(DelegateExecution execution) throws Exception
{
    String invitationId = ActivitiConstants.ENGINE_ID + "$" + execution.getProcessInstanceId();
    Map<String, Object> variables = execution.getVariables();
    invitationService.sendNominatedInvitation(invitationId, EMAIL_TEMPLATE_XPATH, EMAIL_SUBJECT_KEY, variables);
}
 
Example 9
Source File: SendNominatedInviteAddDirectDelegate.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void execute(DelegateExecution execution) throws Exception
{
    String invitationId = ActivitiConstants.ENGINE_ID + "$" + execution.getProcessInstanceId();
    Map<String, Object> variables = execution.getVariables();
    invitationService.sendNominatedInvitation(invitationId, EMAIL_TEMPLATE_XPATH, EMAIL_SUBJECT_KEY, variables);
}
 
Example 10
Source File: CancelNominatedInviteDelegate.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void execute(DelegateExecution execution) throws Exception
{
    Map<String, Object> executionVariables = execution.getVariables();
    String currentInviteId = ActivitiConstants.ENGINE_ID + "$" + execution.getProcessInstanceId();

    // Get the invitee user name and site short name variables off the execution context
    String invitee = (String) executionVariables.get(wfVarInviteeUserName);
    String siteName = (String) executionVariables.get(wfVarResourceName);
    String inviteId = (String) executionVariables.get(wfVarWorkflowInstanceId);

    invitationService.cancelInvitation(siteName, invitee, inviteId, currentInviteId);
}
 
Example 11
Source File: CMSClient.java    From oneops with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the dpmt process id.
 *
 * @param exec the exec
 * @param dpmt the dpmt
 */
public void setDpmtProcessId(DelegateExecution exec, CmsDeployment dpmt) {

    String processId = exec.getProcessInstanceId();
    String execId = exec.getId();
    // lets create strip down dpmt to update just a processId and updatedBy
    updateDeploymentAndNotify(dpmt, processId + "!" + execId, "Activiti");
}
 
Example 12
Source File: LeaveProcessEndListener.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateExecution execution) throws Exception {
    String processInstanceId = execution.getProcessInstanceId();

    String sql = "delete from act_hi_detail where proc_inst_id_ = ? and type_ = ?";
    int i = entityManager.createNativeQuery(sql)
            .setParameter(1, processInstanceId)
            .setParameter(2, "FormProperty")
            .executeUpdate();
    logger.debug("清理了 {} 条历史表单数据", i);
}
 
Example 13
Source File: LeaveProcessEndListener.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateExecution execution) throws Exception {
    String processInstanceId = execution.getProcessInstanceId();

    String sql = "delete from act_hi_detail where proc_inst_id_ = ? and type_ = ?";
    int i = entityManager.createNativeQuery(sql)
            .setParameter(1, processInstanceId)
            .setParameter(2, "FormProperty")
            .executeUpdate();
    logger.debug("清理了 {} 条历史表单数据", i);
}
 
Example 14
Source File: LeaveProcessEndListener.java    From activiti-in-action-codes with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(DelegateExecution execution) throws Exception {
    String processInstanceId = execution.getProcessInstanceId();

    String sql = "delete from act_hi_detail where proc_inst_id_ = ? and type_ = ?";
    int i = entityManager.createNativeQuery(sql)
            .setParameter(1, processInstanceId)
            .setParameter(2, "FormProperty")
            .executeUpdate();
    logger.debug("清理了 {} 条历史表单数据", i);
}
 
Example 15
Source File: CdiExecutionListener.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
protected BusinessProcessEvent createEvent(DelegateExecution execution) {
  ProcessDefinition processDefinition = ProcessDefinitionUtil.getProcessDefinition(execution.getProcessDefinitionId());
  Date now = Context.getProcessEngineConfiguration().getClock().getCurrentTime();
  return new CdiBusinessProcessEvent(activityId, transitionName, processDefinition, execution, type, execution.getProcessInstanceId(), execution.getId(), now);
}
 
Example 16
Source File: InductorPublisher.java    From oneops with Apache License 2.0 3 votes vote down vote up
/**
 * Publish message.
 *
 * @param exec         the exec
 * @param waitTaskName the wait task name
 * @param woType       the wo type
 * @throws JMSException the jMS exception
 */
public void publishMessage(DelegateExecution exec, String waitTaskName, String woType) throws JMSException {
    String processId = exec.getProcessInstanceId();
    String execId = exec.getId();

    CmsWorkOrderSimpleBase wo = (CmsWorkOrderSimpleBase) exec.getVariable("wo");
    publishMessage(processId, execId, wo, waitTaskName, woType);
}