It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Unable to detect page copy event when copying page without children

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

1 answer

0 votes

@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_Spaniol

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?

Regards,

Shannon

Like Shannon_Spaniol likes this

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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

How is your team having fun and bonding, remotely, utilizing Confluence?

Thanks everyone for answering last week’s question. The winner of the random drawing from those who commented is: @LarryBrock I’ll contact you separately with your prize details. This wee...

314 views 9 7
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you