-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
java delegate service classes and tests
- Loading branch information
1 parent
7cb97d1
commit 6b15427
Showing
19 changed files
with
283 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
src/main/java/com/noodles/services/workflow/delegates/LetUsCook.java
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
src/main/java/com/noodles/services/workflow/delegates/LetUsEat.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/main/java/com/noodles/workflow/delegates/LetUsCook.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.noodles.workflow.delegates; | ||
|
||
import com.noodles.util.Constants; | ||
import com.noodles.util.WorkflowLogger; | ||
import org.camunda.bpm.engine.delegate.DelegateExecution; | ||
import org.camunda.bpm.engine.delegate.JavaDelegate; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.StringJoiner; | ||
|
||
@Service("LetsCook") | ||
public class LetUsCook implements JavaDelegate { | ||
|
||
public static final String STEP = "STEP "; | ||
private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
|
||
/** | ||
* This will be used to fetch ingredients and begin to cook following the recipe | ||
* | ||
* @param execution : Process Variables will be retrieved from DelegateExecution | ||
*/ | ||
@Override | ||
public void execute(DelegateExecution execution) { | ||
|
||
WorkflowLogger.info(logger, "Prepare Noodles", "Follow below to make veg masala noodles"); | ||
|
||
WorkflowLogger.info(logger, STEP + 1, "Take a deep-bottomed pan over medium flame and add water in it and bring it to a boil."); | ||
|
||
StringJoiner vegetables = new StringJoiner(", "); | ||
if (execution.hasVariable(Constants.ONION) && (boolean) execution.getVariable(Constants.ONION)) vegetables.add(Constants.ONION); | ||
if (execution.hasVariable(Constants.TOMATO) && (boolean) execution.getVariable(Constants.TOMATO)) vegetables.add(Constants.TOMATO); | ||
if (execution.hasVariable(Constants.CARROT) && (boolean) execution.getVariable(Constants.CARROT)) vegetables.add(Constants.CARROT); | ||
if (execution.hasVariable(Constants.CAPSICUM) && (boolean) execution.getVariable(Constants.CAPSICUM)) vegetables.add(Constants.CAPSICUM); | ||
|
||
if (vegetables.length() < 4) | ||
WorkflowLogger.info(logger, STEP + 2, "While the water boils, take a chopping board and chop " + vegetables); | ||
else | ||
WorkflowLogger.info(logger, STEP + 2, "While the water starts to boil, check if you received IMs on your mobile."); | ||
|
||
WorkflowLogger.info(logger, STEP + 3, "Once the water boils, add chopped vegetables, add 1 packet of instant noodles and stir it."); | ||
|
||
WorkflowLogger.info(logger, STEP + 4, "Add the taste-maker to it and give it another stir"); | ||
|
||
if (execution.hasVariable(Constants.CHEESE) && (boolean) execution.getVariable(Constants.CHEESE)) | ||
WorkflowLogger.info(logger, STEP + 5, "Add grated cheese and close the lid"); | ||
else | ||
WorkflowLogger.info(logger, STEP + 5, "Close the lid"); | ||
|
||
WorkflowLogger.info(logger, "Cooking in Process", "You can play with your mobile as it cooks for sometime..."); | ||
|
||
execution.setVariable(Constants.IS_IT_COOKING, true); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/com/noodles/workflow/delegates/LetUsEat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.noodles.workflow.delegates; | ||
|
||
import com.noodles.util.Constants; | ||
import com.noodles.util.WorkflowLogger; | ||
import org.camunda.bpm.engine.delegate.DelegateExecution; | ||
import org.camunda.bpm.engine.delegate.JavaDelegate; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service("LetUsEat") | ||
public class LetUsEat implements JavaDelegate { | ||
|
||
public static final String EAT_NOODLES = "Eat Noodles"; | ||
private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
|
||
/** | ||
* We will eat what we cooked if it was not burnt | ||
* @param execution : Process Variables will be retrieved from DelegateExecution | ||
*/ | ||
@Override | ||
public void execute(DelegateExecution execution) { | ||
|
||
WorkflowLogger.info(logger, EAT_NOODLES, "Veg masala noodles is ready. Let's eat... But first serve it.."); | ||
|
||
WorkflowLogger.info(logger, EAT_NOODLES, "Transfer to a serving bowl and sprinkle a pinch of chaat masala or oregano over the noodles to make it even more flavorful."); | ||
|
||
if (execution.hasVariable(Constants.CHEESE) && (boolean) execution.getVariable(Constants.CHEESE)) | ||
WorkflowLogger.info(logger, EAT_NOODLES, "Add grated cheese over it. "); | ||
|
||
WorkflowLogger.info(logger, EAT_NOODLES, "Serve it hot to enjoy!! "); | ||
|
||
execution.setVariable(Constants.DID_WE_EAT_NOODLES, true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 0 additions & 17 deletions
17
src/test/java/com/noodles/services/workflow/delegates/LetUsCookTest.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.