-
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
Task api enhancement to include attachment and comments fields. #4306
base: master
Are you sure you want to change the base?
Task api enhancement to include attachment and comments fields. #4306
Conversation
…related boolean fields.
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
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
Outdated
Show resolved
Hide resolved
…nhancements' into feature/ENTDAPCOE-126-task-api-enhancements
…/github.com/fidelity-contributions/camunda-camunda-bpm-platform into feature/ENTDAPCOE-126-task-api-enhancements
|
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.
@@ -49,7 +50,9 @@ public class TaskDto { | |||
private String formKey; | |||
private CamundaFormRef camundaFormRef; | |||
private String tenantId; | |||
|
|||
@JsonProperty("attachment") |
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.
❌ For consistency, let's remove the annotation:
@JsonProperty("attachment") |
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 was reluctant to add this, I am facing an weird issue where hasAttachment is translated to attachments instead of attachment in the json response, hence decided to add. Let me know your thoughts.
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 saw this. I will try to see from where it's coming.
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.
You can also try to debug it.
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 figured it , jackson considers the setter method to decide the boolean var name.
this.attachmentExists = !getProcessEngine().getTaskService().getTaskAttachments(id).isEmpty(); | ||
this.commentExists = !getProcessEngine().getTaskService().getTaskComments(id).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.
❌ Please re-use the command context instead of executing command (get attachment/comments) in the command (task query):
this.attachmentExists = !getProcessEngine().getTaskService().getTaskAttachments(id).isEmpty(); | |
this.commentExists = !getProcessEngine().getTaskService().getTaskComments(id).isEmpty(); | |
this.attachmentExists = !Context.getCommandContext().getAttachmentManager().findAttachmentsByTaskId(id).isEmpty(); | |
this.commentExists = !Context.getCommandContext().getCommentManager().findCommentsByTaskId(id).isEmpty(); | |
engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/TaskEntity.java
Show resolved
Hide resolved
/** | ||
* Evaluates existence of attachment and comments associated with the task, defaults to false. | ||
*/ |
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 add performance considerations to the javadoc. Adding the filter will do additional attachment and comments queries to the database, that might slow down the query in case of big size of the tables.
@Test | ||
@Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.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.
❌ Add required history level (don't forget to add the imports):
@Test | |
@Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml") | |
@Test | |
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_ACTIVITY) | |
@Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml") |
@@ -1441,6 +1449,13 @@ public List<Task> executeList(CommandContext commandContext, Page page) { | |||
} | |||
} | |||
|
|||
if (withCommentAttachmentInfo && Context.getProcessEngineConfiguration().getHistoryLevel()!= HistoryLevel.HISTORY_LEVEL_NONE) { |
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.
❌ Use equals to compare:
if (withCommentAttachmentInfo && Context.getProcessEngineConfiguration().getHistoryLevel()!= HistoryLevel.HISTORY_LEVEL_NONE) { | |
if (withCommentAttachmentInfo && !Context.getProcessEngineConfiguration().getHistoryLevel().equals(HistoryLevel.HISTORY_LEVEL_NONE)) { |
import static org.junit.Assert.*; | ||
import static org.junit.Assert.assertFalse; |
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.
🔧 Following code styles guidelines:
import static org.junit.Assert.*; | |
import static org.junit.Assert.assertFalse; | |
import static org.junit.Assert.assertEquals; | |
import static org.junit.Assert.assertFalse; | |
import static org.junit.Assert.assertNotNull; | |
import static org.junit.Assert.assertNull; | |
import static org.junit.Assert.assertTrue; | |
import static org.junit.Assert.fail; |
} | ||
@Test | ||
@Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.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.
❌ Add required history level:
} | |
@Test | |
@Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml") | |
} | |
@Test | |
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_ACTIVITY) | |
@Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.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.
❌ 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.
❌ In all OpenAPI files, hasAttachment/hasComment changes are not reflected.
Feat(engine) : User task api provide comment and attachment properties
related to GIT Issue : #2404