The following code works when copying pages with hierarchy or children.
@EventListener
public void on PageStartCopyEvent(CopyPageHierarchyStartEvent startCopy)
{
log.warn("----page start copy event----");
Page page = startCopy.getPage();
ContentId pageId = page.getContentId();
}
@EventListener
public void onPageCopyEvent(PageCopyEvent copiedPage)
{
log.warn("----page copied event----");
Page page = copiedPage.getPage();
ContentId pageId = page.getContentId();
}
@EventListener
public void onPageFinishCopyEvent(CopyPageHierarchyFinishEvent finishCopy)
{
log.warn("----page finish copy event----");
Page page = finishCopy.getTargetPage();
ContentId pageId = page.getContentId();
}However, when copying page without children, the following events are triggered.
@EventListener
public void onPageCreatEvent(PageCreateEvent createdPage)
{
log.warn("-----page created event----");
Page page = createdPage.getTargetPage();
ContentId pageId = page.getContentId();
}Followed by ContentUpdateEvent
@EventListener
public void onContentUpdatedEvent(ContentUpdatedEvent updatedContent)
{
log.warn("----content updated event----");
ContentId pageId = updatedContent.getContentId();
}
Unfortunately, both PageCreateEvent & ContentUpdatedEvent share page creation and page copy. I need away to differentiate between copy and create. Is there any events that I could refer to? Thank you
Welcome to Atlassian Community! It's great to have you join us.
Could you let us know exactly what you're trying to do in Confluence? Can you tell us where you found the snippet you are referencing?
If you have questions about developing for Confluence, I would recommend reaching out on our Atlassian Developer Community, as they may be better suited to assist you.
Regards,
Shannon
Thank you.
(1) I'm trying to listen page events for my add-Ons that syn with custom system.
In other words, Whenever page copy events happened, I needed info about that copied page (for example, page property that I created before copied. Once page is copied, it didn't carry along add-ons page property that you created).
EventListener triggers when copying page with children or hierarchy.
However, when copying page without children or hierarchy, it falls into the category of page creation events. I needed to differentiate between create and copy though technically, they are the same.
(2) I wrote it. You can check on java docs for specific events.
(3) Yes, I have posted as well on Atlassian Developer Community.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @linnn aung,
Thank you for confirming. If this is for an add-on you're writing, then the Dev community is the right place for that.
Can you share with us the link to the question in case anyone wants to follow the progress there?
Regards,
Shannon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Shannon Spaniol,
Here is the link that I posted in atlas developer community https://community.developer.atlassian.com/t/unable-to-detect-page-copy-event-when-copying-page-without-children/32680 .
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Linnn, thank you for sharing that!
Hopefully they will be able to give you some good advice there. :)
Take care, and have a pleasant week.
Regards,
Shannon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.