portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r911258 - in /portals/jetspeed-2/portal/trunk: components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/layout/impl/ components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ jetspeed-api/src/main/java/org/apa...
Date Thu, 18 Feb 2010 06:10:54 GMT
Author: rwatler
Date: Thu Feb 18 06:10:53 2010
New Revision: 911258

URL: http://svn.apache.org/viewvc?rev=911258&view=rev
Log:
add ContentFragment read/write access to underlying SecurityConstraints via PageLayoutComponent

Added:
    portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentSecurityConstraint.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentSecurityConstraints.java
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-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentFragmentImpl.java
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/layout/PageLayoutComponent.java
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/page/ContentFragment.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=911258&r1=911257&r2=911258&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
Thu Feb 18 06:10:53 2010
@@ -31,6 +31,8 @@
 import org.apache.jetspeed.page.PageNotFoundException;
 import org.apache.jetspeed.page.PageNotRemovedException;
 import org.apache.jetspeed.page.PageNotUpdatedException;
+import org.apache.jetspeed.om.common.SecurityConstraint;
+import org.apache.jetspeed.om.common.SecurityConstraints;
 import org.apache.jetspeed.om.folder.Folder;
 import org.apache.jetspeed.om.page.BaseFragmentElement;
 import org.apache.jetspeed.om.page.BaseFragmentsElement;
@@ -51,6 +53,8 @@
 import org.apache.jetspeed.om.page.impl.ContentFragmentPropertyImpl;
 import org.apache.jetspeed.om.page.impl.ContentLocalizedFieldImpl;
 import org.apache.jetspeed.om.page.impl.ContentPageImpl;
+import org.apache.jetspeed.om.page.impl.ContentSecurityConstraint;
+import org.apache.jetspeed.om.page.impl.ContentSecurityConstraints;
 import org.apache.jetspeed.om.portlet.LocalizedField;
 import org.apache.jetspeed.om.preference.FragmentPreference;
 import org.apache.jetspeed.page.document.NodeException;
@@ -1355,6 +1359,86 @@
     }
 
     /* (non-Javadoc)
+     * @see org.apache.jetspeed.layout.PageLayoutComponent#updateSecurityConstraints(org.apache.jetspeed.om.page.ContentFragment,
org.apache.jetspeed.om.common.SecurityConstraints)
+     */
+    public void updateSecurityConstraints(ContentFragment contentFragment, SecurityConstraints
constraints)
+    {
+        log.debug("PageLayoutComponentImpl.updateSecurityConstraints() invoked");
+        try
+        {
+            // validate content fragment
+            ContentFragmentImpl contentFragmentImpl = (ContentFragmentImpl)contentFragment;
+            boolean contentFragmentDefinitionIsPage = ((contentFragmentImpl.getDefinition()
instanceof BaseConcretePageElement) && contentFragmentImpl.getDefinition().getPath().equals(contentFragmentImpl.getPage().getPath()));
+            if (!contentFragmentDefinitionIsPage && (contentFragmentImpl.getReference()
== null))
+            {
+                throw new IllegalArgumentException("Only page fragments and fragment references
are mutable");
+            }
+            
+            // retrieve current fragment and page from page manager
+            BaseConcretePageElement page = getPage(contentFragmentImpl.getPage().getPath());
+            String pageFragmentId = (contentFragmentDefinitionIsPage ? contentFragmentImpl.getFragment().getId()
: contentFragmentImpl.getReference().getId());
+            BaseFragmentElement fragment = page.getFragmentById(pageFragmentId);
+            if (fragment == null)
+            {
+                throw new IllegalArgumentException("Fragment and page not consistent"); 
              
+            }
+
+            // check for edit permission
+            fragment.checkAccess(JetspeedActions.EDIT);            
+
+            // update fragment preferences and page in page manager
+            fragment.setSecurityConstraints(null);
+            if ((constraints != null) && !constraints.isEmpty())
+            {
+                SecurityConstraints fragmentConstraints = fragment.newSecurityConstraints();
+                String constraintsOwner = constraints.getOwner();
+                if (constraintsOwner != null)
+                {
+                    fragmentConstraints.setOwner(constraintsOwner);
+                }
+                List constraintsConstraints = constraints.getSecurityConstraints();
+                if ((constraintsConstraints != null) || !constraintsConstraints.isEmpty())
+                {
+                    List fragmentConstraintsConstraints = new ArrayList(constraintsConstraints.size());
+                    Iterator constraintsIter = constraintsConstraints.iterator();
+                    while (constraintsIter.hasNext())
+                    {
+                        SecurityConstraint constraint = (SecurityConstraint)constraintsIter.next();
+                        SecurityConstraint fragmentConstraintsConstraint = fragment.newSecurityConstraint();
+                        fragmentConstraintsConstraint.setGroups(constraint.getGroups());
+                        fragmentConstraintsConstraint.setPermissions(constraint.getPermissions());
+                        fragmentConstraintsConstraint.setRoles(constraint.getRoles());
+                        fragmentConstraintsConstraint.setUsers(constraint.getUsers());
+                        fragmentConstraintsConstraints.add(fragmentConstraintsConstraint);
+                    }
+                    fragmentConstraints.setSecurityConstraints(fragmentConstraintsConstraints);
+                }
+                List constraintsConstraintsRefs = constraints.getSecurityConstraintsRefs();
+                if ((constraintsConstraintsRefs != null) || !constraintsConstraintsRefs.isEmpty())
+                {
+                    List fragmentConstraintsConstraintsRefs = new ArrayList(constraintsConstraintsRefs.size());
+                    Iterator constraintsRefsIter = constraintsConstraintsRefs.iterator();
+                    while (constraintsRefsIter.hasNext())
+                    {
+                        fragmentConstraintsConstraintsRefs.add((String)constraintsRefsIter.next());
+                    }
+                    fragmentConstraints.setSecurityConstraintsRefs(fragmentConstraintsConstraintsRefs);
+                }
+                fragment.setSecurityConstraints(fragmentConstraints);
+            }
+            updatePage(page);
+
+            // update content context
+            contentFragmentImpl.setSecurityConstraints(constraints);
+        }
+        catch (Exception e)
+        {
+            throw new PageLayoutComponentException("Unexpected exception: "+e, e);
+        }
+        
+    }
+    
+    /* (non-Javadoc)
      * @see org.apache.jetspeed.layout.PageLayoutComponent#updateStateMode(org.apache.jetspeed.om.page.ContentFragment,
java.lang.String, java.lang.String)
      */
     public void updateStateMode(ContentFragment contentFragment, String portletState, String
portletMode)
@@ -1613,6 +1697,8 @@
             contentFragmentImpl = newContentFragment(contentFragmentId, page, fragmentDefinitions,
definition, fragmentFragment, null, null, locked);
             // set content fragment attributes
             mergeContentFragmentAttributes(contentFragmentImpl, fragmentFragment);
+            // set content fragment security constraints
+            setContentFragmentSecurityConstraints(contentFragmentImpl, fragmentFragment);
         }
         else if (fragment instanceof PageFragment)
         {
@@ -1632,6 +1718,8 @@
                 mergeContentFragmentAttributes(contentFragmentImpl, pageFragmentFragment);
                 // inherit fragment reference attributes
                 mergeContentFragmentAttributes(contentFragmentImpl, fragmentReferenceFragment);
+                // set content fragment security constraints
+                setContentFragmentSecurityConstraints(contentFragmentImpl, fragmentReferenceFragment);
                 // merge content fragment attributes
                 mergeContentFragmentAttributes(contentFragmentImpl, fragmentFragment[0]);
             }
@@ -1645,9 +1733,11 @@
                 mergeContentFragmentAttributes(contentFragmentImpl, pageFragmentFragment);
                 // merge content fragment attributes
                 mergeContentFragmentAttributes(contentFragmentImpl, fragmentFragment);
+                // set content fragment security constraints
+                setContentFragmentSecurityConstraints(contentFragmentImpl, fragmentFragment);
             }
         }
-        else  if (fragment instanceof FragmentReference)
+        else if (fragment instanceof FragmentReference)
         {
             // consume fragment reference and build fragment hierarchy from
             // referenced fragment
@@ -1657,6 +1747,8 @@
             contentFragmentImpl = newContentFragment(contentFragmentId, page, fragmentDefinitions,
definition, fragmentReferenceFragment, fragmentFragment);
             // inherit fragment reference attributes
             mergeContentFragmentAttributes(contentFragmentImpl, fragmentReferenceFragment);
+            // set content fragment security constraints
+            setContentFragmentSecurityConstraints(contentFragmentImpl, fragmentReferenceFragment);
             // merge content fragment attributes
             mergeContentFragmentAttributes(contentFragmentImpl, fragmentFragment[0]);
         }
@@ -1856,6 +1948,50 @@
     }
     
     /**
+     * Set content fragment security constraints from source PSML fragment.
+     * 
+     * @param contentFragmentImpl target content fragment
+     * @param fragment source PSML fragment
+     */
+    private void setContentFragmentSecurityConstraints(ContentFragmentImpl contentFragmentImpl,
BaseFragmentElement fragment)
+    {
+        // set content fragment attributes
+        if ((contentFragmentImpl != null) && (fragment != null))
+        {
+            SecurityConstraints fragmentConstraints = fragment.getSecurityConstraints();
+            if ((fragmentConstraints != null) && !fragmentConstraints.isEmpty())
+            {
+                String contentConstraintsOwner = fragmentConstraints.getOwner();
+                List contentConstraintsConstraints = null;
+                List fragmentConstraintsConstraints = fragmentConstraints.getSecurityConstraints();
+                if ((fragmentConstraintsConstraints != null) && !fragmentConstraintsConstraints.isEmpty())
+                {
+                    contentConstraintsConstraints = new ArrayList(fragmentConstraintsConstraints.size());
+                    Iterator constraintsIter = fragmentConstraintsConstraints.iterator();
+                    while (constraintsIter.hasNext())
+                    {
+                        SecurityConstraint fragmentConstraint = (SecurityConstraint)constraintsIter.next();
+                        contentConstraintsConstraints.add(new ContentSecurityConstraint(false,
fragmentConstraint.getGroups(), fragmentConstraint.getPermissions(), fragmentConstraint.getRoles(),
fragmentConstraint.getUsers()));
+                    }
+                }
+                List contentConstraintsConstraintsRefs = null;
+                List fragmentConstraintsConstraintsRefs = fragmentConstraints.getSecurityConstraintsRefs();
+                if ((fragmentConstraintsConstraintsRefs != null) && !fragmentConstraintsConstraintsRefs.isEmpty())
+                {
+                    contentConstraintsConstraintsRefs = new ArrayList(fragmentConstraintsConstraintsRefs.size());
+                    Iterator constraintsRefsIter = fragmentConstraintsConstraintsRefs.iterator();
+                    while (constraintsRefsIter.hasNext())
+                    {
+                        contentConstraintsConstraintsRefs.add((String)constraintsRefsIter.next());
+                    }
+                }
+                SecurityConstraints contentConstraints = new ContentSecurityConstraints(false,
contentConstraintsOwner, contentConstraintsConstraints, contentConstraintsConstraintsRefs);
+                contentFragmentImpl.setSecurityConstraints(contentConstraints);
+            }
+        }
+    }
+    
+    /**
      * Shift document name by type in folder document order.
      * 
      * @param folder folder with target document order

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/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?rev=911258&r1=911257&r2=911258&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentFragmentImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentFragmentImpl.java
Thu Feb 18 06:10:53 2010
@@ -29,6 +29,8 @@
 import org.apache.jetspeed.decoration.Decoration;
 import org.apache.jetspeed.layout.PageLayoutComponent;
 import org.apache.jetspeed.layout.impl.PageLayoutComponentUtils;
+import org.apache.jetspeed.om.common.SecurityConstraint;
+import org.apache.jetspeed.om.common.SecurityConstraints;
 import org.apache.jetspeed.om.page.BaseConcretePageElement;
 import org.apache.jetspeed.om.page.BaseFragmentsElement;
 import org.apache.jetspeed.om.page.ContentFragment;
@@ -72,6 +74,7 @@
     private String shortTitle;
     private String title;
     private String type;
+    private SecurityConstraints constraints;
 
     /**
      * Construct new dynamic content fragment with
@@ -130,6 +133,30 @@
     }
 
     /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.ContentFragment#getSecurityConstraints()
+     */
+    public SecurityConstraints getSecurityConstraints()
+    {
+        return constraints;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.ContentFragment#newSecurityConstraint()
+     */
+    public SecurityConstraint newSecurityConstraint()
+    {
+        return new ContentSecurityConstraint(true, null, null, null, null);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.ContentFragment#newSecurityConstraints()
+     */
+    public SecurityConstraints newSecurityConstraints()
+    {
+        return new ContentSecurityConstraints(true, null, null, null);
+    }
+
+    /* (non-Javadoc)
      * @see org.apache.jetspeed.om.page.ContentFragment#checkAccess(java.lang.String)
      */
     public void checkAccess(String actions) throws SecurityException
@@ -847,6 +874,23 @@
     }
 
     /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.ContentFragment#updateSecurityConstraints(org.apache.jetspeed.om.common.SecurityConstraints)
+     */
+    public void updateSecurityConstraints(SecurityConstraints constraints)
+    {
+        if (pageLayoutComponent != null)
+        {
+            // delegate to page layout component
+            pageLayoutComponent.updateSecurityConstraints(this, constraints);
+        }
+        else
+        {
+            // perform locally only
+            setSecurityConstraints(constraints);
+        }
+    }
+
+    /* (non-Javadoc)
      * @see org.apache.jetspeed.om.page.ContentFragment#updateStateMode(java.lang.String,
java.lang.String)
      */
     public void updateStateMode(String portletState, String portletMode)
@@ -1496,6 +1540,16 @@
     }
 
     /**
+     * Set content security constraints.
+     * 
+     * @param constraints security constraints
+     */
+    public void setSecurityConstraints(SecurityConstraints constraints)
+    {
+        this.constraints = constraints;
+    }
+    
+    /**
      * Set content fragment short title.
      * 
      * @param shortTitle the shortTitle to set

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentSecurityConstraint.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/ContentSecurityConstraint.java?rev=911258&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentSecurityConstraint.java
(added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentSecurityConstraint.java
Thu Feb 18 06:10:53 2010
@@ -0,0 +1,134 @@
+/* 
+ * 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.common.SecurityConstraint;
+
+/**
+ * Content security constraint implementation.
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+public class ContentSecurityConstraint implements SecurityConstraint
+{
+    private boolean mutable;
+    private List groups;
+    private List permissions;
+    private List roles;
+    private List users;
+
+    /**
+     * Construct new security constraint implementation.
+     * 
+     * @param mutable mutable flag
+     * @param groups constraint groups
+     * @param permissions constraint permissions
+     * @param roles constraint roles
+     * @param users constraint users
+     */
+    public ContentSecurityConstraint(boolean mutable, List groups, List permissions, List
roles, List users)
+    {
+        this.mutable = mutable;
+        this.groups = groups;
+        this.permissions = permissions;
+        this.roles = roles;
+        this.users = users;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraint#getGroups()
+     */
+    public List getGroups()
+    {
+        return groups;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraint#getPermissions()
+     */
+    public List getPermissions()
+    {
+        return permissions;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraint#getRoles()
+     */
+    public List getRoles()
+    {
+        return roles;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraint#getUsers()
+     */
+    public List getUsers()
+    {
+        return users;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraint#setGroups(java.util.List)
+     */
+    public void setGroups(List groups)
+    {
+        if (!mutable)
+        {
+            throw new UnsupportedOperationException("ContentSecurityConstraint.setGroups()");
+        }
+        this.groups = groups;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraint#setPermissions(java.util.List)
+     */
+    public void setPermissions(List permissions)
+    {
+        if (!mutable)
+        {
+            throw new UnsupportedOperationException("ContentSecurityConstraint.setPermissions()");
+        }
+        this.permissions = permissions;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraint#setRoles(java.util.List)
+     */
+    public void setRoles(List roles)
+    {
+        if (!mutable)
+        {
+            throw new UnsupportedOperationException("ContentSecurityConstraint.setRoles()");
+        }
+        this.roles = roles;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraint#setUsers(java.util.List)
+     */
+    public void setUsers(List users)
+    {
+        if (!mutable)
+        {
+            throw new UnsupportedOperationException("ContentSecurityConstraint.setUsers()");
+        }
+        this.users = users;
+    }
+}

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentSecurityConstraints.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/ContentSecurityConstraints.java?rev=911258&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentSecurityConstraints.java
(added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-layout/src/main/java/org/apache/jetspeed/om/page/impl/ContentSecurityConstraints.java
Thu Feb 18 06:10:53 2010
@@ -0,0 +1,119 @@
+/* 
+ * 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.common.SecurityConstraints;
+
+/**
+ * Content security constraints implementation.
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+public class ContentSecurityConstraints implements SecurityConstraints
+{
+    private boolean mutable;
+    private String owner;
+    private List constraints;
+    private List constraintsRefs;
+    
+    /**
+     * Construct new security constraints implementation.
+     * 
+     * @param mutable mutable flag
+     * @param owner owner constraint
+     * @param constraints constraints list
+     * @param constraintsRefs constraints references list
+     */
+    public ContentSecurityConstraints(boolean mutable, String owner, List constraints, List
constraintsRefs)
+    {
+        this.mutable = mutable;
+        this.owner = owner;
+        this.constraints = constraints;
+        this.constraintsRefs = constraintsRefs;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraints#getOwner()
+     */
+    public String getOwner()
+    {
+        return owner;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraints#getSecurityConstraints()
+     */
+    public List getSecurityConstraints()
+    {
+        return constraints;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraints#getSecurityConstraintsRefs()
+     */
+    public List getSecurityConstraintsRefs()
+    {
+        return constraintsRefs;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraints#isEmpty()
+     */
+    public boolean isEmpty()
+    {
+        return ((owner == null) && ((constraints == null) || constraints.isEmpty())
&& ((constraintsRefs == null) || constraintsRefs.isEmpty()));
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraints#setOwner(java.lang.String)
+     */
+    public void setOwner(String owner)
+    {
+        if (!mutable)
+        {
+            throw new UnsupportedOperationException("ContentSecurityConstraints.setOwner()");
+        }
+        this.owner = owner;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraints#setSecurityConstraints(java.util.List)
+     */
+    public void setSecurityConstraints(List constraints)
+    {
+        if (!mutable)
+        {
+            throw new UnsupportedOperationException("ContentSecurityConstraints.setSecurityConstraints()");
+        }
+        this.constraints = constraints;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraints#setSecurityConstraintsRefs(java.util.List)
+     */
+    public void setSecurityConstraintsRefs(List constraintsRefs)
+    {
+        if (!mutable)
+        {
+            throw new UnsupportedOperationException("ContentSecurityConstraints.setSecurityConstraintsRefs()");
+        }
+        this.constraintsRefs = constraintsRefs;
+    }
+}

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/layout/PageLayoutComponent.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/layout/PageLayoutComponent.java?rev=911258&r1=911257&r2=911258&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/layout/PageLayoutComponent.java
(original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/layout/PageLayoutComponent.java
Thu Feb 18 06:10:53 2010
@@ -18,6 +18,7 @@
 
 import java.util.Map;
 
+import org.apache.jetspeed.om.common.SecurityConstraints;
 import org.apache.jetspeed.om.page.ContentFragment;
 import org.apache.jetspeed.om.page.ContentPage;
 import org.apache.jetspeed.om.page.BaseConcretePageElement;
@@ -342,6 +343,14 @@
      * @param scopeValue properties scope value
      */
     void updateRowColumn(ContentFragment contentFragment, int row, int column, String scope,
String scopeValue);
+
+    /**
+     * Update fragment security constraints.
+     * 
+     * @param contentFragment content fragment context
+     * @param constraints security constraints
+     */
+    void updateSecurityConstraints(ContentFragment contentFragment, SecurityConstraints constraints);
     
     /**
      * Update global fragment portlet state and/or mode.

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/page/ContentFragment.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/page/ContentFragment.java?rev=911258&r1=911257&r2=911258&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/page/ContentFragment.java
(original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/page/ContentFragment.java
Thu Feb 18 06:10:53 2010
@@ -22,6 +22,8 @@
 import org.apache.jetspeed.aggregator.PortletContent;
 import org.apache.jetspeed.decoration.Decoration;
 import org.apache.jetspeed.layout.PageLayoutComponent;
+import org.apache.jetspeed.om.common.SecurityConstraint;
+import org.apache.jetspeed.om.common.SecurityConstraints;
 
 /**
  * ContentFragment is a read-only version of the {@link org.apache.jetspeed.om.page.Fragment}
@@ -38,6 +40,27 @@
     /************** SecuredResource **************/
 
     /**
+     * Get security constraints.
+     *
+     * @return security constraints for resource
+     */
+    SecurityConstraints getSecurityConstraints();
+    
+    /**
+     * Create new security constraints.
+     *
+     * @return a newly created SecurityConstraints object
+     */
+    SecurityConstraints newSecurityConstraints();
+
+    /**
+     * Create new security constraint.
+     *
+     * @return a newly created SecurityConstraint object
+     */
+    SecurityConstraint newSecurityConstraint();
+
+    /**
      * Check security access to fragment.
      *
      * @param actions list to be checked against in CSV string form
@@ -601,6 +624,13 @@
     void updateRowColumn(int row, int column, String scope, String scopeValue);
     
     /**
+     * Update fragment security constraints.
+     *
+     * @param constraints security constraints for resource
+     */
+    void updateSecurityConstraints(SecurityConstraints constraints);
+    
+    /**
      * Update fragment portlet state and/or mode. The default, (Global),
      * scope values are updated.
      * 



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message