Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,446
Community Members
 
Community Events
176
Community Groups

pageManager.trashPage() not working properly when called from inside a schedule job.

Hello,

I have a scheduled job (<job-config>) implemented inside our inhouse developed Confluence Plugin.

Inside this job, I am trying to delete a page using pageManager.trashPage(page, DefaultDeleteContext.DEFAULT).

This line of code works perfectly from inside any other class but it is not working properly from inside the scheduled job. When called from inside the scheduled job, the pageManager.trashPage() function deletes the page from all the search functionalities but I can still see it on the UI (I can still visit the page and see it in the tree of the space).

In addition, after calling pageManager.trashPage() on the page, If we try to search for all the pages on the space using the REST API (/rest/api/content/search) or using the JAVA API (cqlSearchService.searchContent(cql, pageRequest)), the aforementioned page is not returned with the results of the search.

Did anyone face this kind of behavior or does anyone know what could be causing this problem?

Thank you,

1 answer

Hi @Elie Chidiac

I had exactly the same problem. You can solve it by using the TransactionTemplate and executing the code of your job within a transaction.

For example:

public JobRunnerResponse runJob(JobRunnerRequest request) {
return transactionTemplate.execute(() -> {

...

pageManager.trashPage(page, DefaultDeleteContext.DEFAULT);

...

return JobRunnerResponse.success();
});
}

 

Best regards

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events