Skip to content

Commit 71a8bb0

Browse files
committed
removing else blocks
1 parent ba4f06e commit 71a8bb0

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

spring-boot-examples/workflows/multi-app/orchestrator/src/main/java/io/dapr/springboot/examples/orchestrator/CustomersRestController.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,9 @@ public String customerNotification(@RequestBody Customer customer) {
6767
String workflowIdForCustomer = customersWorkflows.get(customer.getCustomerName());
6868
if (workflowIdForCustomer == null || workflowIdForCustomer.isEmpty()) {
6969
return "There is no workflow associated with customer: " + customer.getCustomerName();
70-
} else {
71-
daprWorkflowClient.raiseEvent(workflowIdForCustomer, "CustomerReachOut", customer);
72-
return "Customer Follow-up requested";
7370
}
71+
daprWorkflowClient.raiseEvent(workflowIdForCustomer, "CustomerReachOut", customer);
72+
return "Customer Follow-up requested";
7473
}
7574

7675
/**
@@ -84,11 +83,10 @@ public String getCustomerStatus(@RequestBody Customer customer) {
8483
String workflowIdForCustomer = customersWorkflows.get(customer.getCustomerName());
8584
if (workflowIdForCustomer == null || workflowIdForCustomer.isEmpty()) {
8685
return "N/A";
87-
} else {
88-
WorkflowInstanceStatus instanceState = daprWorkflowClient.getInstanceState(workflowIdForCustomer, true);
89-
assert instanceState != null;
90-
return "Workflow for Customer: " + customer.getCustomerName() + " is " + instanceState.getRuntimeStatus().name();
9186
}
87+
WorkflowInstanceStatus instanceState = daprWorkflowClient.getInstanceState(workflowIdForCustomer, true);
88+
assert instanceState != null;
89+
return "Workflow for Customer: " + customer.getCustomerName() + " is " + instanceState.getRuntimeStatus().name();
9290
}
9391

9492
/**
@@ -102,11 +100,10 @@ public Customer getCustomerOutput(@RequestBody Customer customer) {
102100
String workflowIdForCustomer = customersWorkflows.get(customer.getCustomerName());
103101
if (workflowIdForCustomer == null || workflowIdForCustomer.isEmpty()) {
104102
return null;
105-
} else {
106-
WorkflowInstanceStatus instanceState = daprWorkflowClient.getInstanceState(workflowIdForCustomer, true);
107-
assert instanceState != null;
108-
return instanceState.readOutputAs(Customer.class);
109103
}
104+
WorkflowInstanceStatus instanceState = daprWorkflowClient.getInstanceState(workflowIdForCustomer, true);
105+
assert instanceState != null;
106+
return instanceState.readOutputAs(Customer.class);
110107
}
111108

112109

0 commit comments

Comments
 (0)