Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderMenuSeparatorDefinitionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderMenuSeparatorDefinitionImpl.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderMenuSeparatorDefinitionImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderMenuSeparatorDefinitionImpl.java Sun Jan 4 22:04:13 2009
@@ -0,0 +1,114 @@
+/*
+ * 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.folder.jpa;
+
+import java.util.Collection;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Table;
+
+import org.apache.jetspeed.om.folder.MenuSeparatorDefinition;
+import org.apache.jetspeed.om.page.PageMetadataImpl;
+
+
+/**
+ * FolderMenuSeparatorDefinitionImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id:$
+ */
+@Entity (name="FolderMenuSeparatorDefinition")
+@Inheritance (strategy=InheritanceType.SINGLE_TABLE)
+@Table (name="FOLDER_MENU")
+@DiscriminatorColumn (name="CLASS_NAME")
+@DiscriminatorValue (value="org.apache.jetspeed.om.folder.impl.FolderMenuSeparatorDefinitionImpl")
+public class FolderMenuSeparatorDefinitionImpl extends FolderBaseMenuDefinitionMetadata implements MenuSeparatorDefinition
+{
+ @Basic
+ @Column (name="SKIN")
+ private String skin;
+ @Basic
+ @Column (name="TITLE")
+ private String title;
+ @Basic
+ @Column (name="TEXT")
+ private String text;
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.folder.jpa.FolderBaseMenuDefinitionMetadata#newPageMetadata()
+ */
+ public PageMetadataImpl newPageMetadata(Collection fields)
+ {
+ PageMetadataImpl pageMetadata = new PageMetadataImpl(FolderMenuMetadataLocalizedFieldImpl.class);
+ pageMetadata.setFields(fields);
+ return pageMetadata;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.folder.MenuSeparatorDefinition#getSkin()
+ */
+ public String getSkin()
+ {
+ return skin;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.folder.MenuSeparatorDefinition#setSkin(java.lang.String)
+ */
+ public void setSkin(String name)
+ {
+ skin = name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.folder.MenuSeparatorDefinition#getTitle()
+ */
+ public String getTitle()
+ {
+ return title;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.folder.MenuSeparatorDefinition#setTitle(java.lang.String)
+ */
+ public void setTitle(String title)
+ {
+ this.title = title;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.folder.MenuSeparatorDefinition#getText()
+ */
+ public String getText()
+ {
+ return text;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.folder.MenuSeparatorDefinition#setText(java.lang.String)
+ */
+ public void setText(String text)
+ {
+ this.text = text;
+ }
+}
Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderMetadataLocalizedFieldImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderMetadataLocalizedFieldImpl.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderMetadataLocalizedFieldImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderMetadataLocalizedFieldImpl.java Sun Jan 4 22:04:13 2009
@@ -0,0 +1,53 @@
+/*
+ * 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.folder.jpa;
+
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import org.apache.jetspeed.om.page.jpa.BaseMetadataLocalizedFieldImpl;
+
+/**
+ * FolderMetadataLocalizedFieldImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Entity (name="FolderMetadata")
+@Inheritance (strategy=InheritanceType.TABLE_PER_CLASS)
+@Table (name="FOLDER_METADATA")
+public class FolderMetadataLocalizedFieldImpl extends BaseMetadataLocalizedFieldImpl
+{
+ // new class defined only to facilitate JPA table/class mapping
+
+ @ManyToOne (targetEntity=FolderImpl.class, fetch=FetchType.LAZY, optional=false)
+ @JoinColumn (name="FOLDER_ID", referencedColumnName="FOLDER_ID")
+ private FolderImpl folder;
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.page.jpa.BaseMetadataLocalizedFieldImpl#setInverseRelationship(java.lang.Object)
+ */
+ public void setInverseRelationship(Object inverse)
+ {
+ folder = (FolderImpl)inverse;
+ }
+}
Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderOrder.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderOrder.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderOrder.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderOrder.java Sun Jan 4 22:04:13 2009
@@ -0,0 +1,140 @@
+/*
+ * 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.folder.jpa;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+/**
+ * FolderOrder
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Entity (name="FolderOrder")
+@Table (name="FOLDER_ORDER")
+public class FolderOrder
+{
+ @Id
+ @GeneratedValue (strategy=GenerationType.AUTO)
+ @Column (name="ORDER_ID")
+ private int id;
+ @Version
+ @Column (name="JPA_VERSION")
+ private int jpaVersion;
+ @ManyToOne (targetEntity=FolderImpl.class, fetch=FetchType.LAZY, optional=false)
+ @JoinColumn (name="FOLDER_ID", referencedColumnName="FOLDER_ID")
+ private FolderImpl folder;
+ @Basic
+ @Column (name="SORT_ORDER")
+ private int sortOrder;
+ @Basic
+ @Column (name="NAME")
+ private String name;
+
+ /**
+ * Explicitly set inverse relationship when this object
+ * is added to a one-to-many collection. JPA does not
+ * manage bidirectional relationships.
+ *
+ * @param inverse inverse relationship owning object.
+ */
+ public void setInverseRelationship(Object inverse)
+ {
+ folder = (FolderImpl)inverse;
+ }
+
+ /**
+ * getSortOrder
+ *
+ * @return sort order
+ */
+ public int getSortOrder()
+ {
+ return sortOrder;
+ }
+
+ /**
+ * setSortOrder
+ *
+ * @param order sort order
+ */
+ public void setSortOrder(int order)
+ {
+ sortOrder = order;
+ }
+
+ /**
+ * getName
+ *
+ * @return folder/page/link name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * setName
+ *
+ * @param name folder/page/link name
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object o)
+ {
+ if (o instanceof FolderOrder)
+ {
+ if (name != null)
+ {
+ return name.equals(((FolderOrder)o).getName());
+ }
+ else
+ {
+ return (((FolderOrder)o).getName() == null);
+ }
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode()
+ {
+ if (name != null)
+ {
+ return name.hashCode();
+ }
+ return 0;
+ }
+}
Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderOrderList.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderOrderList.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderOrderList.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderOrderList.java Sun Jan 4 22:04:13 2009
@@ -0,0 +1,195 @@
+/*
+ * 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.folder.jpa;
+
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * FolderOrderList
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+class FolderOrderList extends AbstractList
+{
+ private FolderImpl folder;
+
+ private List removedFolderOrders;
+
+ FolderOrderList(FolderImpl folder)
+ {
+ super();
+ this.folder = folder;
+ }
+
+ /**
+ * wrapNameStringForAdd
+ *
+ * Wraps and validates folder order name string
+ * to be added to this list.
+ *
+ * @param name folder order name string to add
+ * @return list element to add
+ */
+ private FolderOrder wrapNameStringForAdd(String name)
+ {
+ // only non-null names supported
+ if (name == null)
+ {
+ throw new NullPointerException("Unable to add null to list.");
+ }
+ // wrap folder order name string
+ FolderOrder folderOrder = new FolderOrder();
+ folderOrder.setName(name);
+ // make sure element is unique
+ if (folder.accessFolderOrders().contains(folderOrder))
+ {
+ throw new IllegalArgumentException("Unable to add duplicate entry to list: " + folderOrder.getName());
+ }
+ // retrieve from removed list to reuse
+ // previously removed element
+ if (removedFolderOrders != null)
+ {
+ int removedIndex = removedFolderOrders.indexOf(folderOrder);
+ if (removedIndex >= 0)
+ {
+ folderOrder = (FolderOrder)removedFolderOrders.remove(removedIndex);
+ }
+ }
+ return folderOrder;
+ }
+
+ /**
+ * getRemovedFolderOrders
+ *
+ * @return removed folder orders tracking collection
+ */
+ private List getRemovedFolderOrders()
+ {
+ if (removedFolderOrders == null)
+ {
+ removedFolderOrders = new ArrayList();
+ }
+ return removedFolderOrders;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.List#add(int,java.lang.Object)
+ */
+ public synchronized void add(int index, Object element)
+ {
+ // implement for modifiable AbstractList:
+ // validate index
+ if ((index < 0) || (index > folder.accessFolderOrders().size()))
+ {
+ throw new IndexOutOfBoundsException("Unable to add to list at index: " + index);
+ }
+ // wrap and verify folder order name string
+ FolderOrder folderOrder = wrapNameStringForAdd((String)element);
+ // add to underlying ordered list
+ folderOrder.setInverseRelationship(folder);
+ folder.accessFolderOrders().add(index, folderOrder);
+ // set sort order in added element
+ if (index > 0)
+ {
+ folderOrder.setSortOrder(((FolderOrder)folder.accessFolderOrders().get(index-1)).getSortOrder() + 1);
+ }
+ else
+ {
+ folderOrder.setSortOrder(0);
+ }
+ // maintain sort order in subsequent elements
+ for (int i = index, limit = folder.accessFolderOrders().size() - 1; (i < limit); i++)
+ {
+ FolderOrder nextFolderOrder = (FolderOrder)folder.accessFolderOrders().get(i + 1);
+ if (nextFolderOrder.getSortOrder() <= folderOrder.getSortOrder())
+ {
+ // adjust sort order for next element
+ nextFolderOrder.setSortOrder(folderOrder.getSortOrder() + 1);
+ folderOrder = nextFolderOrder;
+ }
+ else
+ {
+ // sort order maintained for remaining list elements
+ break;
+ }
+ }
+ // clear all cached folder ordering
+ folder.clearDocumentOrderComparator();
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.List#get(int)
+ */
+ public synchronized Object get(int index)
+ {
+ // implement for modifiable AbstractList:
+ // unwrap folder order name string
+ return ((FolderOrder)folder.accessFolderOrders().get(index)).getName();
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.List#remove(int)
+ */
+ public synchronized Object remove(int index)
+ {
+ // implement for modifiable AbstractList
+ FolderOrder removed = (FolderOrder)folder.accessFolderOrders().remove(index);
+ if (removed != null)
+ {
+ removed.setInverseRelationship(null);
+ // save removed element
+ getRemovedFolderOrders().add(removed);
+ // clear all cached folder ordering
+ folder.clearDocumentOrderComparator();
+ }
+ return removed;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.List#set(int,java.lang.Object)
+ */
+ public synchronized Object set(int index, Object element)
+ {
+ // implement for modifiable AbstractList:
+ // wrap and verify folder order name string
+ FolderOrder newFolderOrder = wrapNameStringForAdd((String)element);
+ // set in underlying ordered list
+ newFolderOrder.setInverseRelationship(folder);
+ FolderOrder folderOrder = (FolderOrder)folder.accessFolderOrders().set(index, newFolderOrder);
+ folderOrder.setInverseRelationship(null);
+ // set sort order in new element
+ newFolderOrder.setSortOrder(folderOrder.getSortOrder());
+ // save replaced element
+ getRemovedFolderOrders().add(folderOrder);
+ // clear all cached folder ordering
+ folder.clearDocumentOrderComparator();
+ // return unwrapped folder order name string
+ return folderOrder.getName();
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.List#size()
+ */
+ public synchronized int size()
+ {
+ // implement for modifiable AbstractList
+ return folder.accessFolderOrders().size();
+ }
+}
Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderSecurityConstraintImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderSecurityConstraintImpl.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderSecurityConstraintImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderSecurityConstraintImpl.java Sun Jan 4 22:04:13 2009
@@ -0,0 +1,57 @@
+/*
+ * 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.folder.jpa;
+
+import javax.persistence.AttributeOverride;
+import javax.persistence.AttributeOverrides;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import org.apache.jetspeed.om.page.jpa.BaseSecurityConstraintImpl;
+
+/**
+ * FolderSecurityConstraintImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Entity (name="FolderConstraint")
+@Inheritance (strategy=InheritanceType.TABLE_PER_CLASS)
+@Table (name="FOLDER_CONSTRAINT")
+@AttributeOverrides ({@AttributeOverride (name="id", column=@Column(name="CONSTRAINT_ID"))})
+public class FolderSecurityConstraintImpl extends BaseSecurityConstraintImpl
+{
+ // new class defined only to facilitate JPA table/class mapping
+
+ @ManyToOne (targetEntity=FolderImpl.class, fetch=FetchType.LAZY, optional=false)
+ @JoinColumn (name="FOLDER_ID", referencedColumnName="FOLDER_ID")
+ private FolderImpl folder;
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.page.jpa.BaseSecurityConstraintImpl#setInverseRelationship(java.lang.Object)
+ */
+ public void setInverseRelationship(Object inverse)
+ {
+ folder = (FolderImpl)inverse;
+ }
+}
Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderSecurityConstraintsRef.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderSecurityConstraintsRef.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderSecurityConstraintsRef.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/jpa/FolderSecurityConstraintsRef.java Sun Jan 4 22:04:13 2009
@@ -0,0 +1,57 @@
+/*
+ * 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.folder.jpa;
+
+import javax.persistence.AttributeOverride;
+import javax.persistence.AttributeOverrides;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import org.apache.jetspeed.om.page.jpa.BaseSecurityConstraintsRef;
+
+/**
+ * FolderSecurityConstraintsRef
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Entity (name="FolderConstraintsRef")
+@Inheritance (strategy=InheritanceType.TABLE_PER_CLASS)
+@Table (name="FOLDER_CONSTRAINTS_REF")
+@AttributeOverrides ({@AttributeOverride (name="id", column=@Column(name="CONSTRAINTS_REF_ID"))})
+public class FolderSecurityConstraintsRef extends BaseSecurityConstraintsRef
+{
+ // new class defined only to facilitate JPA table/class mapping
+
+ @ManyToOne (targetEntity=FolderImpl.class, fetch=FetchType.LAZY, optional=false)
+ @JoinColumn (name="FOLDER_ID", referencedColumnName="FOLDER_ID")
+ private FolderImpl folder;
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.page.jpa.BaseSecurityConstraintsRef#setInverseRelationship(java.lang.Object)
+ */
+ public void setInverseRelationship(Object inverse)
+ {
+ folder = (FolderImpl)inverse;
+ }
+}
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/psml/FolderImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/psml/FolderImpl.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/psml/FolderImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/psml/FolderImpl.java Sun Jan 4 22:04:13 2009
@@ -25,7 +25,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jetspeed.JetspeedActions;
-import org.apache.jetspeed.om.common.SecurityConstraints;
+import org.apache.jetspeed.om.common.SecurityConstraintsContext;
import org.apache.jetspeed.om.folder.Folder;
import org.apache.jetspeed.om.folder.FolderNotFoundException;
import org.apache.jetspeed.om.folder.MenuDefinition;
@@ -639,24 +639,24 @@
* getSecurityConstraints
* </p>
*
- * @see org.apache.jetspeed.om.common.SecureResource#getSecurityConstraints()
+ * @see org.apache.jetspeed.om.common.SecureResource#getSecurityConstraintsContext()
* @return
*/
- public SecurityConstraints getSecurityConstraints()
+ public SecurityConstraintsContext getSecurityConstraintsContext()
{
- return metadata.getSecurityConstraints();
+ return metadata.getSecurityConstraintsContext();
}
/**
* <p>
* setSecurityConstraints
* </p>
*
- * @see org.apache.jetspeed.om.common.SecureResource#setSecurityConstraints(org.apache.jetspeed.om.common.SecurityConstraints)
+ * @see org.apache.jetspeed.om.common.SecureResource#setSecurityConstraintsContext(org.apache.jetspeed.om.common.SecurityConstraintsContext)
* @param constraints
*/
- public void setSecurityConstraints(SecurityConstraints constraints)
+ public void setSecurityConstraintsContext(SecurityConstraintsContext constraintsContext)
{
- metadata.setSecurityConstraints(constraints);
+ metadata.setSecurityConstraintsContext(constraintsContext);
}
/**
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/psml/MenuMetadataImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/psml/MenuMetadataImpl.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/psml/MenuMetadataImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/folder/psml/MenuMetadataImpl.java Sun Jan 4 22:04:13 2009
@@ -19,6 +19,7 @@
import java.util.Collection;
import java.util.Locale;
+import org.apache.jetspeed.om.page.PageLocalizedFieldImpl;
import org.apache.jetspeed.om.page.PageMetadataImpl;
import org.apache.jetspeed.om.portlet.GenericMetadata;
@@ -177,7 +178,7 @@
{
if (metadata == null)
{
- metadata = new PageMetadataImpl();
+ metadata = new PageMetadataImpl(PageLocalizedFieldImpl.class);
}
return metadata;
}
Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/AbstractSecurityConstraintImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/AbstractSecurityConstraintImpl.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/AbstractSecurityConstraintImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/AbstractSecurityConstraintImpl.java Sun Jan 4 22:04:13 2009
@@ -0,0 +1,333 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.jetspeed.om.common.SecurityConstraint;
+
+/**
+ * <p>
+ * AbstractSecurityConstraintImpl
+ * </p>
+ * <p>
+ *
+ * </p>
+ * @author <a href="mailto:rwatler@finali.com">Randy Watler</a>
+ * @version $Id: SecurityConstraintImpl.java 516448 2007-03-09 16:25:47Z ate $
+ *
+ */
+public abstract class AbstractSecurityConstraintImpl implements SecurityConstraint
+{
+ private String users;
+ private String roles;
+ private String groups;
+ private String permissions;
+
+ /**
+ * getUsersAsString
+ *
+ * @return users CSV list
+ */
+ public String getUsersAsString()
+ {
+ // get from users list if not immediately available
+ List usersList = getUsers();
+ if ((users == null) && (usersList != null) && !usersList.isEmpty())
+ {
+ users = formatCSVList(usersList);
+ }
+ return users;
+ }
+
+ /**
+ * setUsersAsString
+ *
+ * @param users users CSV list
+ */
+ public void setUsersAsString(String users)
+ {
+ // set and propagate to users list setting
+ this.users = users;
+ setUsers(parseCSVList(users));
+ }
+
+ /**
+ * getRolesAsString
+ *
+ * @return roles CSV list
+ */
+ public String getRolesAsString()
+ {
+ // get from roles list if not immediately available
+ List rolesList = getRoles();
+ if ((roles == null) && (rolesList != null) && !rolesList.isEmpty())
+ {
+ roles = formatCSVList(rolesList);
+ }
+ return roles;
+ }
+
+ /**
+ * setRolesAsString
+ *
+ * @param roles roles CSV list
+ */
+ public void setRolesAsString(String roles)
+ {
+ // set and propagate to roles list setting
+ this.roles = roles;
+ setRoles(parseCSVList(roles));
+ }
+
+ /**
+ * getGroupsAsString
+ *
+ * @return groups CSV list
+ */
+ public String getGroupsAsString()
+ {
+ // get from groups list if not immediately available
+ List groupsList = getGroups();
+ if ((groups == null) && (groupsList != null) && !groupsList.isEmpty())
+ {
+ groups = formatCSVList(groupsList);
+ }
+ return groups;
+ }
+
+ /**
+ * setGroupsAsString
+ *
+ * @param groups groups CSV list
+ */
+ public void setGroupsAsString(String groups)
+ {
+ // set and propagate to groups list setting
+ this.groups = groups;
+ setGroups(parseCSVList(groups));
+ }
+
+ /**
+ * getPermissionsAsString
+ *
+ * @return permissions CSV list
+ */
+ public String getPermissionsAsString()
+ {
+ // get from permissions list if not immediately available
+ List permissionsList = getPermissions();
+ if ((permissions == null) && (permissionsList != null) && !permissionsList.isEmpty())
+ {
+ permissions = formatCSVList(permissionsList);
+ }
+ return permissions;
+ }
+
+ /**
+ * setPermissionsAsString
+ *
+ * @param permissions permissions CSV list
+ */
+ public void setPermissionsAsString(String permissions)
+ {
+ // set and propagate to permissions list setting
+ this.permissions = permissions;
+ setPermissions(parseCSVList(permissions));
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.common.SecurityConstraint#setUsers(java.util.List)
+ */
+ public void setUsers(List users)
+ {
+ // set and clear potentially stale string representation
+ this.users = null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.common.SecurityConstraint#setRoles(java.util.List)
+ */
+ public void setRoles(List roles)
+ {
+ // set and clear potentially stale string representation
+ this.roles = null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.common.SecurityConstraint#setGroups(java.util.List)
+ */
+ public void setGroups(List groups)
+ {
+ // set and clear potentially stale string representation
+ this.groups = null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.common.SecurityConstraint#setPermissions(java.util.List)
+ */
+ public void setPermissions(List permissions)
+ {
+ // set and clear potentially stale string representation
+ this.permissions = null;
+ }
+
+ /**
+ * <p>
+ * principalsMatch
+ * </p>
+ * <p>
+ * Test user/role/group names against principal names.
+ * </p>
+ *
+ * @param userPrincipals
+ * @param rolePrincipals
+ * @param groupPrincipals
+ * @param allowDefault
+ * @return match result
+ */
+ public boolean principalsMatch(List userPrincipals, List rolePrincipals, List groupPrincipals, boolean allowDefault)
+ {
+ // test match using users, roles, and groups list members
+ // since these are the master representation
+ List usersList = getUsers();
+ List rolesList = getRoles();
+ List groupsList = getGroups();
+ return ((allowDefault && (usersList == null) && (rolesList == null) && (groupsList == null)) ||
+ ((usersList != null) && (userPrincipals != null) &&
+ (containsAny(usersList, userPrincipals) || usersList.contains(WILD_CHAR))) ||
+ ((rolesList != null) && (rolePrincipals != null) &&
+ (containsAny(rolesList, rolePrincipals) || rolesList.contains(WILD_CHAR))) ||
+ ((groupsList != null) && (groupPrincipals != null) &&
+ (containsAny(groupsList, groupPrincipals) || groupsList.contains(WILD_CHAR))));
+ }
+
+ /**
+ * <p>
+ * actionMatch
+ * </p>
+ * <p>
+ * Test permission names against action name.
+ * </p>
+ *
+ * @param action
+ * @return match result
+ */
+ public boolean actionMatch(String action)
+ {
+ // test match using permissions list member since
+ // this is the master representation in this impl
+ List permissionsList = getPermissions();
+ return ((permissionsList != null) &&
+ (permissionsList.contains(action) || permissionsList.contains(WILD_CHAR)));
+ }
+
+ /**
+ * <p>
+ * parseCSVList
+ * </p>
+ * <p>
+ * Utility to parse CSV string values into Lists.
+ * </p>
+ *
+ * @param csv
+ * @return parsed values list.
+ */
+ public static List parseCSVList(String csv)
+ {
+ if (csv != null)
+ {
+ List csvList = new ArrayList();
+ if (csv.indexOf(',') != -1)
+ {
+ StringTokenizer csvTokens = new StringTokenizer(csv, ",");
+ while (csvTokens.hasMoreTokens())
+ {
+ csvList.add(csvTokens.nextToken().trim());
+ }
+ }
+ else
+ {
+ csvList.add(csv);
+ }
+ return csvList;
+ }
+ return null;
+ }
+
+ /**
+ * <p>
+ * formatCSVList
+ * </p>
+ * <p>
+ * Utility to format CSV List values into strings.
+ * </p>
+ *
+ * @param list
+ * @return formatted string value.
+ */
+ public static String formatCSVList(List list)
+ {
+ if ((list != null) && !list.isEmpty())
+ {
+ StringBuffer csv = new StringBuffer();
+ Iterator listIter = list.iterator();
+ while (listIter.hasNext())
+ {
+ if (csv.length() > 0)
+ {
+ csv.append(",");
+ }
+ csv.append((String)listIter.next());
+ }
+ return csv.toString();
+ }
+ return null;
+ }
+
+ /**
+ * <p>
+ * containsAny
+ * </p>
+ * <p>
+ * Utility implementation for contains any test against two collections.
+ * </p>
+ *
+ * @param collection0
+ * @param collection1
+ * @return contains any result.
+ */
+ public static boolean containsAny(Collection collection0, Collection collection1)
+ {
+ if ((collection0 != null) && (collection1 != null))
+ {
+ Iterator containsIter = collection1.iterator();
+ while (containsIter.hasNext())
+ {
+ if (collection0.contains(containsIter.next()))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+}
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java Sun Jan 4 22:04:13 2009
@@ -17,6 +17,7 @@
package org.apache.jetspeed.om.page;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -28,8 +29,7 @@
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.om.common.SecurityConstraintsContext;
public class ContentFragmentImpl implements ContentFragment
{
@@ -531,21 +531,19 @@
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#getSecurityConstraints()
+ * @see org.apache.jetspeed.om.common.SecuredResource#getSecurityConstraintsContext()
*/
- public SecurityConstraints getSecurityConstraints()
+ public SecurityConstraintsContext getSecurityConstraintsContext()
{
-
- return fragment.getSecurityConstraints();
+ return fragment.getSecurityConstraintsContext();
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraints()
+ * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraintsContext()
*/
- public SecurityConstraints newSecurityConstraints()
- {
-
- return fragment.newSecurityConstraints();
+ public SecurityConstraintsContext newSecurityConstraintsContext()
+ {
+ return fragment.newSecurityConstraintsContext();
}
/* (non-Javadoc)
@@ -553,16 +551,15 @@
*/
public SecurityConstraint newSecurityConstraint()
{
-
return fragment.newSecurityConstraint();
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#setSecurityConstraints(org.apache.jetspeed.om.common.SecurityConstraints)
+ * @see org.apache.jetspeed.om.common.SecuredResource#setSecurityConstraintsContext(org.apache.jetspeed.om.common.SecurityConstraintsContext)
*/
- public void setSecurityConstraints(SecurityConstraints constraints)
+ public void setSecurityConstraintsContext(SecurityConstraintsContext constraintsContext)
{
- fragment.setSecurityConstraints(constraints);
+ fragment.setSecurityConstraintsContext(constraintsContext);
}
@@ -620,8 +617,7 @@
* @see java.util.List#addAll(int, java.util.Collection)
*/
public boolean addAll(int index, Collection c)
- {
-
+ {
return baseList.addAll(index, c);
}
@@ -630,7 +626,6 @@
*/
public boolean addAll(Collection c)
{
-
return baseList.addAll(c);
}
@@ -639,7 +634,6 @@
*/
public void clear()
{
-
baseList.clear();
}
@@ -648,7 +642,6 @@
*/
public boolean contains(Object o)
{
-
return baseList.contains(o);
}
@@ -657,7 +650,6 @@
*/
public boolean containsAll(Collection c)
{
-
return baseList.containsAll(c);
}
@@ -666,7 +658,6 @@
*/
public boolean equals(Object o)
{
-
return baseList.equals(o);
}
@@ -684,7 +675,6 @@
*/
public int hashCode()
{
-
return baseList.hashCode();
}
@@ -693,7 +683,6 @@
*/
public int indexOf(Object o)
{
-
return baseList.indexOf(o);
}
@@ -702,7 +691,6 @@
*/
public boolean isEmpty()
{
-
return baseList.isEmpty();
}
@@ -719,7 +707,6 @@
*/
public int lastIndexOf(Object o)
{
-
return baseList.lastIndexOf(o);
}
@@ -744,7 +731,6 @@
*/
public Object remove(int index)
{
-
return baseList.remove(index);
}
@@ -753,7 +739,6 @@
*/
public boolean remove(Object o)
{
-
return baseList.remove(o);
}
@@ -762,7 +747,6 @@
*/
public boolean removeAll(Collection c)
{
-
return baseList.removeAll(c);
}
@@ -771,7 +755,6 @@
*/
public boolean retainAll(Collection c)
{
-
return baseList.retainAll(c);
}
@@ -780,7 +763,6 @@
*/
public Object set(int index, Object element)
{
-
return baseList.set(index, element);
}
@@ -789,7 +771,6 @@
*/
public int size()
{
-
return baseList.size();
}
@@ -801,8 +782,6 @@
return duplicateList().subList(fromIndex, toIndex);
}
-
-
/* (non-Javadoc)
* @see java.util.List#toArray()
*/
@@ -816,12 +795,12 @@
*/
public Object[] toArray(Object[] a)
{
- return duplicateList().toArray(a);
+ return duplicateList().toArray(a);
}
private List duplicateList()
{
- List rFragList = DatabasePageManagerUtils.createList();
+ List rFragList = new ArrayList(baseList.size());
for(int i=0; i < baseList.size(); i++)
{
Fragment f = (Fragment)baseList.get(i);
@@ -830,9 +809,6 @@
}
return rFragList;
}
-
-
-
}
/* (non-Javadoc)
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/ContentPageImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/ContentPageImpl.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/ContentPageImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/ContentPageImpl.java Sun Jan 4 22:04:13 2009
@@ -24,7 +24,7 @@
import java.util.Map;
import org.apache.jetspeed.om.common.SecurityConstraint;
-import org.apache.jetspeed.om.common.SecurityConstraints;
+import org.apache.jetspeed.om.common.SecurityConstraintsContext;
import org.apache.jetspeed.om.folder.MenuDefinition;
import org.apache.jetspeed.om.folder.MenuExcludeDefinition;
import org.apache.jetspeed.om.folder.MenuIncludeDefinition;
@@ -425,21 +425,21 @@
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#getSecurityConstraints()
+ * @see org.apache.jetspeed.om.common.SecuredResource#getSecurityConstraintsContext()
*/
- public SecurityConstraints getSecurityConstraints()
+ public SecurityConstraintsContext getSecurityConstraintsContext()
{
- return page.getSecurityConstraints();
+ return page.getSecurityConstraintsContext();
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraints()
+ * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraintsContext()
*/
- public SecurityConstraints newSecurityConstraints()
+ public SecurityConstraintsContext newSecurityConstraintsContext()
{
- return page.newSecurityConstraints();
+ return page.newSecurityConstraintsContext();
}
/* (non-Javadoc)
@@ -452,12 +452,11 @@
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#setSecurityConstraints(org.apache.jetspeed.om.common.SecurityConstraints)
+ * @see org.apache.jetspeed.om.common.SecuredResource#setSecurityConstraintsContext(org.apache.jetspeed.om.common.SecurityConstraintsContext)
*/
- public void setSecurityConstraints(SecurityConstraints constraints)
- {
-
- page.setSecurityConstraints(constraints);
+ public void setSecurityConstraintsContext(SecurityConstraintsContext constraintsContext)
+ {
+ page.setSecurityConstraintsContext(constraintsContext);
}
/* (non-Javadoc)
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/PageMetadataImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/PageMetadataImpl.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/PageMetadataImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/PageMetadataImpl.java Sun Jan 4 22:04:13 2009
@@ -33,15 +33,10 @@
*/
public class PageMetadataImpl extends GenericMetadataImpl
{
- private Class fieldImplClass = PageLocalizedFieldImpl.class;
-
- public PageMetadataImpl()
- {
- }
+ private Class fieldImplClass;
public PageMetadataImpl(Class fieldImplClass)
{
- this();
this.fieldImplClass = fieldImplClass;
}
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/SecurityConstraintImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/SecurityConstraintImpl.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/SecurityConstraintImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/SecurityConstraintImpl.java Sun Jan 4 22:04:13 2009
@@ -16,14 +16,7 @@
*/
package org.apache.jetspeed.om.page;
-import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
-import java.util.StringTokenizer;
-
-import org.apache.jetspeed.om.common.SecurityConstraint;
-import org.apache.jetspeed.page.impl.DatabasePageManagerUtils;
-
/**
* <p>
@@ -36,7 +29,7 @@
* @version $Id$
*
*/
-public class SecurityConstraintImpl implements SecurityConstraint
+public class SecurityConstraintImpl extends AbstractSecurityConstraintImpl
{
private int id;
private int applyOrder;
@@ -45,11 +38,6 @@
private List groupsList;
private List permissionsList;
- private String users;
- private String roles;
- private String groups;
- private String permissions;
-
/**
* getApplyOrder
*
@@ -70,360 +58,71 @@
applyOrder = order;
}
- /**
- * getUsersAsString
- *
- * @return users CSV list
- */
- public String getUsersAsString()
- {
- // get from users list if not immediately available
- if ((users == null) && (usersList != null) && !usersList.isEmpty())
- {
- users = formatCSVList(usersList);
- }
- return users;
- }
-
- /**
- * setUsersAsString
- *
- * @param users users CSV list
- */
- public void setUsersAsString(String users)
- {
- // set and propagate to users list setting
- this.users = users;
- usersList = parseCSVList(users);
- }
-
- /**
- * getRolesAsString
- *
- * @return roles CSV list
- */
- public String getRolesAsString()
- {
- // get from roles list if not immediately available
- if ((roles == null) && (rolesList != null) && !rolesList.isEmpty())
- {
- roles = formatCSVList(rolesList);
- }
- return roles;
- }
-
- /**
- * setRolesAsString
- *
- * @param roles roles CSV list
- */
- public void setRolesAsString(String roles)
- {
- // set and propagate to roles list setting
- this.roles = roles;
- rolesList = parseCSVList(roles);
- }
-
- /**
- * getGroupsAsString
- *
- * @return groups CSV list
- */
- public String getGroupsAsString()
- {
- // get from groups list if not immediately available
- if ((groups == null) && (groupsList != null) && !groupsList.isEmpty())
- {
- groups = formatCSVList(groupsList);
- }
- return groups;
- }
-
- /**
- * setGroupsAsString
- *
- * @param groups groups CSV list
- */
- public void setGroupsAsString(String groups)
- {
- // set and propagate to groups list setting
- this.groups = groups;
- groupsList = parseCSVList(groups);
- }
-
- /**
- * getPermissionsAsString
- *
- * @return permissions CSV list
- */
- public String getPermissionsAsString()
- {
- // get from permissions list if not immediately available
- if ((permissions == null) && (permissionsList != null) && !permissionsList.isEmpty())
- {
- permissions = formatCSVList(permissionsList);
- }
- return permissions;
- }
-
- /**
- * setPermissionsAsString
- *
- * @param permissions permissions CSV list
- */
- public void setPermissionsAsString(String permissions)
- {
- // set and propagate to permissions list setting
- this.permissions = permissions;
- permissionsList = parseCSVList(permissions);
- }
-
- /**
- * <p>
- * getUsers
- * </p>
- *
+ /* (non-Javadoc)
* @see org.apache.jetspeed.om.common.SecurityConstraint#getUsers()
- * @return users list
*/
public List getUsers()
{
return usersList;
}
- /**
- * <p>
- * setUsers
- * </p>
- *
- * @see org.apache.jetspeed.om.common.SecurityConstraint#setUsers(java.util.List)
- * @param users users list
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.page.AbstractSecurityConstraintImpl#setUsers(java.util.List)
*/
public void setUsers(List users)
{
- // set and clear potentially stale string representation
usersList = users;
- this.users = null;
+ super.setUsers(users);
}
- /**
- * <p>
- * getRoles
- * </p>
- *
+ /* (non-Javadoc)
* @see org.apache.jetspeed.om.common.SecurityConstraint#getRoles()
- * @return roles list
*/
public List getRoles()
{
return rolesList;
}
- /**
- * <p>
- * setRoles
- * </p>
- *
- * @see org.apache.jetspeed.om.common.SecurityConstraint#setRoles(java.util.List)
- * @param roles roles list
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.page.AbstractSecurityConstraintImpl#setRoles(java.util.List)
*/
public void setRoles(List roles)
{
- // set and clear potentially stale string representation
rolesList = roles;
- this.roles = null;
+ super.setRoles(roles);
}
- /**
- * <p>
- * getGroups
- * </p>
- *
+ /* (non-Javadoc)
* @see org.apache.jetspeed.om.common.SecurityConstraint#getGroups()
- * @return groups list
*/
public List getGroups()
{
return groupsList;
}
- /**
- * <p>
- * setGroups
- * </p>
- *
- * @see org.apache.jetspeed.om.common.SecurityConstraint#setGroups(java.util.List)
- * @param groups groups list
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.page.AbstractSecurityConstraintImpl#setGroups(java.util.List)
*/
public void setGroups(List groups)
{
- // set and clear potentially stale string representation
groupsList = groups;
- this.groups = null;
+ super.setGroups(groups);
}
- /**
- * <p>
- * getPermissions
- * </p>
- *
+ /* (non-Javadoc)
* @see org.apache.jetspeed.om.common.SecurityConstraint#getPermissions()
- * @return permissions list
*/
public List getPermissions()
{
return permissionsList;
}
- /**
- * <p>
- * setPermissions
- * </p>
- *
- * @see org.apache.jetspeed.om.common.SecurityConstraint#setPermissions(java.util.List)
- * @param permissions permissions list
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.page.AbstractSecurityConstraintImpl#setPermissions(java.util.List)
*/
public void setPermissions(List permissions)
{
- // set and clear potentially stale string representation
permissionsList = permissions;
- this.permissions = null;
- }
-
- /**
- * <p>
- * principalsMatch
- * </p>
- * <p>
- * Test user/role/group names against principal names.
- * </p>
- *
- * @param userPrincipals
- * @param rolePrincipals
- * @param groupPrincipals
- * @param allowDefault
- * @return match result
- */
- public boolean principalsMatch(List userPrincipals, List rolePrincipals, List groupPrincipals, boolean allowDefault)
- {
- // test match using users, roles, and groups list members
- // since these are the master representation in this impl
- return ((allowDefault && (usersList == null) && (rolesList == null) && (groupsList == null)) ||
- ((usersList != null) && (userPrincipals != null) &&
- (containsAny(usersList, userPrincipals) || usersList.contains(WILD_CHAR))) ||
- ((rolesList != null) && (rolePrincipals != null) &&
- (containsAny(rolesList, rolePrincipals) || rolesList.contains(WILD_CHAR))) ||
- ((groupsList != null) && (groupPrincipals != null) &&
- (containsAny(groupsList, groupPrincipals) || groupsList.contains(WILD_CHAR))));
- }
-
- /**
- * <p>
- * actionMatch
- * </p>
- * <p>
- * Test permission names against action name.
- * </p>
- *
- * @param action
- * @return match result
- */
- public boolean actionMatch(String action)
- {
- // test match using permissions list member since
- // this is the master representation in this impl
- return ((permissionsList != null) &&
- (permissionsList.contains(action) || permissionsList.contains(WILD_CHAR)));
- }
-
- /**
- * <p>
- * parseCSVList
- * </p>
- * <p>
- * Utility to parse CSV string values into Lists.
- * </p>
- *
- * @param csv
- * @return parsed values list.
- */
- public static List parseCSVList(String csv)
- {
- if (csv != null)
- {
- List csvList = DatabasePageManagerUtils.createList();
- if (csv.indexOf(',') != -1)
- {
- StringTokenizer csvTokens = new StringTokenizer(csv, ",");
- while (csvTokens.hasMoreTokens())
- {
- csvList.add(csvTokens.nextToken().trim());
- }
- }
- else
- {
- csvList.add(csv);
- }
- return csvList;
- }
- return null;
- }
-
- /**
- * <p>
- * formatCSVList
- * </p>
- * <p>
- * Utility to format CSV List values into strings.
- * </p>
- *
- * @param list
- * @return formatted string value.
- */
- public static String formatCSVList(List list)
- {
- if ((list != null) && !list.isEmpty())
- {
- StringBuffer csv = new StringBuffer();
- Iterator listIter = list.iterator();
- while (listIter.hasNext())
- {
- if (csv.length() > 0)
- {
- csv.append(",");
- }
- csv.append((String)listIter.next());
- }
- return csv.toString();
- }
- return null;
- }
-
- /**
- * <p>
- * containsAny
- * </p>
- * <p>
- * Utility implementation for contains any test against two collections.
- * </p>
- *
- * @param collection0
- * @param collection1
- * @return contains any result.
- */
- public static boolean containsAny(Collection collection0, Collection collection1)
- {
- if ((collection0 != null) && (collection1 != null))
- {
- Iterator containsIter = collection1.iterator();
- while (containsIter.hasNext())
- {
- if (collection0.contains(containsIter.next()))
- {
- return true;
- }
- }
- }
- return false;
+ super.setPermissions(permissions);
}
}
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/BaseElementImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/BaseElementImpl.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/BaseElementImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/BaseElementImpl.java Sun Jan 4 22:04:13 2009
@@ -19,6 +19,7 @@
import java.security.AccessController;
import java.security.Permission;
import java.security.Principal;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -27,11 +28,10 @@
import org.apache.jetspeed.JetspeedActions;
import org.apache.jetspeed.om.common.SecurityConstraint;
-import org.apache.jetspeed.om.common.SecurityConstraints;
+import org.apache.jetspeed.om.common.SecurityConstraintsContext;
import org.apache.jetspeed.om.page.BaseElement;
import org.apache.jetspeed.om.page.PageSecurity;
import org.apache.jetspeed.om.page.SecurityConstraintImpl;
-import org.apache.jetspeed.page.impl.DatabasePageManagerUtils;
import org.apache.jetspeed.security.Group;
import org.apache.jetspeed.security.JSSubject;
import org.apache.jetspeed.security.PermissionFactory;
@@ -50,7 +50,7 @@
private String name;
private String title;
private String shortTitle;
- private SecurityConstraintsImpl constraints;
+ private SecurityConstraintsContextImpl constraintsContext;
private boolean constraintsEnabled;
private boolean permissionsEnabled;
@@ -61,9 +61,9 @@
BaseElementImpl.pf = pf;
}
- protected BaseElementImpl(SecurityConstraintsImpl constraints)
+ protected BaseElementImpl(SecurityConstraintsContextImpl constraintsContext)
{
- this.constraints = constraints;
+ this.constraintsContext = constraintsContext;
}
/**
@@ -144,9 +144,9 @@
public void checkConstraints(List actions, List userPrincipals, List rolePrincipals, List groupPrincipals, boolean checkNodeOnly, boolean checkParentsOnly) throws SecurityException
{
// check node constraints if available
- if ((constraints != null) && !constraints.isEmpty())
+ if ((constraintsContext != null) && !constraintsContext.isEmpty())
{
- constraints.checkConstraints(actions, userPrincipals, rolePrincipals, groupPrincipals, getEffectivePageSecurity());
+ constraintsContext.checkConstraints(actions, userPrincipals, rolePrincipals, groupPrincipals, getEffectivePageSecurity());
}
}
@@ -258,22 +258,22 @@
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#getSecurityConstraints()
+ * @see org.apache.jetspeed.om.common.SecuredResource#getSecurityConstraintsContext()
*/
- public SecurityConstraints getSecurityConstraints()
+ public SecurityConstraintsContext getSecurityConstraintsContext()
{
- return constraints;
+ return constraintsContext;
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraints()
+ * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraintsContext()
*/
- public SecurityConstraints newSecurityConstraints()
+ public SecurityConstraintsContext newSecurityConstraintsContext()
{
// return universal security constraints instance
// since object members are copied on assignment to
// maintain persistent collection members
- return new SecurityConstraintsImpl();
+ return new SecurityConstraintsContextImpl();
}
/* (non-Javadoc)
@@ -282,19 +282,19 @@
public SecurityConstraint newSecurityConstraint()
{
// return constraints specific security constraint instance
- if ((constraints != null) && (constraints.getSecurityConstraintClass() != null))
+ if ((constraintsContext != null) && (constraintsContext.getSecurityConstraintClass() != null))
{
try
{
- return (SecurityConstraintImpl)constraints.getSecurityConstraintClass().newInstance();
+ return (SecurityConstraintImpl)constraintsContext.getSecurityConstraintClass().newInstance();
}
catch (InstantiationException ie)
{
- throw new ClassCastException("Unable to create security constraint instance: " + constraints.getSecurityConstraintClass().getName() + ", (" + ie + ").");
+ throw new ClassCastException("Unable to create security constraint instance: " + constraintsContext.getSecurityConstraintClass().getName() + ", (" + ie + ").");
}
catch (IllegalAccessException iae)
{
- throw new ClassCastException("Unable to create security constraint instance: " + constraints.getSecurityConstraintClass().getName() + ", (" + iae + ").");
+ throw new ClassCastException("Unable to create security constraint instance: " + constraintsContext.getSecurityConstraintClass().getName() + ", (" + iae + ").");
}
}
// return universal security constraint instance
@@ -302,16 +302,16 @@
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#setSecurityConstraints(org.apache.jetspeed.om.common.SecurityConstraints)
+ * @see org.apache.jetspeed.om.common.SecuredResource#setSecurityConstraintsContext(org.apache.jetspeed.om.common.SecurityConstraintsContext)
*/
- public void setSecurityConstraints(SecurityConstraints constraints)
+ public void setSecurityConstraintsContext(SecurityConstraintsContext constraintsContext)
{
- if (this.constraints != null)
+ if (this.constraintsContext != null)
{
// set constraints configuration in nested om implementation instance
- this.constraints.setOwner(constraints.getOwner());
- this.constraints.setSecurityConstraints(constraints.getSecurityConstraints());
- this.constraints.setSecurityConstraintsRefs(constraints.getSecurityConstraintsRefs());
+ this.constraintsContext.setOwner(constraintsContext.getOwner());
+ this.constraintsContext.setSecurityConstraints(constraintsContext.getSecurityConstraints());
+ this.constraintsContext.setSecurityConstraintsRefs(constraintsContext.getSecurityConstraintsRefs());
}
}
@@ -350,7 +350,7 @@
viewActionList = null;
if (otherActionsList.remove(JetspeedActions.VIEW))
{
- viewActionList = DatabasePageManagerUtils.createList();
+ viewActionList = new ArrayList();
viewActionList.add(JetspeedActions.VIEW);
}
}
@@ -413,9 +413,9 @@
public void resetCachedSecurityConstraints()
{
// propagate to constraints
- if (constraints != null)
+ if (constraintsContext != null)
{
- constraints.resetCachedSecurityConstraints();
+ constraintsContext.resetCachedSecurityConstraints();
}
}
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FilteredFragmentList.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FilteredFragmentList.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FilteredFragmentList.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FilteredFragmentList.java Sun Jan 4 22:04:13 2009
@@ -41,7 +41,7 @@
/* (non-Javadoc)
* @see java.util.List#add(int,java.lang.Object)
*/
- public void add(int index, Object element)
+ public synchronized void add(int index, Object element)
{
// implement for modifiable AbstractList
filteredList.add(index, element);
@@ -57,7 +57,7 @@
/* (non-Javadoc)
* @see java.util.List#get(int)
*/
- public Object get(int index)
+ public synchronized Object get(int index)
{
// implement for modifiable AbstractList
return filteredList.get(index);
@@ -66,7 +66,7 @@
/* (non-Javadoc)
* @see java.util.List#remove(int)
*/
- public Object remove(int index)
+ public synchronized Object remove(int index)
{
// implement for modifiable AbstractList
Object o = filteredList.remove(index);
@@ -89,7 +89,7 @@
/* (non-Javadoc)
* @see java.util.List#set(int,java.lang.Object)
*/
- public Object set(int index, Object element)
+ public synchronized Object set(int index, Object element)
{
// implement for modifiable AbstractList
Object o = filteredList.set(index, element);
@@ -117,7 +117,7 @@
/* (non-Javadoc)
* @see java.util.List#size()
*/
- public int size()
+ public synchronized int size()
{
// implement for modifiable AbstractList
return filteredList.size();
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentImpl.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentImpl.java Sun Jan 4 22:04:13 2009
@@ -18,6 +18,7 @@
import java.security.AccessController;
import java.security.Permission;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -71,7 +72,7 @@
public FragmentImpl()
{
- super(new FragmentSecurityConstraintsImpl());
+ super(new FragmentSecurityConstraintsContextImpl());
}
/**
@@ -228,7 +229,7 @@
{
if (matchedFragments == null)
{
- matchedFragments = DatabasePageManagerUtils.createList();
+ matchedFragments = new ArrayList();
}
matchedFragments.add(this);
}
@@ -264,7 +265,7 @@
*/
List getPropertyMemberKeys()
{
- List keys = DatabasePageManagerUtils.createList();
+ List keys = new ArrayList();
if (layoutRowProperty >= 0)
{
keys.add(ROW_PROPERTY_NAME);
@@ -1015,7 +1016,7 @@
{
// not permitted, copy previously permitted fragments
// to new filteredFragments node set with same comparator
- filteredFragments = DatabasePageManagerUtils.createList();
+ filteredFragments = new ArrayList();
Iterator copyIter = fragments.iterator();
while (copyIter.hasNext())
{
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentList.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentList.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentList.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentList.java Sun Jan 4 22:04:13 2009
@@ -37,7 +37,7 @@
/* (non-Javadoc)
* @see java.util.List#add(int,java.lang.Object)
*/
- public void add(int index, Object element)
+ public synchronized void add(int index, Object element)
{
// implement for modifiable AbstractList:
// add and maintain page implementation reference
@@ -51,7 +51,7 @@
/* (non-Javadoc)
* @see java.util.List#get(int)
*/
- public Object get(int index)
+ public synchronized Object get(int index)
{
// implement for modifiable AbstractList
return fragment.accessFragments().get(index);
@@ -60,7 +60,7 @@
/* (non-Javadoc)
* @see java.util.List#remove(int)
*/
- public Object remove(int index)
+ public synchronized Object remove(int index)
{
// implement for modifiable AbstractList
return fragment.accessFragments().remove(index);
@@ -69,7 +69,7 @@
/* (non-Javadoc)
* @see java.util.List#set(int,java.lang.Object)
*/
- public Object set(int index, Object element)
+ public synchronized Object set(int index, Object element)
{
// implement for modifiable AbstractList:
// set and maintain page implementation reference
@@ -84,7 +84,7 @@
/* (non-Javadoc)
* @see java.util.List#size()
*/
- public int size()
+ public synchronized int size()
{
// implement for modifiable AbstractList
return fragment.accessFragments().size();
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentPreferenceList.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentPreferenceList.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentPreferenceList.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentPreferenceList.java Sun Jan 4 22:04:13 2009
@@ -17,8 +17,8 @@
package org.apache.jetspeed.om.page.impl;
import java.util.AbstractList;
+import java.util.ArrayList;
import java.util.List;
-import org.apache.jetspeed.page.impl.DatabasePageManagerUtils;
/**
* FragmentPreferenceList
@@ -85,7 +85,7 @@
{
if (removedPreferences == null)
{
- removedPreferences = DatabasePageManagerUtils.createList();
+ removedPreferences = new ArrayList();
}
return removedPreferences;
}
@@ -93,7 +93,7 @@
/* (non-Javadoc)
* @see java.util.List#add(int,java.lang.Object)
*/
- public void add(int index, Object element)
+ public synchronized void add(int index, Object element)
{
// implement for modifiable AbstractList:
// validate index
@@ -110,7 +110,7 @@
/* (non-Javadoc)
* @see java.util.List#get(int)
*/
- public Object get(int index)
+ public synchronized Object get(int index)
{
// implement for modifiable AbstractList
return fragment.accessPreferences().get(index);
@@ -119,7 +119,7 @@
/* (non-Javadoc)
* @see java.util.List#remove(int)
*/
- public Object remove(int index)
+ public synchronized Object remove(int index)
{
// implement for modifiable AbstractList:
// save removed element
@@ -134,7 +134,7 @@
/* (non-Javadoc)
* @see java.util.List#set(int,java.lang.Object)
*/
- public Object set(int index, Object element)
+ public synchronized Object set(int index, Object element)
{
// implement for modifiable AbstractList:
// verify preference
@@ -150,7 +150,7 @@
/* (non-Javadoc)
* @see java.util.List#size()
*/
- public int size()
+ public synchronized int size()
{
// implement for modifiable AbstractList
return fragment.accessPreferences().size();
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentPreferenceValueList.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentPreferenceValueList.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentPreferenceValueList.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentPreferenceValueList.java Sun Jan 4 22:04:13 2009
@@ -59,7 +59,7 @@
/* (non-Javadoc)
* @see java.util.List#add(int,java.lang.Object)
*/
- public void add(int index, Object element)
+ public synchronized void add(int index, Object element)
{
// implement for modifiable AbstractList:
// validate index
@@ -101,7 +101,7 @@
/* (non-Javadoc)
* @see java.util.List#get(int)
*/
- public Object get(int index)
+ public synchronized Object get(int index)
{
// implement for modifiable AbstractList:
// unwrap preference value string
@@ -111,7 +111,7 @@
/* (non-Javadoc)
* @see java.util.List#remove(int)
*/
- public Object remove(int index)
+ public synchronized Object remove(int index)
{
// implement for modifiable AbstractList
return preference.accessValues().remove(index);
@@ -120,7 +120,7 @@
/* (non-Javadoc)
* @see java.util.List#set(int,java.lang.Object)
*/
- public Object set(int index, Object element)
+ public synchronized Object set(int index, Object element)
{
// implement for modifiable AbstractList:
// wrap and verify preference value string
@@ -136,7 +136,7 @@
/* (non-Javadoc)
* @see java.util.List#size()
*/
- public int size()
+ public synchronized int size()
{
// implement for modifiable AbstractList
return preference.accessValues().size();
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentPropertyMap.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentPropertyMap.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentPropertyMap.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentPropertyMap.java Sun Jan 4 22:04:13 2009
@@ -18,13 +18,12 @@
import java.util.AbstractMap;
import java.util.AbstractSet;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-import org.apache.jetspeed.page.impl.DatabasePageManagerUtils;
-
/**
* FragmentPropertyMap
*
@@ -53,7 +52,7 @@
/* (non-Javadoc)
* @see java.util.Map#put(java.lang.Object, java.lang.Object)
*/
- public Object put(Object key, Object value)
+ public synchronized Object put(Object key, Object value)
{
// implement for modifiable AbstractMap:
// set map entry value or add new map entry
@@ -77,7 +76,7 @@
/* (non-Javadoc)
* @see java.util.Map#entrySet()
*/
- public Set entrySet()
+ public synchronized Set entrySet()
{
// implement for modifiable AbstractMap
return entrySet;
@@ -85,12 +84,12 @@
private class FragmentPropertiesEntrySet extends AbstractSet
{
- private Collection entries = DatabasePageManagerUtils.createCollection();
+ private Collection entries = new ArrayList();
/* (non-Javadoc)
* @see java.util.Set#add(java.lang.Object)
*/
- public boolean add(Object o)
+ public synchronized boolean add(Object o)
{
// implement for modifiable AbstractSet:
FragmentPropertiesEntry entry = (FragmentPropertiesEntry)o;
@@ -108,7 +107,7 @@
/* (non-Javadoc)
* @see java.util.Set#iterator()
*/
- public Iterator iterator()
+ public synchronized Iterator iterator()
{
// implement for modifiable AbstractSet:
return new Iterator()
@@ -157,7 +156,7 @@
/* (non-Javadoc)
* @see java.util.Set#size()
*/
- public int size()
+ public synchronized int size()
{
// implement for modifiable AbstractSet:
return entries.size();
Copied: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentSecurityConstraintsContextImpl.java (from r728362, portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentSecurityConstraintsImpl.java)
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentSecurityConstraintsContextImpl.java?p2=portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentSecurityConstraintsContextImpl.java&p1=portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentSecurityConstraintsImpl.java&r1=728362&r2=731466&rev=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentSecurityConstraintsImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/FragmentSecurityConstraintsContextImpl.java Sun Jan 4 22:04:13 2009
@@ -17,15 +17,15 @@
package org.apache.jetspeed.om.page.impl;
/**
- * FragmentSecurityConstraintsImpl
+ * FragmentSecurityConstraintsContextImpl
*
* @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
* @version $Id$
*/
-public class FragmentSecurityConstraintsImpl extends SecurityConstraintsImpl
+public class FragmentSecurityConstraintsContextImpl extends SecurityConstraintsContextImpl
{
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.impl.SecurityConstraintsImpl#getSecurityConstraintClass()
+ * @see org.apache.jetspeed.om.page.impl.SecurityConstraintsContextImpl#getSecurityConstraintClass()
*/
public Class getSecurityConstraintClass()
{
@@ -33,7 +33,7 @@
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.impl.SecurityConstraintsImpl#getSecurityConstraintsRefClass()
+ * @see org.apache.jetspeed.om.page.impl.SecurityConstraintsContextImpl#getSecurityConstraintsRefClass()
*/
public Class getSecurityConstraintsRefClass()
{
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/LinkImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/LinkImpl.java?rev=731466&r1=731465&r2=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/LinkImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/LinkImpl.java Sun Jan 4 22:04:13 2009
@@ -36,7 +36,7 @@
public LinkImpl()
{
- super(new LinkSecurityConstraintsImpl());
+ super(new LinkSecurityConstraintsContextImpl());
}
/* (non-Javadoc)
Copied: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/LinkSecurityConstraintsContextImpl.java (from r728362, portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/LinkSecurityConstraintsImpl.java)
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/LinkSecurityConstraintsContextImpl.java?p2=portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/LinkSecurityConstraintsContextImpl.java&p1=portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/LinkSecurityConstraintsImpl.java&r1=728362&r2=731466&rev=731466&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/LinkSecurityConstraintsImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/impl/LinkSecurityConstraintsContextImpl.java Sun Jan 4 22:04:13 2009
@@ -17,15 +17,15 @@
package org.apache.jetspeed.om.page.impl;
/**
- * LinkSecurityConstraintsImpl
+ * LinkSecurityConstraintsContextImpl
*
* @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
* @version $Id$
*/
-public class LinkSecurityConstraintsImpl extends SecurityConstraintsImpl
+public class LinkSecurityConstraintsContextImpl extends SecurityConstraintsContextImpl
{
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.impl.SecurityConstraintsImpl#getSecurityConstraintClass()
+ * @see org.apache.jetspeed.om.page.impl.SecurityConstraintsContextImpl#getSecurityConstraintClass()
*/
public Class getSecurityConstraintClass()
{
@@ -33,7 +33,7 @@
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.page.impl.SecurityConstraintsImpl#getSecurityConstraintsRefClass()
+ * @see org.apache.jetspeed.om.page.impl.SecurityConstraintsContextImpl#getSecurityConstraintsRefClass()
*/
public Class getSecurityConstraintsRefClass()
{
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
|