Bug 916260

Summary: Unable to clone page (PageService) in a different destination
Product: [JBoss] JBoss Enterprise Portal Platform 6 Reporter: William Antônio <wsiqueir>
Component: PortalAssignee: Default User <jbpapp-maint>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0.0CC: bdawidow, dpospisi, epp-bugs, mweiler
Target Milestone: ER03   
Target Release: 6.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-07 14:21:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
A simple maven project to build a reproducer. It's needed to add the corresponding JPP JARS to build it.
none
Reproducer portlet none

Description William Antônio 2013-02-27 16:29:58 UTC
Created attachment 703533 [details]
A simple maven project to build a reproducer. It's needed to add the corresponding JPP JARS to build it.

Description of problem:

In the PageManagement service, when I clone a page to a different destination, I received an exception: 

"Could not clone page " + dst.name + "to existing page " + dst.site.getType() + " with id " + dst.site.getName());

I have a look at the implementation, I find a typo mistake on line 273 of class org.exoplatform.portal.mop.page.PageServiceImpl:

org.gatein.mop.api.workspace.Page dstRoot = srcSite.getRootPage();

It should be :

org.gatein.mop.api.workspace.Page dstRoot = dstSite.getRootPage();


How reproducible:

See attached portlet. The following code should reproduce it:

ExoContainer exo = ExoContainerContext.getCurrentContainer();
PageService pageService = ((PageService) exo
		.getComponentInstanceOfType(PageService.class));
SiteKey siteKey = new SiteKey(SiteType.GROUP, "/platform/users");
PageKey pageKey = new PageKey(siteKey, "NewClonedPage");
PageKey srcPage = new PageKey(siteKey, "homepage");
pageService.clone(srcPage, pageKey);


Steps to Reproduce:
1. Download the attached portlet and set the classpath to include JPP artifacts as well;
2. Build it and deploy to JPP;
3. Register the portlet in "Application Registry";
4. Create a new page and add then portlet to it. Access the page;
  
Actual results:

An exception is thrown saying the page doesn't exist.

Expected results:

It should clone the page.

Additional info:

It happens when we attempt to clone the page from another location (see the code above). It tries to clone the page

Comment 1 Boleslaw Dawidowicz 2013-04-17 07:34:30 UTC
Looks like this has been fixed upstream already according to JIRA. Needs verification

Comment 2 Martin Weiler 2013-05-07 13:33:14 UTC
The reproducer portlet has the following error:
SiteKey siteKey = new SiteKey(SiteType.GROUP, "/platform/users");

should be replaced by:
SiteKey siteKey = new SiteKey(SiteType.PORTAL, "classic");

otherwise the portlet fails to find the src page.

Comment 3 Martin Weiler 2013-05-07 14:47:37 UTC
Created attachment 744777 [details]
Reproducer portlet

Attaching a fixed version of the reproducer. The key is to create a cloned page with the same name, but in a different destination folder:

			SiteKey srcSiteKey = new SiteKey(SiteType.PORTAL, "classic");
			PageKey srcPage = new PageKey(srcSiteKey, "homepage");
			
			// destination
			SiteKey dstSiteKey = new SiteKey(SiteType.GROUP, "/platform/users");
			
			pageService.clone(srcPage, dstSiteKey.page(srcPage.getName()));
			output = "Page " + srcPage + " cloned with success to " + dstSiteKey;

Note that you can only successfully invoke the portlet once.

Comment 5 Dominik Pospisil 2013-08-01 12:26:51 UTC
Verified using above reproducer (ER3).