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

The following examples show how to use org.activiti.engine.delegate.DelegateExecution#setVariableLocal() . 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: WoDispatcher.java    From oneops with Apache License 2.0 5 votes vote down vote up
private void setOrCreateLocalVar(DelegateExecution exec, String name, Object value) {
	if (exec.getVariableNamesLocal().contains(name)) {
		exec.setVariableLocal(name, value);
	} else {
		exec.createVariableLocal(name, value);
	}
}
 
Example 2
Source File: SetMailInfo.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 {
    IdentityService identityService = execution.getEngineServices().getIdentityService();
    String applyUserId = (String) execution.getVariable("applyUserId");
    User user = identityService.createUserQuery().userId(applyUserId).singleResult();
    execution.setVariableLocal("to", user.getEmail());
    execution.setVariableLocal("name", user.getFirstName() + " " + user.getLastName());

    // 超时提醒时间设置,请假结束时间+1天
    Date endDate = (Date) execution.getVariable("endDate");
    Calendar ca = Calendar.getInstance();
    ca.setTime(endDate);
    ca.add(Calendar.DAY_OF_MONTH, 1);
    execution.setVariableLocal("reportBackTimeout", ca.getTime());
}
 
Example 3
Source File: SetMailInfo.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 {
    IdentityService identityService = execution.getEngineServices().getIdentityService();
    String applyUserId = (String) execution.getVariable("applyUserId");
    User user = identityService.createUserQuery().userId(applyUserId).singleResult();
    execution.setVariableLocal("to", user.getEmail());
    execution.setVariableLocal("name", user.getFirstName() + " " + user.getLastName());

    // 超时提醒时间设置,请假结束时间+1天
    Date endDate = (Date) execution.getVariable("endDate");
    Calendar ca = Calendar.getInstance();
    ca.setTime(endDate);
    ca.add(Calendar.DAY_OF_MONTH, 1);
    execution.setVariableLocal("reportBackTimeout", ca.getTime());
}
 
Example 4
Source File: SetMailInfo.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 {
    IdentityService identityService = execution.getEngineServices().getIdentityService();
    String applyUserId = (String) execution.getVariable("applyUserId");
    User user = identityService.createUserQuery().userId(applyUserId).singleResult();
    execution.setVariableLocal("to", user.getEmail());
    execution.setVariableLocal("name", user.getFirstName() + " " + user.getLastName());

    // 超时提醒时间设置,请假结束时间+1天
    Date endDate = (Date) execution.getVariable("endDate");
    Calendar ca = Calendar.getInstance();
    ca.setTime(endDate);
    ca.add(Calendar.DAY_OF_MONTH, 1);
    execution.setVariableLocal("reportBackTimeout", ca.getTime());
}
 
Example 5
Source File: SetMailInfo.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 {
    IdentityService identityService = execution.getEngineServices().getIdentityService();
    String applyUserId = (String) execution.getVariable("applyUserId");
    User user = identityService.createUserQuery().userId(applyUserId).singleResult();
    execution.setVariableLocal("to", user.getEmail());
    execution.setVariableLocal("name", user.getFirstName() + " " + user.getLastName());

    // 超时提醒时间设置,请假结束时间+1天
    Date endDate = (Date) execution.getVariable("endDate");
    Calendar ca = Calendar.getInstance();
    ca.setTime(endDate);
    ca.add(Calendar.DAY_OF_MONTH, 1);
    execution.setVariableLocal("reportBackTimeout", ca.getTime());
}
 
Example 6
Source File: SetMailInfo.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 {
    IdentityService identityService = execution.getEngineServices().getIdentityService();
    String applyUserId = (String) execution.getVariable("applyUserId");
    User user = identityService.createUserQuery().userId(applyUserId).singleResult();
    execution.setVariableLocal("to", user.getEmail());
    execution.setVariableLocal("name", user.getFirstName() + " " + user.getLastName());

    // 超时提醒时间设置,请假结束时间+1天
    Date endDate = (Date) execution.getVariable("endDate");
    Calendar ca = Calendar.getInstance();
    ca.setTime(endDate);
    ca.add(Calendar.DAY_OF_MONTH, 1);
    execution.setVariableLocal("reportBackTimeout", ca.getTime());
}
 
Example 7
Source File: SetMailInfo.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 {
    IdentityService identityService = execution.getEngineServices().getIdentityService();
    String applyUserId = (String) execution.getVariable("applyUserId");
    User user = identityService.createUserQuery().userId(applyUserId).singleResult();
    execution.setVariableLocal("to", user.getEmail());
    execution.setVariableLocal("name", user.getFirstName() + " " + user.getLastName());

    // 超时提醒时间设置,请假结束时间+1天
    Date endDate = (Date) execution.getVariable("endDate");
    Calendar ca = Calendar.getInstance();
    ca.setTime(endDate);
    ca.add(Calendar.DAY_OF_MONTH, 1);
    execution.setVariableLocal("reportBackTimeout", ca.getTime());
}
 
Example 8
Source File: SetMailInfo.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 {
    IdentityService identityService = execution.getEngineServices().getIdentityService();
    String applyUserId = (String) execution.getVariable("applyUserId");
    User user = identityService.createUserQuery().userId(applyUserId).singleResult();
    execution.setVariableLocal("to", user.getEmail());
    execution.setVariableLocal("name", user.getFirstName() + " " + user.getLastName());

    // 超时提醒时间设置,请假结束时间+1天
    Date endDate = (Date) execution.getVariable("endDate");
    Calendar ca = Calendar.getInstance();
    ca.setTime(endDate);
    ca.add(Calendar.DAY_OF_MONTH, 1);
    execution.setVariableLocal("reportBackTimeout", ca.getTime());
}
 
Example 9
Source File: SetMailInfo.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 {
    IdentityService identityService = execution.getEngineServices().getIdentityService();
    String applyUserId = (String) execution.getVariable("applyUserId");
    User user = identityService.createUserQuery().userId(applyUserId).singleResult();
    execution.setVariableLocal("to", user.getEmail());
    execution.setVariableLocal("name", user.getFirstName() + " " + user.getLastName());

    // 超时提醒时间设置,请假结束时间+1天
    Date endDate = (Date) execution.getVariable("endDate");
    Calendar ca = Calendar.getInstance();
    ca.setTime(endDate);
    ca.add(Calendar.DAY_OF_MONTH, 1);
    execution.setVariableLocal("reportBackTimeout", ca.getTime());
}
 
Example 10
Source File: CMSClient.java    From oneops with Apache License 2.0 5 votes vote down vote up
private void setOrCreateLocalVar(DelegateExecution exec, String name, Object value) {
    if (exec.getVariableNamesLocal().contains(name)) {
        exec.setVariableLocal(name, value);
    } else {
        exec.createVariableLocal(name, value);
    }
}
 
Example 11
Source File: VariablesTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void execute(DelegateExecution execution) {
	Map<String, Object> vars = execution.getVariables(Arrays.asList("testVar1", "testVar2", "testVar3"), false);
	
	String testVar1 = (String) vars.get("testVar1");
	String testVar2 = (String) vars.get("testVar2");
	String testVar3 = (String) vars.get("testVar3");
	
	execution.setVariable("testVar1", testVar1 + "-CHANGED", false);
	execution.setVariable("testVar2", testVar2 + "-CHANGED", false);
	execution.setVariable("testVar3", testVar3 + "-CHANGED", false);
	
	execution.setVariableLocal("localVar", "localValue", false);
}
 
Example 12
Source File: VariablesTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void execute(DelegateExecution execution) {
  Map<String, Object> vars = execution.getVariables(Arrays.asList("testVar1", "testVar2", "testVar3"), false);

  String testVar1 = (String) vars.get("testVar1");
  String testVar2 = (String) vars.get("testVar2");
  String testVar3 = (String) vars.get("testVar3");

  execution.setVariable("testVar1", testVar1 + "-CHANGED", false);
  execution.setVariable("testVar2", testVar2 + "-CHANGED", false);
  execution.setVariable("testVar3", testVar3 + "-CHANGED", false);

  execution.setVariableLocal("localVar", "localValue", false);
}
 
Example 13
Source File: MultiInstanceActivityBehavior.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
protected void setLoopVariable(DelegateExecution execution, String variableName, Object value) {
  execution.setVariableLocal(variableName, value);
}
 
Example 14
Source File: SetVariablesDelegate.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void execute(DelegateExecution execution) {
  Object nrOfCompletedInstances = execution.getVariableLocal("nrOfCompletedInstances");    
  variablesMap.put(nrOfCompletedInstances, lastInt);    
  execution.setVariableLocal("variable", lastInt);    
  lastInt++;
}
 
Example 15
Source File: TerminateEndEventTest.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void execute(DelegateExecution execution) {
  serviceTaskInvokedCount++;

  // leave only 3 out of n subprocesses
  execution.setVariableLocal("terminate", serviceTaskInvokedCount > 3);
}
 
Example 16
Source File: SetLocalVariableTask.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void execute(DelegateExecution execution) {
 execution.setVariableLocal("test", "test2");
}
 
Example 17
Source File: VariablesTest.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void execute(DelegateExecution execution) {
	String value = (String) execution.getVariable("testVar2");
	String localVarValue = (String) execution.getVariableLocal("localValue");
	execution.setVariableLocal("testVar2", value + localVarValue);
}
 
Example 18
Source File: TerminateEndEventTest.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void execute(DelegateExecution execution) {
  serviceTaskInvokedCount++;

  // leave only 3 out of n subprocesses
  execution.setVariableLocal("terminate", serviceTaskInvokedCount > 3);
}
 
Example 19
Source File: SetLocalVariableTask.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void execute(DelegateExecution execution) {
  execution.setVariableLocal("test", "test2");
}
 
Example 20
Source File: VariablesTest.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void execute(DelegateExecution execution) {
  String value = (String) execution.getVariable("testVar2");
  String localVarValue = (String) execution.getVariableLocal("localValue");
  execution.setVariableLocal("testVar2", value + localVarValue);
}