-
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?
Changes from 1 commit
d744faa
e9bd295
7f9ba41
998f8a2
5fd4d3c
d3b33d7
76a428d
3ea772d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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): There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sumankumarpani, the ticket was initially reported for There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. ❌ In all OpenAPI files, hasAttachment/hasComment changes are not reflected. |
yanavasileva marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -44,6 +44,7 @@ | |||||
import org.camunda.bpm.engine.task.Task; | ||||||
import org.camunda.bpm.engine.task.TaskQuery; | ||||||
import org.camunda.bpm.engine.variable.type.ValueType; | ||||||
import org.camunda.bpm.engine.impl.history.HistoryLevel; | ||||||
|
||||||
/** | ||||||
* @author Joram Barrez | ||||||
|
@@ -175,6 +176,7 @@ public class TaskQueryImpl extends AbstractQuery<TaskQuery, Task> implements Tas | |||||
// or query ///////////////////////////// | ||||||
protected List<TaskQueryImpl> queries = new ArrayList<>(Arrays.asList(this)); | ||||||
protected boolean isOrQueryActive = false; | ||||||
protected boolean withCommentAttachmentInfo = false; | ||||||
|
||||||
public TaskQueryImpl() { | ||||||
} | ||||||
|
@@ -1088,6 +1090,12 @@ protected boolean hasExcludingConditions() { | |||||
|| CompareUtil.elementIsNotContainedInArray(processInstanceBusinessKey, processInstanceBusinessKeys); | ||||||
} | ||||||
|
||||||
@Override | ||||||
public TaskQuery withCommentAttachmentInfo() { | ||||||
this.withCommentAttachmentInfo = true; | ||||||
return this; | ||||||
} | ||||||
|
||||||
public List<String> getCandidateGroups() { | ||||||
if (cachedCandidateGroups != null) { | ||||||
return cachedCandidateGroups; | ||||||
|
@@ -1441,6 +1449,13 @@ public List<Task> executeList(CommandContext commandContext, Page page) { | |||||
} | ||||||
} | ||||||
|
||||||
if (withCommentAttachmentInfo && Context.getProcessEngineConfiguration().getHistoryLevel()!= HistoryLevel.HISTORY_LEVEL_NONE) { | ||||||
yanavasileva marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❌ Use equals to compare:
Suggested change
|
||||||
for (Task task : taskList) { | ||||||
// verify attachment and comments exists for the task | ||||||
((TaskEntity) task).initializeAttachmentAndComments(); | ||||||
} | ||||||
} | ||||||
|
||||||
return taskList; | ||||||
} | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -158,6 +158,8 @@ public class TaskEntity extends AbstractVariableScope implements Task, DelegateT | |||||||||||
protected boolean isFormKeyInitialized = false; | ||||||||||||
protected String formKey; | ||||||||||||
protected CamundaFormRef camundaFormRef; | ||||||||||||
protected boolean attachmentExists; | ||||||||||||
protected boolean commentExists; | ||||||||||||
|
||||||||||||
@SuppressWarnings({ "unchecked" }) | ||||||||||||
protected transient VariableStore<VariableInstanceEntity> variableStore | ||||||||||||
|
@@ -1451,6 +1453,10 @@ public void initializeFormKey() { | |||||||||||
} | ||||||||||||
} | ||||||||||||
} | ||||||||||||
public void initializeAttachmentAndComments(){ | ||||||||||||
this.attachmentExists = !getProcessEngine().getTaskService().getTaskAttachments(id).isEmpty(); | ||||||||||||
this.commentExists = !getProcessEngine().getTaskService().getTaskComments(id).isEmpty(); | ||||||||||||
Comment on lines
+1457
to
+1458
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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):
Suggested change
|
||||||||||||
} | ||||||||||||
yanavasileva marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
|
||||||||||||
@Override | ||||||||||||
public String getFormKey() { | ||||||||||||
|
@@ -1758,7 +1764,14 @@ public void bpmnError(String errorCode, String errorMessage, Map<String, Object> | |||||||||||
throw ProcessEngineLogger.CMD_LOGGER.exceptionBpmnErrorPropagationFailed(errorCode, ex); | ||||||||||||
} | ||||||||||||
} | ||||||||||||
|
||||||||||||
@Override | ||||||||||||
public boolean getAttachments() { | ||||||||||||
return attachmentExists; | ||||||||||||
} | ||||||||||||
@Override | ||||||||||||
public boolean getComments() { | ||||||||||||
return commentExists; | ||||||||||||
} | ||||||||||||
yanavasileva marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
public void escalation(String escalationCode, Map<String, Object> variables) { | ||||||||||||
ensureTaskActive(); | ||||||||||||
ActivityExecution activityExecution = getExecution(); | ||||||||||||
|
yanavasileva marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1104,4 +1104,9 @@ public interface TaskQuery extends Query<TaskQuery, Task> { | |
* this exception, {@link #or()} must be invoked first. | ||
*/ | ||
TaskQuery endOr(); | ||
|
||
/** | ||
* Evaluates existence of attachment and comments associated with the task, defaults to false. | ||
*/ | ||
Comment on lines
+1108
to
+1110
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
TaskQuery withCommentAttachmentInfo(); | ||
yanavasileva marked this conversation as resolved.
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.
❌ Please add performance considerations to the description. 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.