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 2009/11/18 19:24:53 UTC
svn commit: r881862 [4/16] - in /portals/jetspeed-2/portal/trunk: ./
applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/
applications/jetspeed/src/main/webapp/WEB-INF/templates/
applications/jetspeed/src/main/webapp/decorations/layout/greenearth/ ...
Copied: portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentFragmentImpl.java (from r830800, portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java)
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentFragmentImpl.java?p2=portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentFragmentImpl.java&p1=portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java&r1=830800&r2=881862&rev=881862&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentFragmentImpl.java Wed Nov 18 18:24:48 2009
@@ -5,883 +5,1048 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-package org.apache.jetspeed.om.page;
-
-import java.io.Serializable;
-import java.util.Collection;
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.om.page.impl;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
import java.util.Map;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.apache.jetspeed.aggregator.PortletContent;
import org.apache.jetspeed.decoration.Decoration;
-import org.apache.jetspeed.om.common.SecurityConstraint;
-import org.apache.jetspeed.om.common.SecurityConstraints;
-import org.apache.jetspeed.page.impl.DatabasePageManagerUtils;
+import org.apache.jetspeed.layout.PageLayoutComponent;
+import org.apache.jetspeed.layout.impl.PageLayoutComponentUtils;
+import org.apache.jetspeed.om.page.BaseFragmentElement;
+import org.apache.jetspeed.om.page.ContentFragment;
+import org.apache.jetspeed.om.page.Page;
+import org.apache.jetspeed.om.preference.FragmentPreference;
+import org.apache.pluto.container.PortletPreference;
-public class ContentFragmentImpl implements ContentFragment
-{
-
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
- private final Fragment fragment;
- private StringBuffer overridenContent;
- private PortletContent portletContent;
- private List contentFragments;
+/**
+ * Immutable content fragment implementation.
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+public class ContentFragmentImpl implements ContentFragment, PageLayoutComponentUtils
+{
private static final Logger log = LoggerFactory.getLogger(ContentFragmentImpl.class);
- private final Map cachedFragments;
- private Decoration decoration;
+
+ private PageLayoutComponent pageLayoutComponent;
+ private String id;
+ private Page page;
+ private BaseFragmentElement fragment;
private boolean instantlyRendered;
+ private StringBuffer overriddenContent;
+ private PortletContent portletContent;
+ private Decoration decoration;
+
+ private String decorator;
+ private Map properties;
+ private List fragments;
+ private String mode;
+ private String name;
+ private List preferences;
+ private String shortTitle;
+ private String skin;
+ private String state;
+ private String title;
+ private String type;
- public ContentFragmentImpl(Fragment fragment, Map cachedFragments)
+ /**
+ * Construct new dynamic content fragment with
+ * a transiently computed id.
+ */
+ public ContentFragmentImpl()
{
- this(fragment, cachedFragments, false);
+ this.id = Integer.toHexString(System.identityHashCode(this));
}
-
- public ContentFragmentImpl(Fragment fragment, Map cachedFragments, boolean instantlyRendered)
+
+ /**
+ * Construct new dynamic content fragment.
+ *
+ * @param id content fragment id
+ */
+ public ContentFragmentImpl(String id)
{
- this.fragment = fragment;
- this.cachedFragments = cachedFragments;
+ this.id = id;
+ }
+
+ /**
+ * Construct new dynamic content fragment with rendering flag.
+ *
+ * @param id content fragment id
+ * @param instantlyRendered rendering flag
+ */
+ public ContentFragmentImpl(String id, boolean instantlyRendered)
+ {
+ this.id = id;
this.instantlyRendered = instantlyRendered;
}
+ /**
+ * Construct new content fragment with PSML fragment.
+ *
+ * @param pageLayoutComponent PageLayoutComponent instance
+ * @param id content fragment id
+ * @param page PSML page
+ * @param fragment PSML fragment
+ */
+ public ContentFragmentImpl(PageLayoutComponent pageLayoutComponent, String id, Page page, BaseFragmentElement fragment)
+ {
+ this.pageLayoutComponent = pageLayoutComponent;
+ this.id = id;
+ this.page = page;
+ this.fragment = fragment;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.page.ContentFragment#checkAccess(java.lang.String)
+ */
+ public void checkAccess(String actions) throws SecurityException
+ {
+ // check access against underlying fragment
+ if (fragment != null)
+ {
+ fragment.checkAccess(actions);
+ }
+ }
+
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.ContentFragment#getContentFragments()
+ * @see org.apache.jetspeed.om.page.ContentFragment#isInstantlyRendered()
+ */
+ public boolean isInstantlyRendered()
+ {
+ return instantlyRendered;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
*/
- public List getContentFragments()
- {
- if(contentFragments == null)
+ public boolean equals(Object o)
+ {
+ if (o instanceof ContentFragmentImpl)
{
- contentFragments = new ContentFragmentList();
+ ContentFragmentImpl cfi = (ContentFragmentImpl)o;
+ return (((id == null) && (cfi.id == null)) || ((id != null) && id.equals(cfi.id)));
}
- return contentFragments;
+ return false;
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.ContentFragment#getFragments()
+ * @see org.apache.jetspeed.om.page.ContentFragment#getDecoration()
*/
- public List getFragments()
+ public Decoration getDecoration()
{
- return getContentFragments();
+ return decoration;
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.ContentFragment#getOverriddenContent()
+ * @see org.apache.jetspeed.om.page.ContentFragment#getDecorator()
*/
- public String getOverriddenContent()
+ public String getDecorator()
{
- return overridenContent != null ? overridenContent.toString() : null;
+ return decorator;
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.ContentFragment#getRenderedContent()
+ * @see org.apache.jetspeed.om.page.ContentFragment#getFloatProperty(java.lang.String)
*/
- public String getRenderedContent() throws IllegalStateException
- {
- if(overridenContent != null)
- {
- return overridenContent.toString();
- }
-
-
- if (portletContent != null)
- {
- //TODO are you sure? Intellij warns, synchronization on a non-final field is
- //unlikely to have useful semantics.
- synchronized (portletContent)
- {
- if (portletContent.isComplete())
- {
- return portletContent.getContent();
- }
- else
- {
- try
- {
- log.debug("Waiting on content for Fragment " + getId());
- portletContent.wait();
- return portletContent.getContent();
- }
- catch (InterruptedException e)
- {
- return e.getMessage();
- }
- finally
- {
- log.debug("Been notified that Faragment " + getId() + " is complete");
- }
- }
- }
- }
- else
+ public float getFloatProperty(String propName)
+ {
+ String propValue = (String)getProperties().get(propName);
+ if (propValue != null)
{
- throw new IllegalStateException("You cannot invoke getRenderedContent() until the content has been set.");
+ return Float.parseFloat(propValue);
}
+ return -1.0F;
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.ContentFragment#overrideRenderedContent(java.lang.String)
+ * @see org.apache.jetspeed.om.page.ContentFragment#getFragments()
*/
- public void overrideRenderedContent(String contnent)
+ public List getFragments()
{
- if ( contnent != null )
+ if (fragments == null)
{
- if(overridenContent == null)
- {
- overridenContent = new StringBuffer();
- }
- // prevent repeated storing of the same error message
- if (!contnent.equals(overridenContent.toString()))
- {
- overridenContent.append(contnent);
- }
+ fragments = new ArrayList();
}
-
+ return fragments;
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.ContentFragment#setPortletContent(org.apache.jetspeed.aggregator.PortletContent)
+ * @see org.apache.jetspeed.om.page.ContentFragment#getId()
*/
- public void setPortletContent(PortletContent portletContent)
+ public String getId()
{
- this.portletContent = portletContent;
+ return id;
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#getDecorator()
+ * @see org.apache.jetspeed.om.page.ContentFragment#getIntProperty(java.lang.String)
*/
- public String getDecorator()
+ public int getIntProperty(String propName)
{
-
- return fragment.getDecorator();
+ String propValue = (String)getProperties().get(propName);
+ if (propValue != null)
+ {
+ return Integer.parseInt(propValue);
+ }
+ return -1;
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#getName()
+ * @see org.apache.jetspeed.om.page.ContentFragment#getLayoutColumn()
*/
- public String getName()
+ public int getLayoutColumn()
{
-
- return fragment.getName();
+ return getIntProperty(COLUMN_PROPERTY_NAME);
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#getProperties()
+ * @see org.apache.jetspeed.om.page.ContentFragment#getLayoutHeight()
*/
- public Map getProperties()
+ public float getLayoutHeight()
{
-
- return fragment.getProperties();
+ return getFloatProperty(HEIGHT_PROPERTY_NAME);
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#getProperty(java.lang.String)
+ * @see org.apache.jetspeed.om.page.ContentFragment#getLayoutRow()
*/
- public String getProperty(String propName)
+ public int getLayoutRow()
{
-
- return fragment.getProperty(propName);
+ return getIntProperty(ROW_PROPERTY_NAME);
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#getIntProperty(java.lang.String)
+ * @see org.apache.jetspeed.om.page.ContentFragment#getLayoutSizes()
*/
- public int getIntProperty(String propName)
+ public String getLayoutSizes()
{
-
- return fragment.getIntProperty(propName);
+ return getProperty(SIZES_PROPERTY_NAME);
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#getFloatProperty(java.lang.String)
+ * @see org.apache.jetspeed.om.page.ContentFragment#getLayoutWidth()
*/
- public float getFloatProperty(String propName)
+ public float getLayoutWidth()
{
-
- return fragment.getFloatProperty(propName);
+ return getFloatProperty(WIDTH_PROPERTY_NAME);
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#getSkin()
+ * @see org.apache.jetspeed.om.page.ContentFragment#getLayoutX()
*/
- public String getSkin()
+ public float getLayoutX()
{
-
- return fragment.getSkin();
+ return getFloatProperty(X_PROPERTY_NAME);
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#getState()
+ * @see org.apache.jetspeed.om.page.ContentFragment#getLayoutY()
*/
- public String getState()
+ public float getLayoutY()
{
-
- return fragment.getState();
+ return getFloatProperty(Y_PROPERTY_NAME);
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#getMode()
+ * @see org.apache.jetspeed.om.page.ContentFragment#getLayoutZ()
*/
- public String getMode()
+ public float getLayoutZ()
{
-
- return fragment.getMode();
+ return getFloatProperty(Z_PROPERTY_NAME);
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#getType()
+ * @see org.apache.jetspeed.om.page.ContentFragment#getMode()
*/
- public String getType()
+ public String getMode()
{
-
- return fragment.getType();
+ return mode;
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#isReference()
+ * @see org.apache.jetspeed.om.page.ContentFragment#getName()
*/
- public boolean isReference()
+ public String getName()
{
-
- return fragment.isReference();
+ return name;
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#setDecorator(java.lang.String)
+ * @see org.apache.jetspeed.om.page.ContentFragment#getOverriddenContent()
*/
- public void setDecorator(String decoratorName)
+ public String getOverriddenContent()
{
-
- fragment.setDecorator(decoratorName);
+ return ((overriddenContent != null) ? overriddenContent.toString() : null);
}
-
+
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#setName(java.lang.String)
+ * @see org.apache.jetspeed.om.page.ContentFragment#getPageLayoutComponent()
*/
- public void setName(String name)
+ public PageLayoutComponent getPageLayoutComponent()
{
-
- fragment.setName(name);
+ return pageLayoutComponent;
}
-
+
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#getLayoutRow()
+ * @see org.apache.jetspeed.om.page.ContentFragment#getPortletContent()
*/
- public int getLayoutRow()
+ public PortletContent getPortletContent()
{
- return fragment.getLayoutRow();
+ return this.portletContent;
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#getLayoutColumn()
+ * @see org.apache.jetspeed.om.page.ContentFragment#getPreferences()
*/
- public int getLayoutColumn()
+ public List getPreferences()
{
- return fragment.getLayoutColumn();
+ if (preferences == null)
+ {
+ preferences = new ArrayList();
+ }
+ return preferences;
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#getLayoutSizes()
+ * @see org.apache.jetspeed.om.page.ContentFragment#getProperties()
*/
- public String getLayoutSizes()
+ public Map getProperties()
{
- return fragment.getLayoutSizes();
+ if (properties == null)
+ {
+ properties = new HashMap();
+ }
+ return properties;
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#getLayoutX()
+ * @see org.apache.jetspeed.om.page.ContentFragment#getProperty(java.lang.String)
*/
- public float getLayoutX()
+ public String getProperty(String propName)
{
- return fragment.getLayoutX();
+ return (String)getProperties().get(propName);
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#getLayoutY()
+ * @see org.apache.jetspeed.om.page.ContentFragment#getRenderedContent()
*/
- public float getLayoutY()
- {
- return fragment.getLayoutY();
+ public String getRenderedContent() throws IllegalStateException
+ {
+ if (overriddenContent != null)
+ {
+ return overriddenContent.toString();
+ }
+
+ if (portletContent != null)
+ {
+ synchronized (portletContent)
+ {
+ if (portletContent.isComplete())
+ {
+ return portletContent.getContent();
+ }
+ else
+ {
+ try
+ {
+ log.debug("Waiting on content for Fragment " + getId());
+ portletContent.wait();
+ return portletContent.getContent();
+ }
+ catch (InterruptedException e)
+ {
+ return e.getMessage();
+ }
+ finally
+ {
+ log.debug("Been notified that Faragment " + getId() + " is complete");
+ }
+ }
+ }
+ }
+ else
+ {
+ throw new IllegalStateException("You cannot invoke getRenderedContent() until the content has been set.");
+ }
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#getLayoutZ()
+ * @see org.apache.jetspeed.om.page.ContentFragment#getShortTitle()
*/
- public float getLayoutZ()
+ public String getShortTitle()
{
- return fragment.getLayoutZ();
+ return shortTitle;
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#getLayoutWidth()
+ * @see org.apache.jetspeed.om.page.ContentFragment#getSkin()
*/
- public float getLayoutWidth()
+ public String getSkin()
{
- return fragment.getLayoutWidth();
+ return skin;
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#getLayoutHeight()
+ * @see org.apache.jetspeed.om.page.ContentFragment#getState()
*/
- public float getLayoutHeight()
+ public String getState()
{
- return fragment.getLayoutHeight();
+ return state;
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#setLayoutRow(int)
+ * @see org.apache.jetspeed.om.page.ContentFragment#getTitle()
*/
- public void setLayoutRow(int row)
+ public String getTitle()
{
- fragment.setLayoutRow(row);
+ return title;
}
-
+
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#setLayoutColumn(int)
+ * @see org.apache.jetspeed.om.page.ContentFragment#getType()
*/
- public void setLayoutColumn(int column)
+ public String getType()
{
- fragment.setLayoutColumn(column);
+ return type;
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#setLayoutSizes(java.lang.String)
+ * @see java.lang.Object#hashCode()
*/
- public void setLayoutSizes(String sizes)
+ public int hashCode()
{
- fragment.setLayoutSizes(sizes);
+ return ((id != null) ? id.hashCode() : 0);
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#setLayoutX(float)
+ * @see org.apache.jetspeed.om.page.ContentFragment#overrideRenderedContent(java.lang.String)
*/
- public void setLayoutX(float x)
+ public void overrideRenderedContent(String content)
{
- fragment.setLayoutX(x);
+ if ( content != null )
+ {
+ if (overriddenContent == null)
+ {
+ overriddenContent = new StringBuffer();
+ }
+ // prevent repeated storing of the same error message
+ if (!content.equals(overriddenContent.toString()))
+ {
+ overriddenContent.append(content);
+ }
+ }
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#setLayoutY(float)
+ * @see org.apache.jetspeed.om.page.ContentFragment#setDecoration(org.apache.jetspeed.decoration.Decoration)
*/
- public void setLayoutY(float y)
+ public void setDecoration(Decoration decoration)
{
- fragment.setLayoutY(y);
+ this.decoration = decoration;
}
-
+
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#setLayoutZ(float)
+ * @see org.apache.jetspeed.om.page.ContentFragment#setPortletContent(org.apache.jetspeed.aggregator.PortletContent)
*/
- public void setLayoutZ(float z)
+ public void setPortletContent(PortletContent portletContent)
{
- fragment.setLayoutZ(z);
- }
+ this.portletContent = portletContent;
+ }
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#setLayoutWidth(float)
+ * @see org.apache.jetspeed.om.page.ContentFragment#addPortlet(java.lang.String, java.lang.String, int, int)
*/
- public void setLayoutWidth(float width)
+ public ContentFragment addPortlet(String type, String name, int row, int column)
{
- fragment.setLayoutWidth(width);
+ if (pageLayoutComponent != null)
+ {
+ // delegate to page layout component
+ return pageLayoutComponent.addPortlet(this, type, name, row, column);
+ }
+ else
+ {
+ // perform locally only
+ ContentFragmentImpl newContentFragmentImpl = new ContentFragmentImpl();
+ newContentFragmentImpl.setType(type);
+ newContentFragmentImpl.setType(name);
+ if (!Utils.isNull(row))
+ {
+ newContentFragmentImpl.setLayoutRow(row);
+ }
+ if (!Utils.isNull(column))
+ {
+ newContentFragmentImpl.setLayoutColumn(column);
+ }
+ getFragments().add(newContentFragmentImpl);
+ return newContentFragmentImpl;
+ }
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#setLayoutHeight(float)
+ * @see org.apache.jetspeed.om.page.ContentFragment#addPortlet(java.lang.String, java.lang.String)
*/
- public void setLayoutHeight(float height)
+ public ContentFragment addPortlet(String type, String name)
{
- fragment.setLayoutHeight(height);
+ if (pageLayoutComponent != null)
+ {
+ // delegate to page layout component
+ return pageLayoutComponent.addPortlet(this, type, name);
+ }
+ else
+ {
+ // perform locally only
+ ContentFragmentImpl newContentFragmentImpl = new ContentFragmentImpl();
+ newContentFragmentImpl.setType(type);
+ newContentFragmentImpl.setType(name);
+ getFragments().add(newContentFragmentImpl);
+ return newContentFragmentImpl;
+ }
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#setSkin(java.lang.String)
+ * @see org.apache.jetspeed.om.page.ContentFragment#updateDecorator(java.lang.String)
*/
- public void setSkin(String skinName)
+ public void updateDecorator(String decoratorName)
{
-
- fragment.setSkin(skinName);
+ if (pageLayoutComponent != null)
+ {
+ // delegate to page layout component
+ pageLayoutComponent.updateDecorator(this, decoratorName);
+ }
+ else
+ {
+ // perform locally only
+ decoratorName = (!Utils.isNull(decoratorName) ? decoratorName : null);
+ setDecorator(decoratorName);
+ }
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#setState(java.lang.String)
+ * @see org.apache.jetspeed.om.page.ContentFragment#updateName(java.lang.String)
*/
- public void setState(String state)
+ public void updateName(String name)
{
-
- fragment.setState(state);
- }
+ if (pageLayoutComponent != null)
+ {
+ // delegate to page layout component
+ pageLayoutComponent.updateName(this, name);
+ }
+ else
+ {
+ // perform locally only
+ setName(name);
+ }
+ }
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#setMode(java.lang.String)
+ * @see org.apache.jetspeed.om.page.ContentFragment#updatePosition(float, float, float, float, float)
*/
- public void setMode(String mode)
+ public void updatePosition(float x, float y, float z, float width, float height)
{
-
- fragment.setMode(mode);
+ if (pageLayoutComponent != null)
+ {
+ // delegate to page layout component
+ pageLayoutComponent.updatePosition(this, x, y, z, width, height);
+ }
+ else
+ {
+ // perform locally only
+ if (!Utils.isNull(x))
+ {
+ setLayoutX(x);
+ }
+ if (!Utils.isNull(y))
+ {
+ setLayoutY(y);
+ }
+ if (!Utils.isNull(z))
+ {
+ setLayoutZ(z);
+ }
+ if (!Utils.isNull(width))
+ {
+ setLayoutWidth(width);
+ }
+ if (!Utils.isNull(height))
+ {
+ setLayoutWidth(height);
+ }
+ }
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#setType(java.lang.String)
+ * @see org.apache.jetspeed.om.page.ContentFragment#updatePreferences(java.util.Map)
*/
- public void setType(String type)
+ public void updatePreferences(Map preferences)
{
-
- fragment.setType(type);
+ if (pageLayoutComponent != null)
+ {
+ // delegate to page layout component
+ pageLayoutComponent.updatePreferences(this, preferences);
+ }
+ else
+ {
+ // perform locally only
+ setPreferences(preferences);
+ }
}
-
+
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.BaseElement#getId()
+ * @see org.apache.jetspeed.om.page.ContentFragment#updateRowColumn(int, int)
*/
- public String getId()
+ public void updateRowColumn(int row, int column)
{
-
- return fragment.getId();
+ if (pageLayoutComponent != null)
+ {
+ // delegate to page layout component
+ pageLayoutComponent.updateRowColumn(this, row, column);
+ }
+ else
+ {
+ // perform locally only
+ if (!Utils.isNull(row))
+ {
+ setLayoutRow(row);
+ }
+ if (!Utils.isNull(column))
+ {
+ setLayoutColumn(column);
+ }
+ }
}
-
+
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.BaseElement#getShortTitle()
+ * @see org.apache.jetspeed.om.page.ContentFragment#updateStateMode(java.lang.String, java.lang.String)
*/
- public String getShortTitle()
+ public void updateStateMode(String portletState, String portletMode)
{
-
- return fragment.getShortTitle();
+ if (pageLayoutComponent != null)
+ {
+ // delegate to page layout component
+ pageLayoutComponent.updateStateMode(this, portletState, portletMode);
+ }
+ else
+ {
+ // perform locally only
+ if (!Utils.isNull(portletState))
+ {
+ setState(portletState);
+ }
+ if (!Utils.isNull(portletMode))
+ {
+ setMode(portletMode);
+ }
+ }
}
- /* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.BaseElement#getTitle()
+ /**
+ * Get content fragment by id.
+ *
+ * @param id content fragment id
+ * @return content fragment
*/
- public String getTitle()
+ public ContentFragment getFragmentById(String id)
{
-
- return fragment.getTitle();
+ if (getId().equals(id))
+ {
+ return this;
+ }
+ Iterator fragmentIter = getFragments().iterator();
+ while (fragmentIter.hasNext())
+ {
+ ContentFragmentImpl childFragment = (ContentFragmentImpl)fragmentIter.next();
+ ContentFragment fragment = childFragment.getFragmentById(id);
+ if (fragment != null)
+ {
+ return fragment;
+ }
+ }
+ return null;
}
- /* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#setId(java.lang.String)
+ /**
+ * Get content fragment nesting level.
+ *
+ * @param fragmentId fragment id to find
+ * @param level nesting level fragment
+ * @return nesting level or -1 if not found
*/
- public void setId(String fragmentId)
+ public int getFragmentNestingLevel(String fragmentId, int level)
{
- // cannot set fragment id from content fragment
+ if (fragmentId.equals(id))
+ {
+ return level;
+ }
+ int childLevel = level+1;
+ Iterator fragmentIter = getFragments().iterator();
+ while (fragmentIter.hasNext())
+ {
+ ContentFragmentImpl childFragment = (ContentFragmentImpl)fragmentIter.next();
+ int fragmentNestingLevel = childFragment.getFragmentNestingLevel(fragmentId, childLevel);
+ if (fragmentNestingLevel != -1)
+ {
+ return fragmentNestingLevel;
+ }
+ }
+ return -1;
}
- /* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.BaseElement#setShortTitle(java.lang.String)
+ /**
+ * Get all content fragments with name.
+ *
+ * @param name content fragment name
+ * @return list of content fragments
*/
- public void setShortTitle(String title)
+ public List getFragmentsByName(String name)
{
-
- fragment.setShortTitle(title);
+ List fragments = null;
+ if (getName().equals(name))
+ {
+ if (fragments == null)
+ {
+ fragments = new ArrayList();
+ }
+ fragments.add(this);
+ }
+ Iterator fragmentIter = getFragments().iterator();
+ while (fragmentIter.hasNext())
+ {
+ ContentFragmentImpl childFragment = (ContentFragmentImpl)fragmentIter.next();
+ List childFragments = childFragment.getFragmentsByName(name);
+ if (childFragments != null)
+ {
+ if (fragments == null)
+ {
+ fragments = childFragments;
+ }
+ else
+ {
+ fragments.addAll(childFragments);
+ }
+ }
+ }
+ return fragments;
}
-
- /* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.BaseElement#setTitle(java.lang.String)
+
+ /**
+ * Get content fragment PSML page.
+ *
+ * @return the page
*/
- public void setTitle(String title)
+ public Page getPage()
{
-
- fragment.setTitle(title);
+ return page;
}
- /* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#checkAccess(java.lang.String)
+ /**
+ * Get content fragment PSML fragment.
+ *
+ * @return the fragment
*/
- public void checkAccess(String actions) throws SecurityException
+ public BaseFragmentElement getFragment()
{
-
- fragment.checkAccess(actions);
+ return fragment;
}
- /* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#checkConstraints(java.lang.String)
+ /**
+ * Initialize content fragment.
+ *
+ * @param pageLayoutComponent PageLayoutComponent instance
+ * @param page PSML page
+ * @param fragment PSML fragment
*/
- public void checkConstraints(String actions) throws SecurityException
+ public void initialize(PageLayoutComponent pageLayoutComponent, Page page, BaseFragmentElement fragment)
{
-
- fragment.checkConstraints(actions);
+ this.pageLayoutComponent = pageLayoutComponent;
+ this.page = page;
+ this.fragment = fragment;
}
- /* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#checkPermissions(int)
+ /**
+ * Remove content fragment by id.
+ *
+ * @param id content fragment id
+ * @return content fragment
*/
- public void checkPermissions(int mask) throws SecurityException
+ public ContentFragment removeFragmentById(String id)
{
-
- fragment.checkPermissions(mask);
+ ContentFragment removed = null;
+ Iterator fragmentIter = getFragments().iterator();
+ while ((removed == null) && fragmentIter.hasNext())
+ {
+ ContentFragmentImpl childFragment = (ContentFragmentImpl)fragmentIter.next();
+ if (childFragment.getId().equals(id))
+ {
+ fragmentIter.remove();
+ removed = childFragment;
+ }
+ else
+ {
+ removed = childFragment.removeFragmentById(id);
+ }
+ }
+ return removed;
}
- /* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#getConstraintsEnabled()
+ /**
+ * Set content fragment decorator.
+ *
+ * @param decorator the decorator to set
*/
- public boolean getConstraintsEnabled()
+ public void setDecorator(String decorator)
{
-
- return fragment.getConstraintsEnabled();
+ this.decorator = decorator;
}
- /* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#getPermissionsEnabled()
+ /**
+ * Set int property.
+ *
+ * @param name property name
+ * @param value int property value
*/
- public boolean getPermissionsEnabled()
+ public void setIntProperty(String name, int value)
{
-
- return fragment.getPermissionsEnabled();
+ if (value >= 0)
+ {
+ getProperties().put(name, String.valueOf(value));
+ }
+ else
+ {
+ getProperties().remove(name);
+ }
}
- /* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#getSecurityConstraints()
+ /**
+ * Set float property.
+ *
+ * @param name property name
+ * @param value float property value
*/
- public SecurityConstraints getSecurityConstraints()
+ public void setFloatProperty(String name, float value)
{
-
- return fragment.getSecurityConstraints();
+ if (value >= 0)
+ {
+ getProperties().put(name, String.valueOf(value));
+ }
+ else
+ {
+ getProperties().remove(name);
+ }
}
- /* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraints()
+ /**
+ * Set layout column property.
+ *
+ * @param column column property value
*/
- public SecurityConstraints newSecurityConstraints()
+ public void setLayoutColumn(int column)
{
-
- return fragment.newSecurityConstraints();
+ setIntProperty(COLUMN_PROPERTY_NAME, column);
}
- /* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraint()
+ /**
+ * Set layout height property.
+ *
+ * @param height height property value
*/
- public SecurityConstraint newSecurityConstraint()
+ public void setLayoutHeight(float height)
{
-
- return fragment.newSecurityConstraint();
+ setFloatProperty(HEIGHT_PROPERTY_NAME, height);
}
- /* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#setSecurityConstraints(org.apache.jetspeed.om.common.SecurityConstraints)
+ /**
+ * Set layout row property.
+ *
+ * @param row row property value
*/
- public void setSecurityConstraints(SecurityConstraints constraints)
+ public void setLayoutRow(int row)
{
- fragment.setSecurityConstraints(constraints);
+ setIntProperty(ROW_PROPERTY_NAME, row);
}
-
-
+
/**
- * Checks the ContentFragment cache for a ContentFragment
- * that matches the <code>Id</code> of this fragment. If
- * one is found, it returned. If no matches are found, a new
- * <code>ContentFragment</code> represnentive of the {@link Fragment}
- * argument is subsequently created, stored into the cahce and returned.
+ * Set layout width property.
*
- * @param f
- * @return ContentFrament
+ * @param width width property value
*/
- protected ContentFragment getContentFragment(Fragment f)
+ public void setLayoutWidth(float width)
{
- ContentFragment cf;
- if(cachedFragments.containsKey(f.getId()))
- {
- cf = (ContentFragment) cachedFragments.get(f.getId());
- }
- else
- {
- cf = new ContentFragmentImpl(f, cachedFragments);
- cachedFragments.put(f.getId(), cf);
- }
- return cf;
+ setFloatProperty(WIDTH_PROPERTY_NAME, width);
}
-
-
- protected final class ContentFragmentList implements List, Serializable
- {
- private List baseList = fragment.getFragments();
-
- /* (non-Javadoc)
- * @see java.util.List#add(int, java.lang.Object)
- */
- public void add(int index, Object element)
- {
- if (element instanceof ContentFragmentImpl)
- element = ((ContentFragmentImpl)element).fragment;
- baseList.add(index, element);
- }
-
- /* (non-Javadoc)
- * @see java.util.List#add(java.lang.Object)
- */
- public boolean add(Object o)
- {
- if (o instanceof ContentFragmentImpl)
- o = ((ContentFragmentImpl)o).fragment;
- return baseList.add(o);
- }
-
- /* (non-Javadoc)
- * @see java.util.List#addAll(int, java.util.Collection)
- */
- public boolean addAll(int index, Collection c)
- {
-
- return baseList.addAll(index, c);
- }
-
- /* (non-Javadoc)
- * @see java.util.List#addAll(java.util.Collection)
- */
- public boolean addAll(Collection c)
- {
-
- return baseList.addAll(c);
- }
-
- /* (non-Javadoc)
- * @see java.util.List#clear()
- */
- public void clear()
- {
-
- baseList.clear();
- }
-
- /* (non-Javadoc)
- * @see java.util.List#contains(java.lang.Object)
- */
- public boolean contains(Object o)
- {
-
- return baseList.contains(o);
- }
-
- /* (non-Javadoc)
- * @see java.util.List#containsAll(java.util.Collection)
- */
- public boolean containsAll(Collection c)
- {
-
- return baseList.containsAll(c);
- }
-
- /* (non-Javadoc)
- * @see java.util.List#equals(java.lang.Object)
- */
- public boolean equals(Object o)
- {
-
- return baseList.equals(o);
- }
-
- /* (non-Javadoc)
- * @see java.util.List#get(int)
- */
- public Object get(int index)
- {
- Fragment f= (Fragment) baseList.get(index);
- return getContentFragment(f);
- }
-
- /* (non-Javadoc)
- * @see java.util.List#hashCode()
- */
- public int hashCode()
- {
-
- return baseList.hashCode();
- }
-
- /* (non-Javadoc)
- * @see java.util.List#indexOf(java.lang.Object)
- */
- public int indexOf(Object o)
- {
-
- return baseList.indexOf(o);
- }
-
- /* (non-Javadoc)
- * @see java.util.List#isEmpty()
- */
- public boolean isEmpty()
- {
-
- return baseList.isEmpty();
- }
-
- /* (non-Javadoc)
- * @see java.util.List#iterator()
- */
- public Iterator iterator()
- {
- return duplicateList().iterator();
- }
-
- /* (non-Javadoc)
- * @see java.util.List#lastIndexOf(java.lang.Object)
- */
- public int lastIndexOf(Object o)
- {
-
- return baseList.lastIndexOf(o);
- }
-
- /* (non-Javadoc)
- * @see java.util.List#listIterator()
- */
- public ListIterator listIterator()
- {
- return duplicateList().listIterator();
- }
-
- /* (non-Javadoc)
- * @see java.util.List#listIterator(int)
- */
- public ListIterator listIterator(int index)
- {
- return duplicateList().listIterator(index);
- }
-
- /* (non-Javadoc)
- * @see java.util.List#remove(int)
- */
- public Object remove(int index)
- {
-
- return baseList.remove(index);
- }
- /* (non-Javadoc)
- * @see java.util.List#remove(java.lang.Object)
- */
- public boolean remove(Object o)
- {
-
- return baseList.remove(o);
- }
-
- /* (non-Javadoc)
- * @see java.util.List#removeAll(java.util.Collection)
- */
- public boolean removeAll(Collection c)
- {
-
- return baseList.removeAll(c);
- }
-
- /* (non-Javadoc)
- * @see java.util.List#retainAll(java.util.Collection)
- */
- public boolean retainAll(Collection c)
- {
-
- return baseList.retainAll(c);
- }
-
- /* (non-Javadoc)
- * @see java.util.List#set(int, java.lang.Object)
- */
- public Object set(int index, Object element)
- {
-
- return baseList.set(index, element);
- }
-
- /* (non-Javadoc)
- * @see java.util.List#size()
- */
- public int size()
- {
-
- return baseList.size();
- }
-
- /* (non-Javadoc)
- * @see java.util.List#subList(int, int)
- */
- public List subList(int fromIndex, int toIndex)
- {
- return duplicateList().subList(fromIndex, toIndex);
- }
-
-
-
- /* (non-Javadoc)
- * @see java.util.List#toArray()
- */
- public Object[] toArray()
- {
- return duplicateList().toArray();
- }
+ /**
+ * Set layout x property.
+ *
+ * @param x x property value
+ */
+ public void setLayoutX(float x)
+ {
+ setFloatProperty(X_PROPERTY_NAME, x);
+ }
- /* (non-Javadoc)
- * @see java.util.List#toArray(java.lang.Object[])
- */
- public Object[] toArray(Object[] a)
- {
- return duplicateList().toArray(a);
- }
-
- private List duplicateList()
- {
- List rFragList = DatabasePageManagerUtils.createList();
- for(int i=0; i < baseList.size(); i++)
- {
- Fragment f = (Fragment)baseList.get(i);
- ContentFragment cf = getContentFragment(f);
- rFragList.add(cf);
- }
- return rFragList;
- }
-
-
+ /**
+ * Set layout y property.
+ *
+ * @param y y property value
+ */
+ public void setLayoutY(float y)
+ {
+ setFloatProperty(Y_PROPERTY_NAME, y);
+ }
+ /**
+ * Set layout z property.
+ *
+ * @param z z property value
+ */
+ public void setLayoutZ(float z)
+ {
+ setFloatProperty(Z_PROPERTY_NAME, z);
}
- /* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#getPreferences()
+ /**
+ * Set content fragment mode.
+ *
+ * @param mode the mode to set
*/
- public List getPreferences()
+ public void setMode(String mode)
{
- return fragment.getPreferences();
+ this.mode = mode;
}
- public Decoration getDecoration()
+ /**
+ * Set content fragment name.
+ *
+ * @param name the name to set
+ */
+ public void setName(String name)
{
- return decoration;
+ this.name = name;
}
- /* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.Fragment#setPreferences(java.util.List)
+ /**
+ * Set preferences with new preferences set, accepting
+ * Map of strings, string arrays, FragmentPreference or
+ * PortletPreference.
+ *
+ * @param preferences map of new preferences set.
+ */
+ public void setPreferences(Map preferences)
+ {
+ this.preferences.clear();
+ if (preferences != null)
+ {
+ Iterator preferencesIter = preferences.entrySet().iterator();
+ while (preferencesIter.hasNext())
+ {
+ Map.Entry preferencesEntry = (Map.Entry)preferencesIter.next();
+ String name = (String)preferencesEntry.getKey();
+ Object values = preferencesEntry.getValue();
+ ContentFragmentPreferenceImpl preference = null;
+ if (values instanceof String)
+ {
+ preference = new ContentFragmentPreferenceImpl(name, false, Arrays.asList(new String[]{(String)values}));
+ }
+ else if (values instanceof String [])
+ {
+ preference = new ContentFragmentPreferenceImpl(name, false, Arrays.asList((String [])values));
+ }
+ else if (values instanceof FragmentPreference)
+ {
+ FragmentPreference fragmentPreference = (FragmentPreference)values;
+ preference = new ContentFragmentPreferenceImpl(name, fragmentPreference.isReadOnly(), fragmentPreference.getValueList());
+ }
+ else if (values instanceof PortletPreference)
+ {
+ PortletPreference portletPreference = (PortletPreference)values;
+ preference = new ContentFragmentPreferenceImpl(name, portletPreference.isReadOnly(), Arrays.asList(portletPreference.getValues()));
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unexpected preference value type");
+ }
+ this.preferences.add(preference);
+ }
+ }
+ }
+
+ /**
+ * Set content fragment short title.
+ *
+ * @param shortTitle the shortTitle to set
*/
- public void setPreferences(List preferences)
+ public void setShortTitle(String shortTitle)
{
- fragment.setPreferences(preferences);
+ this.shortTitle = shortTitle;
}
+ /**
+ * Set content fragment skin.
+ *
+ * @param skin the skin to set
+ */
+ public void setSkin(String skin)
+ {
+ this.skin = skin;
+ }
- public void setDecoration(Decoration decoration)
+ /**
+ * Set content fragment state.
+ *
+ * @param state the state to set
+ */
+ public void setState(String state)
{
- this.decoration = decoration;
-
+ this.state = state;
}
-
- /* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.ContentFragment#isInstantlyRendered()
+
+ /**
+ * Set content fragment title.
+ *
+ * @param title the title to set
*/
- public boolean isInstantlyRendered()
+ public void setTitle(String title)
{
- return this.instantlyRendered;
+ this.title = title;
}
- public PortletContent getPortletContent()
+ /**
+ * Set content fragment type.
+ *
+ * @param type the type to set
+ */
+ public void setType(String type)
{
- return this.portletContent;
+ this.type = type;
}
+ /**
+ * Set content fragment id.
+ *
+ * @param id the id to set
+ */
+ public void setId(String id)
+ {
+ this.id = id;
+ }
}
+
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentFragmentImpl.java
------------------------------------------------------------------------------
cvs2svn:cvs-rev = 1.1
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentFragmentImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentFragmentImpl.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentFragmentImpl.java
------------------------------------------------------------------------------
svn:mergeinfo =
Added: portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentFragmentPreferenceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentFragmentPreferenceImpl.java?rev=881862&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentFragmentPreferenceImpl.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentFragmentPreferenceImpl.java Wed Nov 18 18:24:48 2009
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.om.page.impl;
+
+import java.util.List;
+
+import org.apache.jetspeed.om.preference.FragmentPreference;
+
+/**
+ * Immutable content fragment preferences element implementation.
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id:$
+ */
+public class ContentFragmentPreferenceImpl implements FragmentPreference
+{
+ private String name;
+ private boolean readOnly;
+ private List valueList;
+
+ /**
+ * Construct content fragment preferences element.
+ *
+ * @param name preference name
+ * @param readOnly preference read only flag
+ * @param valueList preference values list
+ */
+ public ContentFragmentPreferenceImpl(String name, boolean readOnly, List valueList)
+ {
+ this.name = name;
+ this.readOnly = readOnly;
+ this.valueList = valueList;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.preference.FragmentPreference#getName()
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.preference.FragmentPreference#getValueList()
+ */
+ public List getValueList()
+ {
+ return valueList;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.preference.FragmentPreference#isReadOnly()
+ */
+ public boolean isReadOnly()
+ {
+ return readOnly;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.preference.FragmentPreference#setName(java.lang.String)
+ */
+ public void setName(String name)
+ {
+ throw new UnsupportedOperationException("FragmentPreference.setName()");
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.preference.FragmentPreference#setReadOnly(boolean)
+ */
+ public void setReadOnly(boolean readOnly)
+ {
+ throw new UnsupportedOperationException("FragmentPreference.setReadOnly()");
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.preference.FragmentPreference#setValueList(java.util.List)
+ */
+ public void setValueList(List values)
+ {
+ throw new UnsupportedOperationException("FragmentPreference.setValueList()");
+ }
+}
Added: portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentGenericMetadataImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentGenericMetadataImpl.java?rev=881862&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentGenericMetadataImpl.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentGenericMetadataImpl.java Wed Nov 18 18:24:48 2009
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.om.page.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Locale;
+
+import org.apache.jetspeed.om.portlet.GenericMetadata;
+import org.apache.jetspeed.om.portlet.GenericMetadataImpl;
+import org.apache.jetspeed.om.portlet.LocalizedField;
+
+/**
+ * Immutable content metadata implementation.
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id:$
+ */
+public class ContentGenericMetadataImpl extends GenericMetadataImpl implements GenericMetadata
+{
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.portlet.GenericMetadata#addField(java.util.Locale, java.lang.String, java.lang.String)
+ */
+ public void addField(Locale locale, String name, String value)
+ {
+ throw new UnsupportedOperationException("GenericMetadata.addField()");
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.portlet.GenericMetadata#addField(org.apache.jetspeed.om.portlet.LocalizedField)
+ */
+ public void addField(LocalizedField field)
+ {
+ throw new UnsupportedOperationException("GenericMetadata.addField()");
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.portlet.GenericMetadata#copyFields(java.util.Collection)
+ */
+ public void copyFields(Collection fields)
+ {
+ throw new UnsupportedOperationException("GenericMetadata.copyFields()");
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.portlet.GenericMetadata#createLocalizedField()
+ */
+ public LocalizedField createLocalizedField()
+ {
+ throw new UnsupportedOperationException("GenericMetadata.createLocalizedField()");
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.portlet.GenericMetadataImpl#getFields()
+ */
+ public Collection getFields()
+ {
+ Collection fields = super.getFields();
+ if (fields == null)
+ {
+ fields = new ArrayList();
+ super.setFields(fields);
+ }
+ return fields;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.portlet.GenericMetadata#setFields(java.lang.String, java.util.Collection)
+ */
+ public void setFields(String name, Collection values)
+ {
+ throw new UnsupportedOperationException("GenericMetadata.setFields()");
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.portlet.GenericMetadata#setFields(java.util.Collection)
+ */
+ public void setFields(Collection fields)
+ {
+ throw new UnsupportedOperationException("GenericMetadata.setFields()");
+ }
+}
Added: portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentLocalizedFieldImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentLocalizedFieldImpl.java?rev=881862&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentLocalizedFieldImpl.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentLocalizedFieldImpl.java Wed Nov 18 18:24:48 2009
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.om.page.impl;
+
+import java.util.Locale;
+
+import org.apache.jetspeed.om.portlet.LocalizedField;
+
+/**
+ * Immutable content metadata localized field implementation.
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id:$
+ */
+public class ContentLocalizedFieldImpl implements LocalizedField
+{
+ private Locale locale;
+ private String name;
+ private String value;
+
+ /**
+ * Construct content metadata localized field.
+ *
+ * @param locale field locale
+ * @param name field name
+ * @param value field value
+ */
+ public ContentLocalizedFieldImpl(Locale locale, String name, String value)
+ {
+ this.locale = locale;
+ this.name = name;
+ this.value = value;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.portlet.LocalizedField#getLocale()
+ */
+ public Locale getLocale()
+ {
+ return locale;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.portlet.LocalizedField#getName()
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.portlet.LocalizedField#getValue()
+ */
+ public String getValue()
+ {
+ return value;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.portlet.LocalizedField#setLocale(java.util.Locale)
+ */
+ public void setLocale(Locale locale)
+ {
+ throw new UnsupportedOperationException("LocalizedField.setLocale()");
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.portlet.LocalizedField#setName(java.lang.String)
+ */
+ public void setName(String name)
+ {
+ throw new UnsupportedOperationException("LocalizedField.setName()");
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.portlet.LocalizedField#setValue(java.lang.String)
+ */
+ public void setValue(String value)
+ {
+ throw new UnsupportedOperationException("LocalizedField.setValue()");
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org