You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by rw...@apache.org on 2009/01/05 07:04:18 UTC

svn commit: r731466 [7/12] - in /portals/jetspeed-2/portal/branches/JPA_BRANCH: ./ components/jetspeed-cm/src/main/java/org/apache/jetspeed/components/ components/jetspeed-cm/src/main/java/org/apache/jetspeed/test/ components/jetspeed-page-manager/ com...

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageMenuExcludeDefinitionImpl.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/jpa/PageMenuExcludeDefinitionImpl.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageMenuExcludeDefinitionImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageMenuExcludeDefinitionImpl.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,62 @@
+/*
+ * 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.jpa;
+
+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.MenuExcludeDefinition;
+
+/**
+ * PageMenuExcludeDefinitionImpl
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id:$
+ */
+@Entity (name="PageMenuExcludeDefinition")
+@Inheritance (strategy=InheritanceType.SINGLE_TABLE)
+@Table (name="PAGE_MENU")
+@DiscriminatorColumn (name="CLASS_NAME")
+@DiscriminatorValue (value="org.apache.jetspeed.om.page.impl.PageMenuExcludeDefinitionImpl")
+public class PageMenuExcludeDefinitionImpl extends PageBaseMenuDefinitionElement implements MenuExcludeDefinition
+{
+    @Basic
+    @Column (name="NAME")
+    private String name;
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.MenuExcludeDefinition#getName()
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.MenuExcludeDefinition#setName(java.lang.String)
+     */
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageMenuIncludeDefinitionImpl.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/jpa/PageMenuIncludeDefinitionImpl.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageMenuIncludeDefinitionImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageMenuIncludeDefinitionImpl.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,81 @@
+/*
+ * 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.jpa;
+
+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.MenuIncludeDefinition;
+
+/**
+ * PageMenuIncludeDefinitionImpl
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id:$
+ */
+@Entity (name="PageMenuIncludeDefinition")
+@Inheritance (strategy=InheritanceType.SINGLE_TABLE)
+@Table (name="PAGE_MENU")
+@DiscriminatorColumn (name="CLASS_NAME")
+@DiscriminatorValue (value="org.apache.jetspeed.om.page.impl.PageMenuIncludeDefinitionImpl")
+public class PageMenuIncludeDefinitionImpl extends PageBaseMenuDefinitionElement implements MenuIncludeDefinition
+{
+    @Basic
+    @Column (name="NAME")
+    private String name;
+    @Basic
+    @Column (name="IS_NEST")
+    private boolean nest;
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.MenuIncludeDefinition#getName()
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.MenuIncludeDefinition#setName(java.lang.String)
+     */
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.MenuIncludeDefinition#isNest()
+     */
+    public boolean isNest()
+    {
+        return nest;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.MenuIncludeDefinition#setNest(boolean)
+     */
+    public void setNest(boolean nest)
+    {
+        this.nest = nest;
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageMenuMetadataLocalizedFieldImpl.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/jpa/PageMenuMetadataLocalizedFieldImpl.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageMenuMetadataLocalizedFieldImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageMenuMetadataLocalizedFieldImpl.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,51 @@
+/*
+ * 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.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;
+
+/**
+ * PageMenuMetadataLocalizedFieldImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Entity (name="PageMenuMetadata")
+@Inheritance (strategy=InheritanceType.TABLE_PER_CLASS)
+@Table (name="PAGE_MENU_METADATA")
+public class PageMenuMetadataLocalizedFieldImpl extends BaseMetadataLocalizedFieldImpl
+{
+    // new class defined only to facilitate JPA table/class mapping
+
+    @ManyToOne (targetEntity=PageBaseMenuDefinitionMetadata.class, fetch=FetchType.LAZY, optional=false)
+    @JoinColumn (name="MENU_ID", referencedColumnName="MENU_ID")
+    private PageBaseMenuDefinitionMetadata menu;
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.jpa.BaseMetadataLocalizedFieldImpl#setInverseRelationship(java.lang.Object)
+     */
+    public void setInverseRelationship(Object inverse)
+    {
+        menu = (PageBaseMenuDefinitionMetadata)inverse;
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageMenuOptionsDefinitionImpl.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/jpa/PageMenuOptionsDefinitionImpl.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageMenuOptionsDefinitionImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageMenuOptionsDefinitionImpl.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,176 @@
+/*
+ * 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.jpa;
+
+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.MenuOptionsDefinition;
+
+/**
+ * PageMenuOptionsDefinitionImpl
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id:$
+ */
+@Entity (name="PageMenuOptionsDefinition")
+@Inheritance (strategy=InheritanceType.SINGLE_TABLE)
+@Table (name="PAGE_MENU")
+@DiscriminatorColumn (name="CLASS_NAME")
+@DiscriminatorValue (value="org.apache.jetspeed.om.page.impl.PageMenuOptionsDefinitionImpl")
+public class PageMenuOptionsDefinitionImpl extends PageBaseMenuDefinitionElement implements MenuOptionsDefinition
+{
+    @Basic
+    @Column (name="OPTIONS")
+    private String options;
+    @Basic
+    @Column (name="DEPTH")
+    private int depth;
+    @Basic
+    @Column (name="IS_PATHS")
+    private boolean paths;
+    @Basic
+    @Column (name="IS_REGEXP")
+    private boolean regexp;
+    @Basic
+    @Column (name="PROFILE")
+    private String profile;
+    @Basic
+    @Column (name="OPTIONS_ORDER")
+    private String order;
+    @Basic
+    @Column (name="SKIN")
+    private String skin;
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.MenuOptionsDefinition#getOptions()
+     */
+    public String getOptions()
+    {
+        return options;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.MenuOptionsDefinition#setOptions(java.lang.String)
+     */
+    public void setOptions(String options)
+    {
+        this.options = options;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.MenuOptionsDefinition#getDepth()
+     */
+    public int getDepth()
+    {
+        return depth;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.MenuOptionsDefinition#setDepth(int)
+     */
+    public void setDepth(int depth)
+    {
+        this.depth = depth;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.MenuOptionsDefinition#isPaths()
+     */
+    public boolean isPaths()
+    {
+        return paths;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.MenuOptionsDefinition#setPaths(boolean)
+     */
+    public void setPaths(boolean paths)
+    {
+        this.paths = paths;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.MenuOptionsDefinition#isRegexp()
+     */
+    public boolean isRegexp()
+    {
+        return regexp;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.MenuOptionsDefinition#setRegexp(boolean)
+     */
+    public void setRegexp(boolean regexp)
+    {
+        this.regexp = regexp;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.MenuOptionsDefinition#getProfile()
+     */
+    public String getProfile()
+    {
+        return profile;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.MenuOptionsDefinition#setProfile(java.lang.String)
+     */
+    public void setProfile(String locatorName)
+    {
+        profile = locatorName;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.MenuOptionsDefinition#getOrder()
+     */
+    public String getOrder()
+    {
+        return order;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.MenuOptionsDefinition#setOrder(java.lang.String)
+     */
+    public void setOrder(String order)
+    {
+        this.order = order;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.MenuOptionsDefinition#getSkin()
+     */
+    public String getSkin()
+    {
+        return skin;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.folder.MenuOptionsDefinition#setSkin(java.lang.String)
+     */
+    public void setSkin(String name)
+    {
+        skin = name;
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageMenuSeparatorDefinitionImpl.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/jpa/PageMenuSeparatorDefinitionImpl.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageMenuSeparatorDefinitionImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageMenuSeparatorDefinitionImpl.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.page.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;
+
+
+/**
+ * PageMenuSeparatorDefinitionImpl
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id:$
+ */
+@Entity (name="PageMenuSeparatorDefinition")
+@Inheritance (strategy=InheritanceType.SINGLE_TABLE)
+@Table (name="PAGE_MENU")
+@DiscriminatorColumn (name="CLASS_NAME")
+@DiscriminatorValue (value="org.apache.jetspeed.om.page.impl.PageMenuSeparatorDefinitionImpl")
+public class PageMenuSeparatorDefinitionImpl extends PageBaseMenuDefinitionMetadata 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.PageBaseMenuDefinitionMetadata#newPageMetadata()
+     */
+    public PageMetadataImpl newPageMetadata(Collection fields)
+    {
+        PageMetadataImpl pageMetadata = new PageMetadataImpl(PageMenuMetadataLocalizedFieldImpl.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/page/jpa/PageMetadataLocalizedFieldImpl.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/jpa/PageMetadataLocalizedFieldImpl.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageMetadataLocalizedFieldImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageMetadataLocalizedFieldImpl.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,51 @@
+/*
+ * 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.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;
+
+/**
+ * PageMetadataLocalizedFieldImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Entity (name="PageMetadata")
+@Inheritance (strategy=InheritanceType.TABLE_PER_CLASS)
+@Table (name="PAGE_METADATA")
+public class PageMetadataLocalizedFieldImpl extends BaseMetadataLocalizedFieldImpl
+{
+    // new class defined only to facilitate JPA table/class mapping
+
+    @ManyToOne (targetEntity=PageImpl.class, fetch=FetchType.LAZY, optional=false)
+    @JoinColumn (name="PAGE_ID", referencedColumnName="PAGE_ID")
+    private PageImpl page;
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.jpa.BaseMetadataLocalizedFieldImpl#setInverseRelationship(java.lang.Object)
+     */
+    public void setInverseRelationship(Object inverse)
+    {
+        page = (PageImpl)inverse;
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecurityConstraintImpl.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/jpa/PageSecurityConstraintImpl.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecurityConstraintImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecurityConstraintImpl.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,55 @@
+/*
+ * 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.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;
+
+/**
+ * PageSecurityConstraintImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Entity (name="PageConstraint")
+@Inheritance (strategy=InheritanceType.TABLE_PER_CLASS)
+@Table (name="PAGE_CONSTRAINT")
+@AttributeOverrides ({@AttributeOverride (name="id", column=@Column(name="CONSTRAINT_ID"))})
+public class PageSecurityConstraintImpl extends BaseSecurityConstraintImpl
+{
+    // new class defined only to facilitate JPA table/class mapping
+
+    @ManyToOne (targetEntity=PageImpl.class, fetch=FetchType.LAZY, optional=false)
+    @JoinColumn (name="PAGE_ID", referencedColumnName="PAGE_ID")
+    private PageImpl page;
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.jpa.BaseSecurityConstraintImpl#setInverseRelationship(java.lang.Object)
+     */
+    public void setInverseRelationship(Object inverse)
+    {
+        page = (PageImpl)inverse;
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecurityConstraintsDefList.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/jpa/PageSecurityConstraintsDefList.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecurityConstraintsDefList.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecurityConstraintsDefList.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,167 @@
+/*
+ * 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.jpa;
+
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * PageSecurityConstraintsDefList
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+class PageSecurityConstraintsDefList extends AbstractList
+{
+    private PageSecurityImpl pageSecurity;
+
+    private List removedConstraintsDefs;
+
+    PageSecurityConstraintsDefList(PageSecurityImpl pageSecurity)
+    {
+        super();
+        this.pageSecurity = pageSecurity;
+    }
+
+    /**
+     * validateConstraintsDefForAdd
+     *
+     * Validates constraints def to be added to this list.
+     *
+     * @param constraintsDef constraints definition to add
+     * @return list element to add
+     */
+    private SecurityConstraintsDefImpl validateConstraintsDefForAdd(SecurityConstraintsDefImpl constraintsDef)
+    {
+        // only non-null definitions supported
+        if (constraintsDef == null)
+        {
+            throw new NullPointerException("Unable to add null to list.");
+        }
+        // make sure element is unique
+        if (pageSecurity.accessConstraintsDefs().contains(constraintsDef))
+        {
+            throw new IllegalArgumentException("Unable to add duplicate entry to list: " + constraintsDef.getName());
+        }
+        // retrieve from removed list to reuse
+        // previously removed element copying
+        // security constraint defs
+        if (removedConstraintsDefs != null)
+        {
+            int removedIndex = removedConstraintsDefs.indexOf(constraintsDef);
+            if (removedIndex >= 0)
+            {
+                SecurityConstraintsDefImpl addConstraintsDef = constraintsDef;
+                constraintsDef = (SecurityConstraintsDefImpl)removedConstraintsDefs.remove(removedIndex);
+                // TODO: move this logic to copy methods on implementations
+                constraintsDef.setSecurityConstraints(addConstraintsDef.getSecurityConstraints());
+            }
+        }
+        return constraintsDef;
+    }
+
+    /**
+     * getRemovedConstraintsDefs
+     *
+     * @return removed constraints defs tracking collection
+     */
+    private List getRemovedConstraintsDefs()
+    {
+        if (removedConstraintsDefs == null)
+        {
+            removedConstraintsDefs = new ArrayList();
+        }
+        return removedConstraintsDefs;
+    }
+
+    /* (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 > pageSecurity.accessConstraintsDefs().size()))
+        {
+            throw new IndexOutOfBoundsException("Unable to add to list at index: " + index);
+        }
+        // verify constraints definition
+        SecurityConstraintsDefImpl constraintsDef = validateConstraintsDefForAdd((SecurityConstraintsDefImpl)element);
+        // add to underlying ordered list
+        constraintsDef.setInverseRelationship(pageSecurity);
+        pageSecurity.accessConstraintsDefs().add(index, constraintsDef);
+        // clear cached security constraints definition map
+        pageSecurity.clearSecurityConstraintsDefsMap();
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#get(int)
+     */
+    public synchronized Object get(int index)
+    {
+        // implement for modifiable AbstractList
+        return pageSecurity.accessConstraintsDefs().get(index);
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#remove(int)
+     */
+    public synchronized Object remove(int index)
+    {
+        // implement for modifiable AbstractList
+        SecurityConstraintsDefImpl removed = (SecurityConstraintsDefImpl)pageSecurity.accessConstraintsDefs().remove(index);
+        if (removed != null)
+        {
+            removed.setInverseRelationship(null);
+            // save removed element 
+            getRemovedConstraintsDefs().add(removed);
+            // clear cached security constraints definition map
+            pageSecurity.clearSecurityConstraintsDefsMap();
+        }
+        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:
+        // verify constraints definition
+        SecurityConstraintsDefImpl newConstraintsDef = validateConstraintsDefForAdd((SecurityConstraintsDefImpl)element);
+        // set in underlying ordered list
+        newConstraintsDef.setInverseRelationship(pageSecurity);
+        SecurityConstraintsDefImpl constraintsDef = (SecurityConstraintsDefImpl)pageSecurity.accessConstraintsDefs().set(index, newConstraintsDef);
+        constraintsDef.setInverseRelationship(null);
+        // save replaced element
+        getRemovedConstraintsDefs().add(constraintsDef);
+        // clear cached security constraints definition map
+        pageSecurity.clearSecurityConstraintsDefsMap();
+        // return constraints definition
+        return constraintsDef;
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#size()
+     */
+    public synchronized int size()
+    {
+        // implement for modifiable AbstractList
+        return pageSecurity.accessConstraintsDefs().size();
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecurityConstraintsRef.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/jpa/PageSecurityConstraintsRef.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecurityConstraintsRef.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecurityConstraintsRef.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,55 @@
+/*
+ * 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.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;
+
+/**
+ * PageSecurityConstraintsRef
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Entity (name="PageConstraintsRef")
+@Inheritance (strategy=InheritanceType.TABLE_PER_CLASS)
+@Table (name="PAGE_CONSTRAINTS_REF")
+@AttributeOverrides ({@AttributeOverride (name="id", column=@Column(name="CONSTRAINTS_REF_ID"))})
+public class PageSecurityConstraintsRef extends BaseSecurityConstraintsRef
+{
+    // new class defined only to facilitate JPA table/class mapping
+
+    @ManyToOne (targetEntity=PageImpl.class, fetch=FetchType.LAZY, optional=false)
+    @JoinColumn (name="PAGE_ID", referencedColumnName="PAGE_ID")
+    private PageImpl page;
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.jpa.BaseSecurityConstraintsRef#setInverseRelationship(java.lang.Object)
+     */
+    public void setInverseRelationship(Object inverse)
+    {
+        page = (PageImpl)inverse;
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecurityConstraintsRefList.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/jpa/PageSecurityConstraintsRefList.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecurityConstraintsRefList.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecurityConstraintsRefList.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,189 @@
+/*
+ * 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.jpa;
+
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * PageSecurityConstraintsRefList
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+class PageSecurityConstraintsRefList extends AbstractList
+{
+    private PageSecurityImpl pageSecurity;
+
+    private List removedConstraintsRefs;
+
+    PageSecurityConstraintsRefList(PageSecurityImpl pageSecurity)
+    {
+        super();
+        this.pageSecurity = pageSecurity;
+    }
+
+    /**
+     * wrapNameStringForAdd
+     *
+     * Wraps and validates constraints ref name string
+     * to be added to this list.
+     *
+     * @param name constraints ref name string to add
+     * @return list element to add
+     */
+    private PageSecurityGlobalSecurityConstraintsRef wrapNameStringForAdd(String name)
+    {
+        // only non-null names supported
+        if (name == null)
+        {
+            throw new NullPointerException("Unable to add null to list.");
+        }
+        // wrap constraints ref name string
+        PageSecurityGlobalSecurityConstraintsRef constraintsRef = new PageSecurityGlobalSecurityConstraintsRef();
+        constraintsRef.setName(name);
+        // make sure element is unique
+        if (pageSecurity.accessGlobalConstraintsRefs().contains(constraintsRef))
+        {
+            throw new IllegalArgumentException("Unable to add duplicate entry to list: " + constraintsRef.getName());
+        }
+        // retrieve from removed list to reuse
+        // previously removed element
+        if (removedConstraintsRefs != null)
+        {
+            int removedIndex = removedConstraintsRefs.indexOf(constraintsRef);
+            if (removedIndex >= 0)
+            {
+                constraintsRef = (PageSecurityGlobalSecurityConstraintsRef)removedConstraintsRefs.remove(removedIndex);
+            }
+        }
+        return constraintsRef;
+    }
+
+    /**
+     * getRemovedConstraintsRefs
+     *
+     * @return removed constraints refs tracking collection
+     */
+    private List getRemovedConstraintsRefs()
+    {
+        if (removedConstraintsRefs == null)
+        {
+            removedConstraintsRefs = new ArrayList();
+        }
+        return removedConstraintsRefs;
+    }
+
+    /* (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 > pageSecurity.accessGlobalConstraintsRefs().size()))
+        {
+            throw new IndexOutOfBoundsException("Unable to add to list at index: " + index);
+        }
+        // wrap and verify constraints ref name string
+        PageSecurityGlobalSecurityConstraintsRef constraintsRef = wrapNameStringForAdd((String)element);
+        // add to underlying ordered list
+        constraintsRef.setInverseRelationship(pageSecurity);
+        pageSecurity.accessGlobalConstraintsRefs().add(index, constraintsRef);
+        // set apply order in added element
+        if (index > 0)
+        {
+            constraintsRef.setApplyOrder(((PageSecurityGlobalSecurityConstraintsRef)pageSecurity.accessGlobalConstraintsRefs().get(index-1)).getApplyOrder() + 1);
+        }
+        else
+        {
+            constraintsRef.setApplyOrder(0);
+        }
+        // maintain apply order in subsequent elements
+        for (int i = index, limit = pageSecurity.accessGlobalConstraintsRefs().size() - 1; (i < limit); i++)
+        {
+            PageSecurityGlobalSecurityConstraintsRef nextConstraintsRef = (PageSecurityGlobalSecurityConstraintsRef)pageSecurity.accessGlobalConstraintsRefs().get(i + 1);
+            if (nextConstraintsRef.getApplyOrder() <= constraintsRef.getApplyOrder())
+            {
+                // adjust apply order for next element
+                nextConstraintsRef.setApplyOrder(constraintsRef.getApplyOrder() + 1);
+                constraintsRef = nextConstraintsRef;
+            }
+            else
+            {
+                // apply order maintained for remaining list elements
+                break;
+            }
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#get(int)
+     */
+    public synchronized Object get(int index)
+    {
+        // implement for modifiable AbstractList:
+        // unwrap constraints ref name string
+        return ((PageSecurityGlobalSecurityConstraintsRef)pageSecurity.accessGlobalConstraintsRefs().get(index)).getName();
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#remove(int)
+     */
+    public synchronized Object remove(int index)
+    {
+        // implement for modifiable AbstractList:
+        // save removed element 
+        PageSecurityGlobalSecurityConstraintsRef removed = (PageSecurityGlobalSecurityConstraintsRef)pageSecurity.accessGlobalConstraintsRefs().remove(index);
+        if (removed != null)
+        {
+            removed.setInverseRelationship(null);
+            getRemovedConstraintsRefs().add(removed);
+        }
+        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 constraints ref name string
+        PageSecurityGlobalSecurityConstraintsRef newConstraintsRef = wrapNameStringForAdd((String)element);
+        // set in underlying ordered list
+        newConstraintsRef.setInverseRelationship(pageSecurity);
+        PageSecurityGlobalSecurityConstraintsRef constraintsRef = (PageSecurityGlobalSecurityConstraintsRef)pageSecurity.accessGlobalConstraintsRefs().set(index, newConstraintsRef);
+        constraintsRef.setInverseRelationship(null);
+        // set apply order in new element
+        newConstraintsRef.setApplyOrder(constraintsRef.getApplyOrder());
+        // save replaced element
+        getRemovedConstraintsRefs().add(constraintsRef);
+        // return unwrapped constraints ref name string
+        return constraintsRef.getName();
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#size()
+     */
+    public synchronized int size()
+    {
+        // implement for modifiable AbstractList
+        return pageSecurity.accessGlobalConstraintsRefs().size();
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecurityGlobalSecurityConstraintsRef.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/jpa/PageSecurityGlobalSecurityConstraintsRef.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecurityGlobalSecurityConstraintsRef.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecurityGlobalSecurityConstraintsRef.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,55 @@
+/*
+ * 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.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;
+
+/**
+ * PageSecurityConstraintsRef
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Entity (name="PageSecurityConstraintsRef")
+@Inheritance (strategy=InheritanceType.TABLE_PER_CLASS)
+@Table (name="PAGE_SEC_CONSTRAINTS_REF")
+@AttributeOverrides ({@AttributeOverride (name="id", column=@Column(name="CONSTRAINTS_REF_ID"))})
+public class PageSecurityGlobalSecurityConstraintsRef extends BaseSecurityConstraintsRef
+{
+    // new class defined only to facilitate JPA table/class mapping
+
+    @ManyToOne (targetEntity=PageSecurityImpl.class, fetch=FetchType.LAZY, optional=false)
+    @JoinColumn (name="PAGE_SECURITY_ID", referencedColumnName="PAGE_SECURITY_ID")
+    private PageSecurityImpl pageSecurity;
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.jpa.BaseSecurityConstraintsRef#setInverseRelationship(java.lang.Object)
+     */
+    public void setInverseRelationship(Object inverse)
+    {
+        pageSecurity = (PageSecurityImpl)inverse;
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecurityImpl.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/jpa/PageSecurityImpl.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecurityImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecurityImpl.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,432 @@
+/*
+ * 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.jpa;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.AttributeOverride;
+import javax.persistence.AttributeOverrides;
+import javax.persistence.CascadeType;
+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.NamedQuery;
+import javax.persistence.NamedQueries;
+import javax.persistence.OneToMany;
+import javax.persistence.OrderBy;
+import javax.persistence.PostLoad;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import org.apache.jetspeed.om.common.SecurityConstraint;
+import org.apache.jetspeed.om.common.SecurityConstraintsContext;
+import org.apache.jetspeed.om.folder.jpa.FolderImpl;
+import org.apache.jetspeed.om.page.PageSecurity;
+import org.apache.jetspeed.om.page.SecurityConstraintsDef;
+import org.apache.jetspeed.page.document.Node;
+import org.apache.jetspeed.page.document.jpa.DocumentImpl;
+import org.apache.jetspeed.page.jpa.DatabasePageManagerUtils;
+
+/**
+ * PageSecurityImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Entity (name="PageSecurity")
+@Inheritance (strategy=InheritanceType.TABLE_PER_CLASS)
+@Table (name="PAGE_SECURITY")
+@AttributeOverrides ({@AttributeOverride (name="id", column=@Column(name="PAGE_SECURITY_ID"))})
+@NamedQueries({@NamedQuery(name="FOLDER_PAGE_SECURITY", query="select ps from PageSecurity ps where ps.parent = :folder"),
+               @NamedQuery(name="PAGE_SECURITY", query="select ps from PageSecurity ps where ps.path = :path")})
+public class PageSecurityImpl extends DocumentImpl implements PageSecurity
+{
+    @ManyToOne (targetEntity=FolderImpl.class, fetch=FetchType.LAZY, optional=true, cascade=CascadeType.PERSIST)
+    @JoinColumn (name="PARENT_ID", referencedColumnName="FOLDER_ID")
+    private FolderImpl parent;
+    @OneToMany (targetEntity=SecurityConstraintsDefImpl.class, mappedBy="pageSecurity", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
+    @OrderBy (value="name ASC")
+    private List constraintsDefs;
+    @OneToMany (targetEntity=PageSecurityGlobalSecurityConstraintsRef.class, mappedBy="pageSecurity", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
+    @OrderBy (value="applyOrder ASC")
+    private List globalConstraintsRefs;
+    
+    @PostLoad
+    private void eagerFetchCollections()
+    {
+        if (constraintsDefs != null)
+        {
+            constraintsDefs.size();
+        }
+        if (globalConstraintsRefs != null)
+        {
+            globalConstraintsRefs.size();
+        }
+    }
+
+    @Transient
+    private PageSecurityConstraintsDefList securityConstraintsDefs;
+    @Transient
+    private Map securityConstraintsDefsMap;
+    @Transient
+    private PageSecurityConstraintsRefList globalSecurityConstraintsRefs;    
+    @Transient
+    private String title;
+
+    /**
+     * Default constructor.
+     */
+    public PageSecurityImpl()
+    {
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraintsContext()
+     */
+    public SecurityConstraintsContext newSecurityConstraintsContext()
+    {
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraint()
+     */
+    public SecurityConstraint newSecurityConstraint()
+    {
+        // return specific security constraint definition instance
+        return new PageSecuritySecurityConstraintImpl();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.document.jpa.NodeImpl#getMetadataFields()
+     */
+    protected Collection getMetadataFields()
+    {
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.document.jpa.NodeImpl#getParentNode()
+     */
+    protected Node getParentNode()
+    {
+        return parent;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.document.jpa.NodeImpl#setParentNode(org.apache.jetspeed.page.document.Node)
+     */
+    protected void setParentNode(Node parent)
+    {
+        this.parent = (FolderImpl)parent;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.jpa.BaseElementImpl#accessSecurityConstraintsContext()
+     */
+    protected SecurityConstraintsContextImpl accessSecurityConstraintsContext()
+    {
+        return null;
+    }
+    
+    /**
+     * accessConstraintsDefs
+     *
+     * Access mutable persistent collection member for List wrappers.
+     *
+     * @return persistent collection
+     */
+    List accessConstraintsDefs()
+    {
+        // create initial collection if necessary
+        if (constraintsDefs == null)
+        {
+            constraintsDefs = DatabasePageManagerUtils.createList();
+        }
+        return constraintsDefs;
+    }
+
+    /**
+     * accessGlobalConstraintsRefs
+     *
+     * Access mutable persistent collection member for List wrappers.
+     *
+     * @return persistent collection
+     */
+    List accessGlobalConstraintsRefs()
+    {
+        // create initial collection if necessary
+        if (globalConstraintsRefs == null)
+        {
+            globalConstraintsRefs = DatabasePageManagerUtils.createList();
+        }
+        return globalConstraintsRefs;
+    }
+
+    /**
+     * clearSecurityConstraintsDefsMap
+     *
+     * Clear previously cached security constraints definitions map.
+     */
+    synchronized void clearSecurityConstraintsDefsMap()
+    {
+        securityConstraintsDefsMap = null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.PageSecurity#getSecurityConstraintsDefs()
+     */
+    public List getSecurityConstraintsDefs()
+    {
+        // return mutable constraints defs list
+        // by using list wrapper to manage
+        // element uniqueness
+        if (securityConstraintsDefs == null)
+        {
+            securityConstraintsDefs = new PageSecurityConstraintsDefList(this);
+        }
+        return securityConstraintsDefs;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraintsDef()
+     */
+    public SecurityConstraintsDef newSecurityConstraintsDef()
+    {
+        // return specific security constraints definition instance
+        return new SecurityConstraintsDefImpl();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.PageSecurity#setSecurityConstraintsDefs(java.util.List)
+     */
+    public void setSecurityConstraintsDefs(List definitions)
+    {
+        // set constraints defs by replacing existing
+        // entries with new elements if new collection
+        // is specified
+        List securityConstraintsDefs = getSecurityConstraintsDefs();
+        if (definitions != securityConstraintsDefs)
+        {
+            // replace all constraints definitions
+            securityConstraintsDefs.clear();
+            if (definitions != null)
+            {
+                securityConstraintsDefs.addAll(definitions);
+            }
+        }
+        // clear cached security constraints definition map
+        clearSecurityConstraintsDefsMap();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.PageSecurity#getSecurityConstraintsDef(java.lang.String)
+     */
+    public synchronized SecurityConstraintsDef getSecurityConstraintsDef(String name)
+    {
+        // build and cache security constraints definitions
+        // map if necessary upon realization or after modification
+        if ((getSecurityConstraintsDefs() != null) && (securityConstraintsDefsMap == null))
+        {
+            securityConstraintsDefsMap = new HashMap((getSecurityConstraintsDefs().size() * 2) + 1);
+            Iterator definitionsIter = getSecurityConstraintsDefs().iterator();
+            while (definitionsIter.hasNext())
+            {
+                SecurityConstraintsDef definition = (SecurityConstraintsDef)definitionsIter.next();
+                String definitionName = definition.getName();
+                if (!securityConstraintsDefsMap.containsKey(definitionName))
+                {
+                    securityConstraintsDefsMap.put(definitionName, definition);
+                }
+            }
+        }
+        // lookup constraints definition using cached map 
+        if (securityConstraintsDefsMap != null)
+        {
+            return (SecurityConstraintsDef)securityConstraintsDefsMap.get(name);
+        }
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.PageSecurity#getGlobalSecurityConstraintsRefs()
+     */
+    public List getGlobalSecurityConstraintsRefs()
+    {
+        // return mutable constraints refs list
+        // by using list wrapper to manage apply
+        // order and element uniqueness
+        if (globalSecurityConstraintsRefs == null)
+        {
+            globalSecurityConstraintsRefs = new PageSecurityConstraintsRefList(this);
+        }
+        return globalSecurityConstraintsRefs;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.PageSecurity#setGlobalSecurityConstraintsRefs(java.util.List)
+     */
+    public void setGlobalSecurityConstraintsRefs(List constraintsRefs)
+    {
+        // set constraints refs using ordered ref
+        // names by replacing existing entries with
+        // new elements if new collection is specified
+        List globalSecurityConstraintsRefs = getGlobalSecurityConstraintsRefs();
+        if (constraintsRefs != globalSecurityConstraintsRefs)
+        {
+            // replace all constraints ref names
+            globalSecurityConstraintsRefs.clear();
+            if (constraintsRefs != null)
+            {
+                globalSecurityConstraintsRefs.addAll(constraintsRefs);
+            }
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.document.Node#getType()
+     */
+    public String getType()
+    {
+        return DOCUMENT_TYPE;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseElement#getTitle()
+     */
+    public String getTitle()
+    {
+        // default title to page security name
+        if (title == null)
+        {
+            title = defaultTitleFromName();
+        }
+        return title;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseElement#setTitle(java.lang.String)
+     */
+    public void setTitle(String title)
+    {
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseElement#getShortTitle()
+     */
+    public String getShortTitle()
+    {
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.BaseElement#setShortTitle(java.lang.String)
+     */
+    public void setShortTitle(String shortTitle)
+    {
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.document.Node#isHidden()
+     */
+    public boolean isHidden()
+    {
+        return true;
+    }    
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.document.Node#setHidden(boolean)
+     */
+    public void setHidden(boolean hidden)
+    {
+    }    
+
+    // **************************************************************************
+    // Begin Embedded SecurityConstraintsContextImpl
+    //
+    // Embeddable/Embedded with relationships not supported in JPA 1.0;
+    // otherwise, this should have been implemented as an embedded type
+    // derived from SecurityConstraintsContextImpl. Instead, BaseElementImpl
+    // derives from SecurityConstraintsContextImpl and the context
+    // protocol is implemented on this object.
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraints#getOwner()
+     */
+    public String getOwner()
+    {
+        return null;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraints#setOwner(java.lang.String)
+     */
+    public void setOwner(String owner)
+    {
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.jpa.SecurityConstraintsContextImpl#accessConstraintsRefs()
+     */
+    protected List accessConstraintsRefs()
+    {
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.jpa.SecurityConstraintsContextImpl#accessConstraints()
+     */
+    protected List accessConstraints()
+    {
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.jpa.SecurityConstraintsContextImpl#getSecurityConstraintClass()
+     */
+    protected Class getSecurityConstraintClass()
+    {
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.jpa.SecurityConstraintsContextImpl#getSecurityConstraintsRefClass()
+     */
+    protected Class getSecurityConstraintsRefClass()
+    {
+        return null;        
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.common.SecurityConstraints#isEmpty()
+     */
+    public boolean isEmpty()
+    {
+        return true;
+    }
+
+    // End Embedded SecurityConstraintsContextImpl
+    // **************************************************************************
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecuritySecurityConstraintImpl.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/jpa/PageSecuritySecurityConstraintImpl.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecuritySecurityConstraintImpl.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/PageSecuritySecurityConstraintImpl.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,55 @@
+/*
+ * 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.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;
+
+/**
+ * PageSecuritySecurityConstraintImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Entity (name="PageSecurityConstraintDef")
+@Inheritance (strategy=InheritanceType.TABLE_PER_CLASS)
+@Table (name="PAGE_SEC_CONSTRAINT_DEF")
+@AttributeOverrides ({@AttributeOverride (name="id", column=@Column(name="CONSTRAINT_DEF_ID"))})
+public class PageSecuritySecurityConstraintImpl extends BaseSecurityConstraintImpl
+{
+    // new class defined only to facilitate JPA table/class mapping
+
+    @ManyToOne (targetEntity=SecurityConstraintsDefImpl.class, fetch=FetchType.LAZY, optional=false)
+    @JoinColumn (name="CONSTRAINTS_DEF_ID", referencedColumnName="CONSTRAINTS_DEF_ID")
+    private SecurityConstraintsDefImpl constraintsDef;
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.jpa.BaseSecurityConstraintImpl#setInverseRelationship(java.lang.Object)
+     */
+    public void setInverseRelationship(Object inverse)
+    {
+        constraintsDef = (SecurityConstraintsDefImpl)inverse;
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/SecurityConstraintDefList.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/jpa/SecurityConstraintDefList.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/SecurityConstraintDefList.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/SecurityConstraintDefList.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,147 @@
+/*
+ * 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.jpa;
+
+import java.util.AbstractList;
+
+/**
+ * SecurityConstraintDefList
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+class SecurityConstraintDefList extends AbstractList
+{
+    private SecurityConstraintsDefImpl constraintsDef;
+
+    SecurityConstraintDefList(SecurityConstraintsDefImpl constraintsDef)
+    {
+        super();
+        this.constraintsDef = constraintsDef;
+    }
+
+    /**
+     * validateConstraintForAdd
+     *
+     * Validates constraint to be added to this list.
+     *
+     * @param constraint constraint to add
+     * @return list element to add
+     */
+    private PageSecuritySecurityConstraintImpl validateConstraintForAdd(PageSecuritySecurityConstraintImpl constraint)
+    {
+        // validate constraint instance class
+        if (constraint == null)
+        {
+            throw new NullPointerException("Unable to add null to list.");
+        }
+        return constraint;
+    }
+
+    /* (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 > constraintsDef.accessConstraintDefs().size()))
+        {
+            throw new IndexOutOfBoundsException("Unable to add to list at index: " + index);
+        }
+        // verify constraint
+        PageSecuritySecurityConstraintImpl constraint = validateConstraintForAdd((PageSecuritySecurityConstraintImpl)element);
+        // add to underlying ordered list
+        constraint.setInverseRelationship(constraintsDef);
+        constraintsDef.accessConstraintDefs().add(index, constraint);
+        // set apply order in added element
+        if (index > 0)
+        {
+            constraint.setApplyOrder(((PageSecuritySecurityConstraintImpl)constraintsDef.accessConstraintDefs().get(index-1)).getApplyOrder() + 1);
+        }
+        else
+        {
+            constraint.setApplyOrder(0);
+        }
+        // maintain apply order in subsequent elements
+        for (int i = index, limit = constraintsDef.accessConstraintDefs().size() - 1; (i < limit); i++)
+        {
+            PageSecuritySecurityConstraintImpl nextConstraint = (PageSecuritySecurityConstraintImpl)constraintsDef.accessConstraintDefs().get(i + 1);
+            if (nextConstraint.getApplyOrder() <= constraint.getApplyOrder())
+            {
+                // adjust apply order for next element
+                nextConstraint.setApplyOrder(constraint.getApplyOrder() + 1);
+                constraint = nextConstraint;
+            }
+            else
+            {
+                // apply order maintained for remaining list elements
+                break;
+            }
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#get(int)
+     */
+    public synchronized Object get(int index)
+    {
+        // implement for modifiable AbstractList
+        return constraintsDef.accessConstraintDefs().get(index);
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#remove(int)
+     */
+    public synchronized Object remove(int index)
+    {
+        // implement for modifiable AbstractList
+        PageSecuritySecurityConstraintImpl removed = (PageSecuritySecurityConstraintImpl)constraintsDef.accessConstraintDefs().remove(index);
+        if (removed != null)
+        {
+            removed.setInverseRelationship(null);
+        }
+        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:
+        // verify constraint
+        PageSecuritySecurityConstraintImpl newConstraint = validateConstraintForAdd((PageSecuritySecurityConstraintImpl)element);
+        // set in underlying ordered list
+        newConstraint.setInverseRelationship(constraintsDef);
+        PageSecuritySecurityConstraintImpl constraint = (PageSecuritySecurityConstraintImpl)constraintsDef.accessConstraintDefs().set(index, newConstraint);
+        constraint.setInverseRelationship(null);
+        // set apply order in new element
+        newConstraint.setApplyOrder(constraint.getApplyOrder());
+        // return constraint
+        return constraint;
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#size()
+     */
+    public synchronized int size()
+    {
+        // implement for modifiable AbstractList
+        return constraintsDef.accessConstraintDefs().size();
+    }
+}

Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/SecurityConstraintList.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/jpa/SecurityConstraintList.java?rev=731466&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/SecurityConstraintList.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/om/page/jpa/SecurityConstraintList.java Sun Jan  4 22:04:13 2009
@@ -0,0 +1,162 @@
+/*
+ * 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.jpa;
+
+import java.util.AbstractList;
+
+import org.apache.jetspeed.om.page.jpa.BaseSecurityConstraintImpl;
+
+/**
+ * SecurityConstraintList
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+class SecurityConstraintList extends AbstractList
+{
+    private SecurityConstraintsContextImpl constraints;
+    private Object constraintsOwningObject;
+
+    SecurityConstraintList(SecurityConstraintsContextImpl constraints)
+    {
+        super();
+        this.constraints = constraints;
+        this.constraintsOwningObject = constraints.getOwningObject();
+    }
+
+    /**
+     * validateConstraintForAdd
+     *
+     * Validates constraint to be added to this list.
+     *
+     * @param constraint to add
+     * @return list element to add
+     */
+    private BaseSecurityConstraintImpl validateConstraintForAdd(BaseSecurityConstraintImpl constraint)
+    {
+        // validate constraint instance class
+        if (constraint == null)
+        {
+            throw new NullPointerException("Unable to add null to list.");
+        }
+        if ((constraints.getSecurityConstraintClass() != null) &&
+            !constraints.getSecurityConstraintClass().isInstance(constraint))
+        {
+            throw new ClassCastException("Unable to add list element instance: expected " + constraints.getSecurityConstraintClass().getName() + ", got " + constraint.getClass().getName() + ".");
+        }
+        return constraint;
+    }
+
+    /* (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 > constraints.accessConstraints().size()))
+        {
+            throw new IndexOutOfBoundsException("Unable to add to list at index: " + index);
+        }
+        // verify constraint
+        BaseSecurityConstraintImpl constraint = validateConstraintForAdd((BaseSecurityConstraintImpl)element);
+        // add to underlying ordered list
+        constraint.setInverseRelationship(constraintsOwningObject);
+        constraints.accessConstraints().add(index, constraint);
+        // set apply order in added element
+        if (index > 0)
+        {
+            constraint.setApplyOrder(((BaseSecurityConstraintImpl)constraints.accessConstraints().get(index-1)).getApplyOrder() + 1);
+        }
+        else
+        {
+            constraint.setApplyOrder(0);
+        }
+        // maintain apply order in subsequent elements
+        for (int i = index, limit = constraints.accessConstraints().size() - 1; (i < limit); i++)
+        {
+            BaseSecurityConstraintImpl nextConstraint = (BaseSecurityConstraintImpl)constraints.accessConstraints().get(i + 1);
+            if (nextConstraint.getApplyOrder() <= constraint.getApplyOrder())
+            {
+                // adjust apply order for next element
+                nextConstraint.setApplyOrder(constraint.getApplyOrder() + 1);
+                constraint = nextConstraint;
+            }
+            else
+            {
+                // apply order maintained for remaining list elements
+                break;
+            }
+        }
+        // clear all cached security constraints
+        constraints.clearAllSecurityConstraints();
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#get(int)
+     */
+    public synchronized Object get(int index)
+    {
+        // implement for modifiable AbstractList
+        return constraints.accessConstraints().get(index);
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#remove(int)
+     */
+    public synchronized Object remove(int index)
+    {
+        // implement for modifiable AbstractList
+        BaseSecurityConstraintImpl removed = (BaseSecurityConstraintImpl)constraints.accessConstraints().remove(index);
+        if (removed != null)
+        {
+            removed.setInverseRelationship(null);
+            // clear all cached security constraints
+            constraints.clearAllSecurityConstraints();
+        }
+        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:
+        // verify constraint
+        BaseSecurityConstraintImpl newConstraint = validateConstraintForAdd((BaseSecurityConstraintImpl)element);
+        // set in underlying ordered list
+        newConstraint.setInverseRelationship(constraintsOwningObject);
+        BaseSecurityConstraintImpl constraint = (BaseSecurityConstraintImpl)constraints.accessConstraints().set(index, newConstraint);
+        constraint.setInverseRelationship(null);
+        // set apply order in new element
+        newConstraint.setApplyOrder(constraint.getApplyOrder());
+        // clear all cached security constraints
+        constraints.clearAllSecurityConstraints();
+        // return constraint
+        return constraint;
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#size()
+     */
+    public synchronized int size()
+    {
+        // implement for modifiable AbstractList
+        return constraints.accessConstraints().size();
+    }
+}



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