当前位置: 首页>>代码示例>>Java>>正文


Java DelegateExecution.setVariable方法代码示例

本文整理汇总了Java中org.camunda.bpm.engine.delegate.DelegateExecution.setVariable方法的典型用法代码示例。如果您正苦于以下问题:Java DelegateExecution.setVariable方法的具体用法?Java DelegateExecution.setVariable怎么用?Java DelegateExecution.setVariable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.camunda.bpm.engine.delegate.DelegateExecution的用法示例。


在下文中一共展示了DelegateExecution.setVariable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public void execute(DelegateExecution ctx) throws Exception {
  CreateChargeRequest request = new CreateChargeRequest();
  request.amount = (int) ctx.getVariable("remainingAmount");

  CreateChargeResponse response = rest.postForObject( //
      stripeChargeUrl, //
      request, //
      CreateChargeResponse.class);   
  
  // TODO Add error scenarios to StripeFake and then raise "Error_CreditCardError" here
  if (response.errorCode!=null) {
    ctx.setVariable("errorCode", response.errorCode);
    throw new BpmnError("Error_PaymentError");
  }

  ctx.setVariable("paymentTransactionId", response.transactionId);
}
 
开发者ID:flowing,项目名称:flowing-retail,代码行数:18,代码来源:ChargeCreditCardAdapter.java

示例2: notify

import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
@Override
public void notify(DelegateExecution execution) throws Exception {
  List<String> risks = new ArrayList<String>();
  Set<String> riskAssessments = new HashSet<String>();
  
  //DmnDecisionOutput vs DmnDecisionResult
  @SuppressWarnings("unchecked")
  List<Map<String, Object>> resultList = (List<Map<String, Object>>) execution.getVariable("riskAssessmentResult");
  for (Map<String, Object> result : resultList) {
    risks.add((String)result.get("risk"));
    if (result.get("riskAssessment")!=null) {
      riskAssessments.add(((String)result.get("riskAssessment")).toLowerCase());
    }
  }

  String riskAssessment = "green";
  if (riskAssessments.contains("red")) {
    riskAssessment = "red";
  } else if (riskAssessments.contains("yellow")) {
    riskAssessment = "yellow";
  }
  execution.setVariable("riskAssessment", riskAssessment);
}
 
开发者ID:camunda,项目名称:camunda-bpm-assert-scenario,代码行数:24,代码来源:MapDmnResult.java

示例3: persistOrder

import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public void persistOrder(DelegateExecution delegateExecution) {
  // Create new order instance
  OrderEntity orderEntity = new OrderEntity();

  // Get all process variables
  Map<String, Object> variables = delegateExecution.getVariables();

  // Set order attributes
  orderEntity.setCustomer((String) variables.get("customer"));
  orderEntity.setAddress((String) variables.get("address"));
  orderEntity.setPizza((String) variables.get("pizza"));

  // Persist order instance and flush. After the flush the
  // id of the order instance is set.
  entityManager.persist(orderEntity);
  entityManager.flush();

  // Remove no longer needed process variables
  delegateExecution.removeVariables(variables.keySet());

  // Add newly created order id as process variable
  delegateExecution.setVariable("orderId", orderEntity.getId());
}
 
开发者ID:derursm,项目名称:bvis,代码行数:24,代码来源:OrderBusinessLogic.java

示例4: execute

import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
@Override
public void execute(DelegateExecution execution) throws Exception {
  BusinessInterface businessInterface = (BusinessInterface) new InitialContext().lookup("java:global/" +
      TestConstants.getAppName() +
      "service/" +
      "RemoteSFSBean!org.camunda.bpm.integrationtest.functional.ejb.remote.bean.BusinessInterface");

  execution.setVariable("result", businessInterface.doBusiness());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:10,代码来源:RemoteSFSBClientDelegateBean.java

示例5: execute

import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public void execute(DelegateExecution execution) throws Exception {
  
  SimpleDateFormat sdf =  new SimpleDateFormat("dd/MM/yyyy hh:mm:ss SSS");
  // We set the time to check of the updated time is picked up in the history
  Date updatedDate = sdf.parse("01/01/2001 01:23:46 000");
  ClockUtil.setCurrentTime(updatedDate);
  
  
  execution.setVariable("aVariable", "updated value");
  execution.setVariable("bVariable", 123);
  execution.setVariable("cVariable", 12345L);
  execution.setVariable("dVariable", 1234.567);
  execution.setVariable("eVariable", (short)12);
  
  Date theDate =sdf.parse("01/01/2001 01:23:45 678");
  execution.setVariable("fVariable", theDate);
  
  execution.setVariable("gVariable", new SerializableVariable("hello hello"));
  execution.setVariable("hVariable", ";-)".getBytes());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:21,代码来源:VariableSetter.java

示例6: execute

import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
@Override
public void execute(DelegateExecution ctx) throws Exception {
  CreateChargeRequest request = new CreateChargeRequest();
  request.amount = (int) ctx.getVariable(ProcessConstants.VAR_NAME_amount);
  
  CreateChargeResponse response = rest.postForObject( //
      restEndpoint(), //
      request, //
      CreateChargeResponse.class);
  
  ctx.setVariable(ProcessConstants.VARIABLE_paymentTransactionId, response.transactionId);
}
 
开发者ID:berndruecker,项目名称:camunda-spring-boot-amqp-microservice-cloud-example,代码行数:13,代码来源:RetrievePaymentAdapter.java

示例7: notify

import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
@Override
public void notify(DelegateExecution delegateExecution) {
    String userId = delegateExecution.getProcessEngineServices().getIdentityService().getCurrentAuthentication().getUserId();
    String processInstanceId = delegateExecution.getProcessInstanceId();
    TechOrder techOrder = (TechOrder) delegateExecution.getVariable("techorder");
    techOrder.setId(processInstanceId);
    techOrder.setOwner(orgStructureHelper.getUser(userId));
    delegateExecution.setVariable("processReaders", userId);
    Letter letter = letterTemplateService.generateStartForTechOrder(techOrder.getId());
    mailService.sendMail(userId, letter.getSubject(), letter.getBody());
}
 
开发者ID:IntegrityVision,项目名称:Purchase-order-process-template,代码行数:12,代码来源:TechOrderStartEvent.java

示例8: execute

import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
/**
 * Scans SIP package for viruses.
 * <p>
 * Task expects String path to SIP stored in process variable <i>pathToSip</i>.
 * Task sets process variable <i>infectedFiles</i>  with list with String paths to infected files.
 *
 * @throws IOException
 * @throws InterruptedException
 * @throws SIPAntivirusScannerException if error occurs during the antivirus scan process
 */
@Override
public void execute(DelegateExecution execution) throws InterruptedException, SIPAntivirusScannerException, IOException {
    List<Path> infectedFiles = scanner.scan((String) execution.getVariable("pathToSip"));

    execution.setVariable("infectedFiles",
            infectedFiles.stream().map(
                    filePath -> filePath.toString()
            ).collect(Collectors.toList())
    );
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:21,代码来源:ScanBpmDelegate.java

示例9: execute

import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
/**
 * Verifies fixity of files specified in SIP META XML.
 * <p>
 * Expects <i>sipMetaPath</i> String variable to be set in process. This variable should contain path to SIP META XML.
 * Task sets process variable <i>invalidChecksumFiles</i>  with list with String paths to files with invalid checksum.
 *
 * @throws IOException
 */
@Override
public void execute(DelegateExecution execution) throws IOException {
    Path pathToSIP = Paths.get((String) execution.getVariable("sipMetaPath"));
    execution.setVariable("invalidChecksumFiles",
            verifier.verifySIP(pathToSIP).stream().map(
                    filePath -> filePath.toString()
            ).collect(Collectors.toList())
    );
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:18,代码来源:FixityBpmDelegate.java

示例10: execute

import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public void execute(DelegateExecution ctx) throws Exception {
  CreateChargeRequest request = new CreateChargeRequest();
  request.amount = (long) ctx.getVariable("amount");

  CreateChargeResponse response = rest.postForObject( //
      stripeChargeUrl, //
      request, //
      CreateChargeResponse.class);

  ctx.setVariable("paymentTransactionId", response.transactionId);
}
 
开发者ID:flowing,项目名称:flowing-retail,代码行数:12,代码来源:PaymentRestHacksControllerV4.java

示例11: execute

import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public void execute(DelegateExecution ctx) throws Exception {
  CreateChargeRequest request = new CreateChargeRequest();
  request.amount = (int) ctx.getVariable("remainingAmount");

  CreateChargeResponse response = rest.postForObject( //
      stripeChargeUrl, //
      request, //
      CreateChargeResponse.class);
  
  // TODO Add error scenarios to StripeFake and then raise "Error_CreditCardError" here 

  ctx.setVariable("paymentTransactionId", response.transactionId);
}
 
开发者ID:flowing,项目名称:flowing-retail,代码行数:14,代码来源:ChargeCreditCardAdapter.java

示例12: execute

import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
@Override
public void execute(DelegateExecution execution) throws Exception {
    System.out.println();
    System.out.println("Entering '" + execution.getCurrentActivityName()
            + "' ... (variableScopeKey=" + execution.getVariableScopeKey() + ")");
    System.out.println("  executing 'execution.setVariable(\"myGlobal\", \"4711\") ...' ");
    execution.setVariable("myGlobal", "4711");
    System.out.println("  executing 'execution.setVariableLocal(\"myLocal\", \"4712\") ...'");
    execution.setVariableLocal("myLocal", "4712");
    System.out.println();
}
 
开发者ID:FrVaBe,项目名称:camunda,代码行数:12,代码来源:SetVariablesTask.java

示例13: execute

import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
@Override
public void execute(DelegateExecution execution) throws Exception {

    ComplexObject obj = new ComplexObject();
    obj.setTextValue("Hello World");
    obj.setIntegerValue(4711);
    obj.setBooleanValue(true);

    execution.setVariable("complexOject", obj);
    execution.setVariable("textValue", obj.getTextValue());
    execution.setVariable("integerValue", obj.getIntegerValue());
    execution.setVariable("booleanValue", obj.getBooleanValue());

}
 
开发者ID:FrVaBe,项目名称:camunda,代码行数:15,代码来源:PrepareStateTask.java

示例14: addExecutionId

import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
private void addExecutionId(final DelegateExecution execution) {
    if (!execution.hasVariable(ACTIVITY_EXECUTION_MAP_VAR_NAME)) {
        execution.setVariable(ACTIVITY_EXECUTION_MAP_VAR_NAME, new HashMap<String, String>());
    }
    @SuppressWarnings("unchecked")
    Map<String, String> activityExecutionMap =
            (Map<String, String>) execution.getVariable(ACTIVITY_EXECUTION_MAP_VAR_NAME);
    activityExecutionMap.put(execution.getCurrentActivityName(), execution.getId());
    execution.setVariable(ACTIVITY_EXECUTION_MAP_VAR_NAME, activityExecutionMap);
}
 
开发者ID:FrVaBe,项目名称:camunda,代码行数:11,代码来源:GlobalExecutionListener.java

示例15: notify

import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
@Override
public void notify(DelegateExecution execution) throws Exception {
  for (String variableName : VARIABLES.TO_BE_INITIALIZED_WITH_NULL) {
    if (!execution.hasVariable(variableName)) {
      execution.setVariable(variableName, null);
    }
  }
}
 
开发者ID:holisticon,项目名称:skill-based-routing,代码行数:9,代码来源:ProcessStartVariableInitializationListener.java


注:本文中的org.camunda.bpm.engine.delegate.DelegateExecution.setVariable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。