The following code works when copying pages with hierarchy or children.EventListenerpublic void on PageStartCopyEvent(CopyPageHierarchyStartEvent startCopy){log.warn("----page start copy event----");Page page = startCopy.getPage();ContentId pageId = page.getContentId();}EventListenerpublic void onPageCopyEvent(PageCopyEvent copiedPage){log.warn("----page copied event----");Page page = copiedPage.getPage();ContentId pageId = page.getContentId();}EventListenerpublic 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.@EventListenerpublic void onPageCreatEvent(PageCreateEvent createdPage){log.warn("-----page created event----");Page page = createdPage.getTargetPage();ContentId pageId = page.getContentId();}Followed by ContentUpdateEvent@EventListenerpublic 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
The following code works when copying pages with hierarchy or children.EventListenerpublic void on PageStartCopyEvent(CopyPageHierarchyStartEvent startCopy){log.warn("----page start copy event----");Page page = startCopy.getPage();ContentId pageId = page.getContentId();}EventListenerpublic void onPageCopyEvent(PageCopyEvent copiedPage){log.warn("----page copied event----");Page page = copiedPage.getPage();ContentId pageId = page.getContentId();}EventListenerpublic 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.@EventListenerpublic void onPageCreatEvent(PageCreateEvent createdPage){log.warn("-----page created event----");Page page = createdPage.getTargetPage();ContentId pageId = page.getContentId();}
Followed by ContentUpdateEvent
@EventListenerpublic 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
@linnn aung,
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
@Shannon S
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.
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?
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 .
It looks like you're new here. Sign in or register to get started.