Skip to content
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 4046 : Persist taskState/lifeCycleState & return in get task and get history task api #4218

Open
wants to merge 38 commits into
base: master
Choose a base branch
from

Conversation

jyotisahu9
Copy link

Git issue : #4046
Camunda forum issue : https://forum.camunda.io/t/task-state-in-camunda-7-vs-camunda-8/48746/3
Persist task state & update Get task & Get Tasks (Historic) api's to return task state.

@CLAassistant
Copy link

CLAassistant commented Mar 22, 2024

CLA assistant check
All committers have signed the CLA.

…-enhancement

Signed-off-by: Sahu, Jyoti <Jyoti.Sahu@fmr.com>
@yanavasileva
Copy link
Member

Hi @jyotisahu9 ,

Thank you for raising this.
We will have a look at it and get back to you.

Best,
Yana

@jyotisahu9
Copy link
Author

Hi @yanavasileva ,

Did you get a chance to review the code changes.

Thanks,
Jyoti

@yanavasileva
Copy link
Member

Hi @jyotisahu9, I will need more time to review the PR as the change is not trivial.
Please stay tuned and thank you for your patience in advance.

Copy link
Member

@yanavasileva yanavasileva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Overall you covered a lot of the changes in the first run, that's great! Nice work.
🔧 Could you please remove the GIT Issue line from the comments and the javadoc. With the modern IDE and github features, tracking the commit, the PR, and the issue is easier so I think it's redundant.
I left comments for what's missing or can be improved. Please have a look.

Thank you for your patience for the review.

engine/src/main/java/org/camunda/bpm/engine/task/Task.java Outdated Show resolved Hide resolved
Comment on lines 200 to 204
public static final String TASK_STATE_INIT = "Init";
public static final String TASK_STATE_CREATED = "Created";
public static final String TASK_STATE_COMPLETED = "Completed";
public static final String TASK_STATE_DELETED = "Deleted";
public static final String TASK_STATE_UPDATED = "Updated";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Let's rename the existing TaskState enum to LifecycleState to be more explicit what is it about and create a new TaskState enum to contain those states.
❓ Is it possible to extend and reuse the existing TaskState enum? Will require avoiding handling of the new "Updated" state.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the logic to use existing taskState enum, additionally did some changes in enum itself to retain required taskstate text in DB. I have removed extra code related to previous implemented taskState like constants and new method.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 It's great that you managed to reuse the lifecycle state.
It's a bit pity that we can't simply extend it and persist it for your purposes. 🤔 Maybe you can give it another thought if that's possible without breaking the existing functionality. As the only difference is the updated state between lifecycle and newly introduced task state, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to persist lifecycle state instead of taskState but then it saves values like STATE_CREATED, STATE_COMPLETED etc. in db. I can't change it existing value as its been used extensively in current logic, so I am trying to persist taskState but its using existing enum.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Missing test cases:

  • for runtime task - init?, created, updated
  • for historic task - init?, updated, deleted
  • failure during local run: HistoricTaskInstanceTest.testHistoricTaskInstance:94 expected:<[Cre]ated> but was:<[Upd]ated>

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incorporated changes related to all points mentioned in comment.
Its not possible to cover init state as the object is in INIT state and then it immediately goes in CREATED state, so haven't been able to cover it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to return the PR to adjust test cases for the runtime tasks (created, updated). Please see my latest comments.

@jyotisahu9
Copy link
Author

👍 Overall you covered a lot of the changes in the first run, that's great! Nice work. 🔧 Could you please remove the GIT Issue line from the comments and the javadoc. With the modern IDE and github features, tracking the commit, the PR, and the issue is easier so I think it's redundant. I left comments for what's missing or can be improved. Please have a look.

Thank you for your patience for the review.

Thanks @yanavasileva for your review comments. I am going through them and would do the needful.

danielkelemen and others added 14 commits April 17, 2024 12:40
* set false as default value for initializeTelemetry and switch to primitive
* engine tests: test default value
* LoginIT: remove telemetry close modal
* initializeTelemetryProperty: add null check

related to camunda#4167
Related to camunda#3848

Co-authored-by: Daniel Kelemen <danielkelemen@users.noreply.github.com>
@brianwarner brianwarner force-pushed the git-issue-4046-get-task-api-lifecyclestate-enhancement branch from 2d38833 to c7f927c Compare May 7, 2024 14:41
@jyotisahu9
Copy link
Author

Hi @yanavasileva,

Latest code changes for review comments have been pushed. I have resolved few of the review conversation, for few I have added my comments and it can be closed once you are good with them.

Please review the code whenever you get a chance and let me know in case of any issues.

Thanks,
Jyoti

@yanavasileva
Copy link
Member

@jyotisahu9, thank you for considering my input. I will have a look at made changes and get back to you next week.

@yanavasileva
Copy link
Member

👍 Overall the changes look good, I want to have a look again at the tests, then I will merge the PR.

@jyotisahu9
Copy link
Author

jyotisahu9 commented May 23, 2024

Hi @yanavasileva,

Sql script corrections are banked. Request you to review them and merge the PR.

Thanks,
Jyoti

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to return the PR to adjust test cases for the runtime tasks (created, updated). Please see my latest comments.

Copy link
Member

@yanavasileva yanavasileva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests need to be modified.
Please note, that I am not able to commit to your branch/fork, so I can't do the changes on my own.

@jyotisahu9
Copy link
Author

The tests need to be modified. Please note, that I am not able to commit to your branch/fork, so I can't do the changes on my own.

Hi @yanavasileva ,

I went through the review comment. Do you want me to just remove the assertion from HistoricTaskInstanceTest file ?

Thanks,
Jyoti

@yanavasileva
Copy link
Member

Hi Jyoti,

Do you want me to just remove the assertion from HistoricTaskInstanceTest file ?

No. Beside the suggested removal of the assertion, I expect to add similar test assertion for runtime tasks where the state is created and updated. I suggest to add the assertions to TaskServiceTest.

Best,
Yana

@jyotisahu9
Copy link
Author

Hi @yanavasileva ,

Pushed the test case review comments fixes.
Please review and merge the PR

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet