-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Task api enhancement to include attachment and comments fields. #4306
Task api enhancement to include attachment and comments fields. #4306
Conversation
Hi @sumankumarpani, Thank you for raising this. Best, |
Thanks @yanavasileva , let me know what are your thoughts/ suggestions. |
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.
@sumankumarpani, I haven't finish completely the review yet but I want to share early feedback and store my notes.
👍 Overall expression is that your approach is good, I just want to have a second look.
engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/TaskEntity.java
Outdated
Show resolved
Hide resolved
engine/src/main/java/org/camunda/bpm/engine/impl/TaskQueryImpl.java
Outdated
Show resolved
Hide resolved
engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/TaskEntity.java
Outdated
Show resolved
Hide resolved
engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/dto/task/TaskDto.java
Show resolved
Hide resolved
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.
Thank you for considering my feedback so far, I managed to complete the review now.
Please see the comments below.
engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/dto/task/TaskDto.java
Outdated
Show resolved
Hide resolved
engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/TaskEntity.java
Outdated
Show resolved
Hide resolved
engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/TaskEntity.java
Outdated
Show resolved
Hide resolved
engine/src/main/java/org/camunda/bpm/engine/task/TaskQuery.java
Outdated
Show resolved
Hide resolved
engine/src/test/java/org/camunda/bpm/engine/test/api/task/TaskQueryTest.java
Outdated
Show resolved
Hide resolved
engine/src/main/java/org/camunda/bpm/engine/impl/TaskQueryImpl.java
Outdated
Show resolved
Hide resolved
engine/src/test/java/org/camunda/bpm/engine/test/api/task/TaskQueryTest.java
Outdated
Show resolved
Hide resolved
engine/src/test/java/org/camunda/bpm/engine/test/api/task/TaskQueryTest.java
Outdated
Show resolved
Hide resolved
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 don't see an action on this comment (in OpenAPI, REST API, Java API):
#2404 (comment)
One option is the described here:
#2404 (comment)
Other option will be to add comment to the APIs that can be true only if withCommentAttachmentInfo
filter is passed. That might create confusion in users.
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 , I am exploring option 1 of extending the dto class and adding additional variables.
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 got a doubt @yanavasileva , our changes should be applicable to GET & POST /task apis only ,and not /task/
{id} , let me know if my understanding is correct?
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.
@sumankumarpani, the ticket was initially reported for GET /task
REST API but covering GET /task/{id}
will add consistency to the endpoints. The TaskDto
is used as a return type for all of those endpoints so the made changes so far make sense.
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.
Got it, 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.
❌ In all OpenAPI files, hasAttachment/hasComment changes are not reflected.
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 Please help to reopen the pr, I have worked the changes but facing issues to sync it , requesting some time to sync my changes and update the pr. |
Hi,
Please help to reopen the pr, I have worked on the changes requested, but
facing some issues with syncing them. Requesting few days of time to sync
my changes to this pr.
…On Tue, 25 Jun, 2024, 9:36 am github-actions[bot], ***@***.***> wrote:
Closed #4306 <#4306>.
—
Reply to this email directly, view it on GitHub
<#4306 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJBYVNYNTGMGBIOANZ3Z3OLZJDUCVAVCNFSM6AAAAABG5VJFSGVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJTGI3TIOBQGI3DAOA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
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. |
Signed-off-by: Kumar Pani, Suman <Suman.KumarPani@fmr.com>
3ea772d
to
b03a241
Compare
@yanavasileva I have added some changes, please help to review them again. |
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.
Hi @sumankumarpani,
Thank you for your patience with this.
I am almost done with the review. I need to run some tests and clarify open points before we can merge the feature.
I have added my notes so they are documented for everyone to get access to them for reference. I will let you know in case any further input/action is needed from your side.
Best,
Yana
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; |
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.
❌ Not needed as far as I can see.
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; |
engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/dto/task/TaskDto.java
Show resolved
Hide resolved
|
||
@Produces(MediaType.APPLICATION_JSON) | ||
public interface TaskRestService { | ||
|
||
public static final String PATH = "/task"; | ||
|
||
@Path("/{id}") | ||
TaskResource getTask(@PathParam("id") String id); | ||
TaskResource getTask(@PathParam("id") String id, @QueryParam("withCommentAttachmentInfo") Optional<Boolean> withCommentAttachmentInfo); |
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: check CI and if there are cons against using Optional.
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.
@sumankumarpani, the engine-rest
changes are breaking the tests for one of our supported environments. I am checking how is best to adjust the new parameter and preserve backwards compatibility. I will contact you further with my findings.
If you want to see the failures for yourself, you can execute the following (with JDK 11):
mvn clean install -Pwildfly-compatibility -f engine-rest/engine-rest/pom.xml
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 I am seeing this error, are you seeing the same.
Response body doesn't match expectation.
Expected: is ""
Actual: {"type":"RuntimeException","message":"RESTEASY003875: Unable to find a constructor that takes a String param or a valueOf() or fromString() method for javax.ws.rs.QueryParam("withCommentAttachmentInfo") on public org.camunda.bpm.engine.rest.sub.task.TaskResource org.camunda.bpm.engine.rest.impl.TaskRestServiceImpl.getTask(java.lang.String,java.util.Optional) for basetype: java.util.Optional","code":null}
[ERROR] TaskVariableRestResourceInteractionTest.testGetObjectVariables:162 5 expectations failed.
Expected status code <200> but was <500>.
I couldn't find the exact reason yet, will update here if I get any clue. Meanwhile let me know if you recall handling similar in the past.
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.
Yes, I observe similar errors.
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 I modified the the param Optional withCommentAttachmentInfo to Boolean withCommentAttachmentInfo and given it a default value false, to make it work. Let me know if we can proceed with the solution.
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.
Boolean withCommentAttachmentInfo and given it a default value false, to make it work.
It seems like a better fit. We use similar approach in other places too.
Please adjust the code, I will run then the tests again.
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 I have pushed changes , please take a look.
engine-rest/engine-rest-openapi/src/main/templates/lib/commons/task-query-params.ftl
Show resolved
Hide resolved
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 response body can be TaskWithA..Dto
, do we need to adjust the response dto in the OpenAPI?
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.
@sumankumarpani, I checked the changes. Overall it looks good, I need to perform some final testing.
Have a look at my suggestions.
Heads up, we approach the code freeze of the minor release.
❗ If you want the feature to be included in 7.22.0, please apply the feedback by 17th of September.
@@ -29,14 +29,15 @@ | |||
import javax.ws.rs.core.Request; | |||
import javax.ws.rs.core.UriInfo; | |||
import java.util.List; | |||
import java.util.Optional; |
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.
❌ Not needed anymore:
import java.util.Optional; |
@@ -19,6 +19,8 @@ | |||
import com.fasterxml.jackson.databind.ObjectMapper; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Optional; |
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.
❌ Not needed:
import java.util.Optional; | |
import java.util.Optional; |
queryDto.setObjectMapper(getObjectMapper()); | ||
|
||
ProcessEngine engine = getProcessEngine(); | ||
TaskQuery query = queryDto.toQuery(engine); | ||
|
||
List<Task> matchingTasks = executeTaskQuery(firstResult, maxResults, query); | ||
|
||
List<TaskDto> result; | ||
if (Boolean.TRUE.equals(queryDto.getWithCommentAttachmentInfo())) { | ||
result = matchingTasks.stream().map(TaskWithAttachmentAndCommentDto::fromEntity).collect(Collectors.toList()); | ||
} | ||
else { | ||
result = matchingTasks.stream().map(TaskDto::fromEntity).collect(Collectors.toList()); | ||
} | ||
return result; |
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.
❓ Do we need this change? Now the code is duplicated.
queryDto.setObjectMapper(getObjectMapper()); | |
ProcessEngine engine = getProcessEngine(); | |
TaskQuery query = queryDto.toQuery(engine); | |
List<Task> matchingTasks = executeTaskQuery(firstResult, maxResults, query); | |
List<TaskDto> result; | |
if (Boolean.TRUE.equals(queryDto.getWithCommentAttachmentInfo())) { | |
result = matchingTasks.stream().map(TaskWithAttachmentAndCommentDto::fromEntity).collect(Collectors.toList()); | |
} | |
else { | |
result = matchingTasks.stream().map(TaskDto::fromEntity).collect(Collectors.toList()); | |
} | |
return result; | |
return queryTasks(queryDto, firstResult, maxResults); |
else { | ||
result = matchingTasks.stream().map(TaskDto::fromEntity).collect(Collectors.toList()); | ||
} | ||
return result; | ||
} | ||
|
||
public HalTaskList getHalTasks(UriInfo uriInfo, Integer firstResult, Integer maxResults) { |
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.
📓 No action, just comment. The param is not considered here. As Hal queries are used in Tasklist where we need performance.
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.
Thanks @yanavasileva for your reviews. Certainly I am willing these changes to be part of 7.22 release. I am done with addressing the comments and unit/integrations tests are running fine. Please let me know if the platform/e2e tests ran well or need something to be addressed, I will push the changes accordingly at a single instance and we can wrap it up.
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 I have addressed the pending comments.
engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/dto/task/TaskDto.java
Show resolved
Hide resolved
engine-rest/engine-rest-openapi/src/main/templates/lib/commons/task-query-params.ftl
Show resolved
Hide resolved
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.
👍
Thank you for the work on this! Changes now look good to me.
I will merge the PR later today and it will be part of 7.22.0 scheduled for next month.
Thanks for the update Yana :) |
Feat(engine) : User task api provide comment and attachment properties
related to GIT Issue : #2404