You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by rw...@apache.org on 2010/02/19 20:23:11 UTC
svn commit: r911946 - in /portals/jetspeed-2/portal/trunk/components:
jetspeed-page-layout/src/main/java/org/apache/jetspeed/layout/impl/
jetspeed-portal/src/test/java/org/apache/jetspeed/services/rest/
Author: rwatler
Date: Fri Feb 19 19:23:11 2010
New Revision: 911946
URL: http://svn.apache.org/viewvc?rev=911946&view=rev
Log:
change '.' content fragment id separator to '$'
Modified:
portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/layout/impl/PageLayoutComponentImpl.java
portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/services/rest/TestPageLayoutService.java
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/layout/impl/PageLayoutComponentImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/layout/impl/PageLayoutComponentImpl.java?rev=911946&r1=911945&r2=911946&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/layout/impl/PageLayoutComponentImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/layout/impl/PageLayoutComponentImpl.java Fri Feb 19 19:23:11 2010
@@ -73,6 +73,8 @@
{
private static final Logger log = LoggerFactory.getLogger(PageLayoutComponentImpl.class);
+ public static final String CONTENT_FRAGMENT_ID_SEPARATOR = "$"; // javascript identifier safe separator
+
private PageManager pageManager;
/**
@@ -152,7 +154,7 @@
contentFragmentImpl.setLayoutColumn(null, null, column);
}
pageRootContentFragmentImpl.getFragments().add(contentFragmentImpl);
- String newContentFragmentId = pageRootContentFragmentImpl.getId()+"."+contentFragmentImpl.getFragment().getId();
+ String newContentFragmentId = pageRootContentFragmentImpl.getId()+CONTENT_FRAGMENT_ID_SEPARATOR+contentFragmentImpl.getFragment().getId();
contentFragmentImpl.setId(newContentFragmentId);
return contentFragmentImpl;
}
@@ -489,7 +491,7 @@
// update content context
fromContentFragmentImpl.removeFragmentById(fragmentId);
toContentFragmentImpl.getFragments().add(contentFragmentImpl);
- String newContentFragmentId = toContentFragmentImpl.getId()+"."+contentFragmentImpl.getFragment().getId();
+ String newContentFragmentId = toContentFragmentImpl.getId()+CONTENT_FRAGMENT_ID_SEPARATOR+contentFragmentImpl.getFragment().getId();
contentFragmentImpl.setId(newContentFragmentId);
}
catch (Exception e)
@@ -1693,7 +1695,7 @@
{
// construct content fragment to reflect fragment hierarchy
Fragment fragmentFragment = (Fragment)fragment;
- contentFragmentId = ((parentId != null) ? parentId+"."+fragmentFragment.getId() : fragmentFragment.getId());
+ contentFragmentId = ((parentId != null) ? parentId+CONTENT_FRAGMENT_ID_SEPARATOR+fragmentFragment.getId() : fragmentFragment.getId());
contentFragmentImpl = newContentFragment(contentFragmentId, page, fragmentDefinitions, definition, fragmentFragment, null, null, locked);
// set content fragment attributes
mergeContentFragmentAttributes(contentFragmentImpl, fragmentFragment);
@@ -1704,14 +1706,14 @@
{
// consume page fragment and build fragment hierarchy from page
PageFragment pageFragmentFragment = (PageFragment)fragment;
- contentFragmentId = ((parentId != null) ? parentId+"."+pageFragmentFragment.getId() : pageFragmentFragment.getId());
+ contentFragmentId = ((parentId != null) ? parentId+CONTENT_FRAGMENT_ID_SEPARATOR+pageFragmentFragment.getId() : pageFragmentFragment.getId());
BaseFragmentElement pageRootFragment = page.getRootFragment();
if (pageRootFragment instanceof FragmentReference)
{
// consume top level page fragment reference and build fragment
// hierarchy from referenced fragment
FragmentReference fragmentReferenceFragment = (FragmentReference)pageRootFragment;
- contentFragmentId += "."+fragmentReferenceFragment.getId();
+ contentFragmentId += CONTENT_FRAGMENT_ID_SEPARATOR+fragmentReferenceFragment.getId();
Fragment [] fragmentFragment = new Fragment[]{null};
contentFragmentImpl = newContentFragment(contentFragmentId, page, fragmentDefinitions, page, fragmentReferenceFragment, fragmentFragment);
// inherit page fragment attributes
@@ -1727,7 +1729,7 @@
{
// construct content fragment to reflect page fragment hierarchy
Fragment fragmentFragment = (Fragment)pageRootFragment;
- contentFragmentId += "."+fragmentFragment.getId();
+ contentFragmentId += CONTENT_FRAGMENT_ID_SEPARATOR+fragmentFragment.getId();
contentFragmentImpl = newContentFragment(contentFragmentId, page, fragmentDefinitions, page, fragmentFragment, null, null, false);
// inherit page fragment attributes
mergeContentFragmentAttributes(contentFragmentImpl, pageFragmentFragment);
@@ -1742,7 +1744,7 @@
// consume fragment reference and build fragment hierarchy from
// referenced fragment
FragmentReference fragmentReferenceFragment = (FragmentReference)fragment;
- contentFragmentId = ((parentId != null) ? parentId+"."+fragmentReferenceFragment.getId() : fragmentReferenceFragment.getId());
+ contentFragmentId = ((parentId != null) ? parentId+CONTENT_FRAGMENT_ID_SEPARATOR+fragmentReferenceFragment.getId() : fragmentReferenceFragment.getId());
Fragment [] fragmentFragment = new Fragment[]{null};
contentFragmentImpl = newContentFragment(contentFragmentId, page, fragmentDefinitions, definition, fragmentReferenceFragment, fragmentFragment);
// inherit fragment reference attributes
@@ -1774,7 +1776,7 @@
if ((fragmentDefinition != null) && (fragmentDefinition.getRootFragment() instanceof Fragment))
{
fragmentFragment[0] = (Fragment)fragmentDefinition.getRootFragment();
- String contentFragmentId = parentId+"."+fragmentFragment[0].getId();
+ String contentFragmentId = parentId+CONTENT_FRAGMENT_ID_SEPARATOR+fragmentFragment[0].getId();
return newContentFragment(contentFragmentId, page, fragmentDefinitions, fragmentDefinition, fragmentFragment[0], definition, fragmentReference, true);
}
return null;
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/services/rest/TestPageLayoutService.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/services/rest/TestPageLayoutService.java?rev=911946&r1=911945&r2=911946&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/services/rest/TestPageLayoutService.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/services/rest/TestPageLayoutService.java Fri Feb 19 19:23:11 2010
@@ -31,6 +31,7 @@
import org.apache.jetspeed.components.portletregistry.PortletRegistry;
import org.apache.jetspeed.layout.PageLayoutComponent;
import org.apache.jetspeed.layout.impl.LayoutValve;
+import org.apache.jetspeed.layout.impl.PageLayoutComponentImpl;
import org.apache.jetspeed.mocks.ResourceLocatingServletContext;
import org.apache.jetspeed.om.page.ContentFragment;
import org.apache.jetspeed.om.page.ContentPage;
@@ -52,7 +53,6 @@
import org.jmock.core.Constraint;
import org.jmock.core.InvocationMatcher;
import org.jmock.core.constraint.IsEqual;
-import org.jmock.core.constraint.IsInstanceOf;
import org.jmock.core.matcher.InvokeAtLeastOnceMatcher;
import org.jmock.core.stub.ReturnStub;
@@ -70,6 +70,7 @@
*/
public class TestPageLayoutService extends JetspeedTestCase
{
+ private static final String CFIS = PageLayoutComponentImpl.CONTENT_FRAGMENT_ID_SEPARATOR;
private ComponentManager cm;
@@ -176,28 +177,28 @@
ContentPage page = layoutManager.newContentPage(grid, null, null);
rc.setPage(page);
- ContentFragmentBean cfb = pageLayoutService.moveContentFragment(request, null, "dp-0.dp-00", null, null, "1", "0", null, null, null, null, null);
- assertEquals(cfb.getId(), "dp-0.dp-00");
+ ContentFragmentBean cfb = pageLayoutService.moveContentFragment(request, null, "dp-0"+CFIS+"dp-00", null, null, "1", "0", null, null, null, null, null);
+ assertEquals(cfb.getId(), "dp-0"+CFIS+"dp-00");
assertEquals(cfb.getProperties().get("column"), "0");
assertEquals(cfb.getProperties().get("row"), "1");
- cfb = pageLayoutService.moveContentFragment(request, null, "dp-0.dp-02", null, "right", null, null, null, null, null, null, null);
- assertEquals(cfb.getId(), "dp-0.dp-02");
+ cfb = pageLayoutService.moveContentFragment(request, null, "dp-0"+CFIS+"dp-02", null, "right", null, null, null, null, null, null, null);
+ assertEquals(cfb.getId(), "dp-0"+CFIS+"dp-02");
assertEquals(cfb.getProperties().get("column"), "1");
assertEquals(cfb.getProperties().get("row"), "2");
- cfb = pageLayoutService.moveContentFragment(request, null, "dp-0.dp-02", null, "down", null, null, null, null, null, null, null);
- assertEquals(cfb.getId(), "dp-0.dp-02");
+ cfb = pageLayoutService.moveContentFragment(request, null, "dp-0"+CFIS+"dp-02", null, "down", null, null, null, null, null, null, null);
+ assertEquals(cfb.getId(), "dp-0"+CFIS+"dp-02");
assertEquals(cfb.getProperties().get("column"), "1");
assertEquals(cfb.getProperties().get("row"), "3");
- cfb = pageLayoutService.moveContentFragment(request, null, "dp-0.dp-02", null, "up", null, null, null, null, null, null, null);
- assertEquals(cfb.getId(), "dp-0.dp-02");
+ cfb = pageLayoutService.moveContentFragment(request, null, "dp-0"+CFIS+"dp-02", null, "up", null, null, null, null, null, null, null);
+ assertEquals(cfb.getId(), "dp-0"+CFIS+"dp-02");
assertEquals(cfb.getProperties().get("column"), "1");
assertEquals(cfb.getProperties().get("row"), "2");
- cfb = pageLayoutService.moveContentFragment(request, null, "dp-0.dp-02", null, "left", null, null, null, null, null, null, null);
- assertEquals(cfb.getId(), "dp-0.dp-02");
+ cfb = pageLayoutService.moveContentFragment(request, null, "dp-0"+CFIS+"dp-02", null, "left", null, null, null, null, null, null, null);
+ assertEquals(cfb.getId(), "dp-0"+CFIS+"dp-02");
assertEquals(cfb.getProperties().get("column"), "0");
assertEquals(cfb.getProperties().get("row"), "2");
@@ -214,8 +215,8 @@
ContentPage page = layoutManager.newContentPage(grid, null, null);
rc.setPage(page);
- ContentFragmentBean cfb = pageLayoutService.moveContentFragment(request, null, "dp-0.dp-10", "detach", null, null, null, "491.0", "14.0", null, null, null);
- assertEquals(cfb.getId(), "dp-0.dp-10");
+ ContentFragmentBean cfb = pageLayoutService.moveContentFragment(request, null, "dp-0"+CFIS+"dp-10", "detach", null, null, null, "491.0", "14.0", null, null, null);
+ assertEquals(cfb.getId(), "dp-0"+CFIS+"dp-10");
assertEquals(cfb.getProperties().get("column"), "1");
assertEquals(cfb.getProperties().get("row"), "3");
assertEquals(cfb.getProperties().get("x"), "491.0");
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org