-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Git Issue - 2749: Add decisionInstanceId to evaluate DMN decision api response #4197
base: master
Are you sure you want to change the base?
Git Issue - 2749: Add decisionInstanceId to evaluate DMN decision api response #4197
Conversation
Hi @kmannuru, Thank you for raising this. Best, |
@yanavasileva Did you get a chance to review my code changes. Thanks |
Hi @kmannuru, I will need more time to review the PR as the change is not trivial. |
Hi, just checking in.
Best, |
@yanavasileva thanks for your feedback. I'll update the PR with additional unit test coverage and change scope of |
@kmannuru, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will wait for adjusting the handling of decisionInstanceId
before continuing with the review.
Closing due to inactivity. The PR can be reopened again when you get back to the topic. |
@yanavasileva I'm currently working on the changes to create |
7de6638
to
03d06ee
Compare
@yanavasileva I've made changes to the PR as per your recommendation. Please help review my code changes. Thanks. |
@yanavasileva Did you get a chance to review my code changes. Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @kmannuru,
Thank you for your patience with this. I have started the review but unfortunately there are open questions that I won't have a look with fresh mind.
Nevertheless, the changes look promising and I added initial round of feedback that you can check to clean up the contribution.
Best,
Yana
} | ||
|
||
public DmnDecisionResult evaluateDecision(DmnDecision decision, VariableContext variableContext) { | ||
public DmnDecisionResult evaluateDecision(DmnDecision decision, VariableContext variableContext, String decisionInsanceId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public DmnDecisionResult evaluateDecision(DmnDecision decision, VariableContext variableContext, String decisionInsanceId) { | |
public DmnDecisionResult evaluateDecision(DmnDecision decision, VariableContext variableContext, String decisionInstanceId) { |
ensureNotNull("decision", decision); | ||
ensureNotNull("variableContext", variableContext); | ||
|
||
if (decision instanceof DmnDecisionImpl) { | ||
DefaultDmnDecisionContext decisionContext = new DefaultDmnDecisionContext(dmnEngineConfiguration); | ||
return decisionContext.evaluateDecision(decision, variableContext); | ||
return decisionContext.evaluateDecision(decision, variableContext, decisionInsanceId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return decisionContext.evaluateDecision(decision, variableContext, decisionInsanceId); | |
return decisionContext.evaluateDecision(decision, variableContext, decisionInstanceId); |
engine/pom.xml
Outdated
<!-- <dependency>--> | ||
<!-- <groupId>org.camunda.bpm.juel</groupId>--> | ||
<!-- <artifactId>camunda-juel</artifactId>--> | ||
<!-- </dependency>--> | ||
|
||
<dependency> | ||
<groupId>org.camunda.bpm.juel</groupId> | ||
<artifactId>camunda-juel</artifactId> | ||
<version>7.20.0</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ The version of the juel
module is the current project version:
<!-- <dependency>--> | |
<!-- <groupId>org.camunda.bpm.juel</groupId>--> | |
<!-- <artifactId>camunda-juel</artifactId>--> | |
<!-- </dependency>--> | |
<dependency> | |
<groupId>org.camunda.bpm.juel</groupId> | |
<artifactId>camunda-juel</artifactId> | |
<version>7.20.0</version> | |
<dependency> | |
<groupId>org.camunda.bpm.juel</groupId> | |
<artifactId>camunda-juel</artifactId> |
engine-dmn/engine/src/main/java/org/camunda/bpm/dmn/engine/DmnDecisionResult.java
Show resolved
Hide resolved
@@ -111,4 +111,15 @@ public interface DmnDecisionResult extends List<DmnDecisionResultEntries>, Seria | |||
*/ | |||
<T extends TypedValue> T getSingleEntryTyped(); | |||
|
|||
/** Returns the value of decisionInstanceId that's part of DMN decision evaluation | |||
* @return the decisionInstanceId generated | |||
* GIT Issue: https://github.com/camunda/camunda-bpm-platform/issues/2749 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Please remove all of the git ticket references from the code. The modern IDE and GitHub offer enough support to track the origins to ticket and pull request.
* GIT Issue: https://github.com/camunda/camunda-bpm-platform/issues/2749 |
public boolean isNotBlank(String value) { | ||
return value != null && !value.isEmpty(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Reuse existing utils.
public boolean isNotBlank(String value) { | |
return value != null && !value.isEmpty(); | |
} |
* Setting the generated decisionInstanceId to the root event | ||
* Generating custom decisionInstanceId to persist the history event and return the id in the response | ||
*/ | ||
if(isNotBlank(evaluationEvent.getDecisionInstanceId())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Reuse existing utils (don't forget to add import):
if(isNotBlank(evaluationEvent.getDecisionInstanceId())) { | |
if(StringUtil.hasText(evaluationEvent.getDecisionInstanceId())) { |
* Generating custom decisionInstanceId to persist the history event and return the id in the response | ||
*/ | ||
if(isNotBlank(evaluationEvent.getDecisionInstanceId())) { | ||
rootDecisionEvent.setId(evaluationEvent.getDecisionInstanceId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to myself:
❓ Shouldn't the id of the root to be pointing to the root event DI id? What's the reference (ROOT_DEC_INST_ID_
, ROOT_PROC_INST_ID_
, history cleanup)?
@Path("/evaluate-with-id") | ||
@Consumes(MediaType.APPLICATION_JSON) | ||
@Produces(MediaType.APPLICATION_JSON) | ||
DecisionEvaluationDto evaluateDecisionWithId(@Context UriInfo context, EvaluateDecisionDto parameters); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to myself:
❓ Could we avoid adding the new endpoint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📓 There's a compilation error in OpenAPI tests, please have a look. Hints:
cd engine-rest
mvn clean install
Let me know if you need more guidance
@yanavasileva Thanks for your feedback. I'm currently working on changes to incorporate your review comments. I'll share the updated PR shortly. Thanks. |
@@ -155,16 +155,16 @@ public DmnDecisionTableResult evaluateDecisionTable(String decisionKey, DmnModel | |||
public DmnDecisionResult evaluateDecision(DmnDecision decision, Map<String, Object> variables) { | |||
ensureNotNull("decision", decision); | |||
ensureNotNull("variables", variables); | |||
return evaluateDecision(decision, Variables.fromMap(variables).asVariableContext()); | |||
return evaluateDecision(decision, Variables.fromMap(variables).asVariableContext(), null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be replaced with evaluateDecision(decision, variableContext)
@@ -181,7 +181,7 @@ public DmnDecisionResult evaluateDecision(String decisionKey, InputStream inputS | |||
List<DmnDecision> decisions = parseDecisions(inputStream); | |||
for (DmnDecision decision : decisions) { | |||
if (decisionKey.equals(decision.getKey())) { | |||
return evaluateDecision(decision, variableContext); | |||
return evaluateDecision(decision, variableContext, null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be replaced with evaluateDecision(decision, variableContext)
@@ -197,7 +197,7 @@ public DmnDecisionResult evaluateDecision(String decisionKey, DmnModelInstance d | |||
List<DmnDecision> decisions = parseDecisions(dmnModelInstance); | |||
for (DmnDecision decision : decisions) { | |||
if (decisionKey.equals(decision.getKey())) { | |||
return evaluateDecision(decision, variableContext); | |||
return evaluateDecision(decision, variableContext, null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be replaced with evaluateDecision(decision, variableContext)
@@ -112,7 +112,7 @@ public DmnDecisionTableResult evaluateDecisionTable(DmnDecision decision, Variab | |||
if (decision instanceof DmnDecisionImpl && decision.isDecisionTable()) { | |||
DefaultDmnDecisionContext decisionContext = new DefaultDmnDecisionContext(dmnEngineConfiguration); | |||
|
|||
DmnDecisionResult decisionResult = decisionContext.evaluateDecision(decision, variableContext); | |||
DmnDecisionResult decisionResult = decisionContext.evaluateDecision(decision, variableContext, null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yanavasileva This will not change because we need to pass the decisionInsanceId to decisionContext.evaluateDecision(decision, variableContext, null);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you are ready, please submit your changes, I will have a look then.
Closing due to lack of requested feedback. If you would like us to look at this, please provide the requested information to re-open the PR. |
@yanavasileva Can you please help reopen the PR so I can merge my changes for your review? Thanks |
PR reopened. |
@yanavasileva Please help review the PR. The latest commit on the PR includes the changes that addresses the review comments. Thanks. |
@kmannuru, I don't see any new changes pushed to the PR. Have you added everything? |
@yanavasileva Yes. The PR is updated with the changes to reflect the review comments. Please help review when you get a chance. Thanks. |
GIT Issue: #2749