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

Unable to detect page copy event when copying page without children

linnn aung October 15, 2019

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
Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 17, 2019

@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

linnn aung October 17, 2019

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

Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 18, 2019

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

linnn aung October 21, 2019
Like Shannon S likes this
Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 22, 2019

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
AUG Leaders

Atlassian Community Events