本文整理汇总了Java中org.camunda.bpm.engine.delegate.DelegateExecution.getVariables方法的典型用法代码示例。如果您正苦于以下问题:Java DelegateExecution.getVariables方法的具体用法?Java DelegateExecution.getVariables怎么用?Java DelegateExecution.getVariables使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.camunda.bpm.engine.delegate.DelegateExecution
的用法示例。
在下文中一共展示了DelegateExecution.getVariables方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
示例2: sendContractConfirmation
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public void sendContractConfirmation(DelegateExecution delegateExecution) {
Map<String, Object> variables = delegateExecution.getVariables();
int orderID = Integer.parseInt(variables.get("orderID").toString());
RentalOrder order = orderService.getOrder(orderID);
SendContractConfirmation client = new SendContractConfirmation();
System.out.println("SENDING CONTRACT CONFIRMATION");
String processInstanceIDBVIS = (String) variables.get("processId");
String processInstanceIDCapitol = (String) variables.get("processIdCapitol");
client.sendContractConfirmation(order, processInstanceIDBVIS, processInstanceIDCapitol, 1);
System.out.println("CONTRACT CONFIRMATION SUCCESSFULLY SENT"); // TODO
// insert
// proper
// contract
// status
}
示例3: replaceVariables
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public static String replaceVariables(DelegateExecution execution, String topicPattern) {
if (topicPattern.contains("${")) {
StrSubstitutor substitutor = new StrSubstitutor(execution.getVariables());
return substitutor.replace(topicPattern);
} else {
return topicPattern;
}
}
示例4: insertWorkshopBill
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public boolean insertWorkshopBill(DelegateExecution delegateExecution) {
Map<String, Object> variables = delegateExecution.getVariables();
double repairBill = (double)variables.get("repairBill");
Claim claim = claimService.getClaim((long)variables.get("claimID"));
claim.setWorkshopPrice(new BigDecimal(repairBill));
claimService.updateClaim(claim);
return true;
}
示例5: sendClaimDetails
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public void sendClaimDetails(DelegateExecution delegateExecution) {
Map<String, Object> variables = delegateExecution.getVariables();
long claimID = (long)variables.get("claimID");
Claim claim = claimService.getClaim(claimID);
System.out.println("INITIATING SENDING CLAIM FOR ORDER " + claim.getRentalOrder().getOrderID());
SendClaim sender = new SendClaim();
System.out.println("Sending inquiry with vehicle identification number: " + claim.getRentalOrder().getCars().
iterator().next().getVehicleIdentificationNumber());
String result = sender.sendClaim(claim, delegateExecution.getProcessInstanceId());
System.out.println("SENDING DONE. INSURANCE API RESPONSE: " + result);
//TODO handle failures
}
示例6: handleInsuranceReponse
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public boolean handleInsuranceReponse(DelegateExecution delegateExecution) {
Map<String, Object> variables = delegateExecution.getVariables();
long claimID = (Long)variables.get("claimID");
Claim claim = claimService.getClaim(claimID);
claim.setCostsCoverage(new BigDecimal(Double.parseDouble(variables.get("coverageCosts")+"")));
System.out.println("COSTS COVERED: " + claim.getCostsCoverage());
claim.setCustomerCosts(new BigDecimal(Double.parseDouble(variables.get("customerCosts")+"")));
System.out.println("CUSTOMER COSTS: " + claim.getCustomerCosts());
int insuranceDecision = ((Integer)variables.get("insuranceDecision"));
variables.remove("insuranceDecision");
if (insuranceDecision == 0) {
claim.setClaim_status(ClaimStatus.REJECTED);
System.out.println("CLAIM REJECTED");
variables.put("insuranceDecision", ClaimStatus.REJECTED.toString());
}
else if (insuranceDecision == 1) {
claim.setClaim_status(ClaimStatus.ACCEPTED);
System.out.println("CLAIM ACCEPTED");
variables.put("insuranceDecision", ClaimStatus.ACCEPTED.toString());
}
else {
claim.setClaim_status(ClaimStatus.ADJUSTED);
System.out.println("CLAIM ADJUSTED");
variables.put("insuranceDecision", ClaimStatus.ADJUSTED.toString());
}
claimService.updateClaim(claim);
//return true to trigger continuation
return true;
}
示例7: sendClaimReview
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public void sendClaimReview(DelegateExecution delegateExecution) {
Map<String, Object> variables = delegateExecution.getVariables();
ClaimReview claimReview = new ClaimReview();
Claim claim = claimService.getClaim((long)variables.get("claimID"));
claimReview.setClaim(claim);
claimReview.setRemarks((String)variables.get("remarks"));
claimReview.setClaimStatus(Integer.parseInt(variables.get("bvisAnswer")+""));
claimReview.setProcessIDCapitol((String)variables.get("processIDCapitol"));
SendClaimReview sender = new SendClaimReview();
String result = sender.sendClaimReview(claimReview, delegateExecution.getProcessInstanceId());
System.out.println("SENDING DONE. INSURANCE API RESPONSE: " + result);
//TODO handle failures
}
示例8: reworkDecision
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
/**
* Helper method to decide the flow in the BPMN model for the final customer contact depending on the insurance answer
* @param delegateExecution
* @return
*/
public int reworkDecision(DelegateExecution delegateExecution) {
Map<String, Object> variables = delegateExecution.getVariables();
System.out.println("Customer costs: " + variables.get("customerCosts"));
System.out.println("Costs covered: " + variables.get("coverageCosts"));
// 0 = customer has to pay
if (Double.parseDouble(variables.get("customerCosts")+"") > 0) return 0;
// insurance pays
else if (Double.parseDouble(variables.get("coverageCosts")+"") > 0) return 1;
// else if insurance does not cover costs and customer does not have to pay -> third party has to pay
else return 2;
}
示例9: handleInsuranceResponse
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public boolean handleInsuranceResponse(DelegateExecution delegateExecution) {
Map<String, Object> variables = delegateExecution.getVariables();
int orderID = Integer.parseInt(variables.get("orderID").toString());
RentalOrder order = orderService.getOrder(orderID);
Insurance insurance = order.getInsurance();
insurance.setActualCosts(new BigDecimal(Double.parseDouble(variables.get("finalPrice").toString())));
insurance.setInquiryText(variables.get("inquiryText").toString());
order.setPrice(insurance.getActualCosts().doubleValue() + order.getPriceCars());
int insuranceAnswer = Integer.parseInt(variables.get("insuranceResult").toString());
if (insuranceAnswer == 0) {
insurance.setInsuranceAnswer(InsuranceAnswer.REJECTED);
System.out.println("INSURANCE REJECTED");
order.setOrderStatus(OrderStatus.REJECTED);
} else if (insuranceAnswer == 1) {
insurance.setInsuranceAnswer(InsuranceAnswer.ACCEPTED);
System.out.println("INSURANCE ACCEPTED");
order.setOrderStatus(OrderStatus.ACCEPTED);
} else {
insurance.setInsuranceAnswer(InsuranceAnswer.ADJUSTED);
System.out.println("INSURANCE ADJUSTED");
}
order.setInsurance(insurance);
delegateExecution.removeVariables();
orderService.updateOrder(order);
// return true to trigger continuation
return true;
}
示例10: updateContract
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public boolean updateContract(DelegateExecution delegateExecution) {
Map<String, Object> variables = delegateExecution.getVariables();
long newCarID = Long.parseLong(variables.get("newCarId")+"");
Car newCar = carService.getCar(newCarID);
RentalOrder order = orderService.getOrder(Long.parseLong(variables.get("orderId")+""));
ArrayList<Car> cars = new ArrayList<Car>();
cars.add(newCar);
order.setCars(cars);
orderService.updateOrder(order);
System.out.println("NEW CAR: " + order.getCars().iterator().next().getModel());
return true;
}
示例11: persistClaim
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public void persistClaim(DelegateExecution delegateExecution) {
Map<String, Object> variables = delegateExecution.getVariables();
Claim claim = new Claim();
// Check whether car exist has been done already
Car car = carService.getCarByVehicleIdentificationNumber((String)variables.get("vehicleID"));
claim.setCar(car);
claim.setClaim_status(ClaimStatus.NOT_SEND_YET);
claim.setClaimDescription((String)variables.get("damageDescription"));
claim.setDamageDate((Date)variables.get("damageDate"));
claim.setTowingServiceNeeded((Boolean)variables.get("towingServiceNeeded"));
claim.setReportedByCustomer((Boolean)variables.get("reportedByCustomer"));
RentalOrder order = orderService.getOrder(Long.parseLong(variables.get("orderID")+""));
Insurance insurance = order.getInsurance();
claim.setInsurance(insurance);
// check if there is a party involved
ArrayList<InvolvedParty> parties = new ArrayList<InvolvedParty>();
InvolvedParty party = new InvolvedParty();
if (variables.get("party1Surname") != null) {
party.setCity((String)variables.get("party1City"));
party.setCompany((String)variables.get("party1Company"));
party.setCountry((String)variables.get("party1Country"));
party.setDate_of_birth((Date)variables.get("party1Birthday"));
party.setEmail((String)variables.get("party1EMail"));
party.setFirstname((String)variables.get("party1Firstname"));
party.setPhone_number((String)variables.get("party1Phone"));
party.setPostcode((String)variables.get("party1ZIP"));
party.setStreet((String)variables.get("party1Street"));
party.setSurname((String)variables.get("party1Surname"));
party.setHouse_number((String)variables.get("party1HouseNo"));
// find claim insurance data
ClaimInsurance claimInsurance = insuranceService.getClaimInsuranceByName((String)variables.get("party1Insurance"));
party.setClaimInsurance(claimInsurance);
// set claim because somehow hibernate gets the mapping from
party.setClaim(claim);
// only adds one party for now
parties.add(party);
}
claim.setInvolvedParties(parties);
claim.setRentalOrder(order);
claimService.createClaim(claim);
// Remove no longer needed process variables
delegateExecution.removeVariables(variables.keySet());
// Add newly created claim id as process variable
delegateExecution.setVariable("claimID", claim.getClaimID());
System.out.println("CREATED CLAIM WITH CLAIM ID: " + claim.getClaimID());
}
示例12: informedByCustomer
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public boolean informedByCustomer(DelegateExecution delegateExecution) {
Map<String, Object> variables = delegateExecution.getVariables();
Claim claim = claimService.getClaim((long)variables.get("claimID"));
System.out.println("Claim informed by customer?:" + claim.isReportedByCustomer());
return claim.isReportedByCustomer();
}
示例13: towingServiceNeeded
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public boolean towingServiceNeeded(DelegateExecution delegateExecution) {
Map<String, Object> variables = delegateExecution.getVariables();
Claim claim = claimService.getClaim((long)variables.get("claimID"));
return claim.isTowingServiceNeeded();
}
示例14: claimDecisionAccepted
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public boolean claimDecisionAccepted(DelegateExecution delegateExecution) {
Map<String, Object> variables = delegateExecution.getVariables();
if (Integer.parseInt(variables.get("bvisAnswer")+"") == 1) return true;
else return false;
}
示例15: handleRequirements
import org.camunda.bpm.engine.delegate.DelegateExecution; //导入方法依赖的package包/类
public void handleRequirements(DelegateExecution delegateExecution) {
Map<String, Object> variables = delegateExecution.getVariables();
// only gets called for single car rentals
RentalOrder rentalOrder = getOrder((Long) variables.get("orderId"));
Car car = rentalOrder.getCars().iterator().next();
// get all cars that have the same model
Collection<Car> sameCars = carService.getAllCarsByModel(car.getModel());
// find a car that is available in the requested period for the current rental order
Date begin = rentalOrder.getPick_up_date();
Date end = rentalOrder.getReturn_date();
boolean foundOne = false;
for (Car c : sameCars) {
boolean available = true;
for (RentalOrder o : c.getRentalOrders()) {
// if it is the same rental order as the current one continue
if (o.equals(rentalOrder)) continue;
// not available when
// case 1: pickup before pickup and return after pickup
// case 2: pickup after pickup and before return
if ((o.getPick_up_date().before(begin) || o.getPick_up_date().equals(begin))
&& (o.getReturn_date().after(begin) || o.getReturn_date().equals(begin))) {
available = false;
break;
}
else if ((o.getPick_up_date().after(begin) || o.getPick_up_date().equals(begin))
&& (o.getPick_up_date().before(end) || o.getPick_up_date().equals(end))) {
available = false;
break;
}
}
// if current car is available
if (available) {
foundOne = true;
// update newly assigned car
Collection<RentalOrder> currentOrders = c.getRentalOrders();
currentOrders.add(rentalOrder);
c.setRentalOrders(currentOrders);
carService.updateCar(c);
// update original car
currentOrders = car.getRentalOrders();
currentOrders.remove(rentalOrder);
carService.updateCar(car);
// update rental order
ArrayList<Car> newCarList = new ArrayList<Car>();
newCarList.add(c);
rentalOrder.setCars(newCarList);
orderService.updateOrder(rentalOrder);
}
}
if (foundOne) System.out.println("Car available");
else System.out.println("No car available");
delegateExecution.setVariable("fulfillable", foundOne);
}