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 2005/12/02 17:52:40 UTC
svn commit: r351770 [2/3] - in /portals/jetspeed-2/trunk:
components/page-manager/src/java/JETSPEED-INF/ojb/
components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/
components/page-manager/src/java/org/apache/jetspeed/om/folder/psml/ compo...
Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuDefinitionList.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuDefinitionList.java?rev=351770&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuDefinitionList.java (added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuDefinitionList.java Fri Dec 2 08:52:05 2005
@@ -0,0 +1,207 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed 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.impl;
+
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.jetspeed.om.folder.MenuDefinition;
+
+/**
+ * FolderMenuDefinitionList
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+class FolderMenuDefinitionList extends AbstractList
+{
+ private FolderImpl folder;
+
+ private List removedMenuDefinitions;
+
+ FolderMenuDefinitionList(FolderImpl folder)
+ {
+ super();
+ this.folder = folder;
+ }
+
+ /**
+ * validateDefinitionForAdd
+ *
+ * Validates menu definition to be added to this list.
+ *
+ * @param definition menu definition to add
+ * @return list element to add
+ */
+ private FolderMenuDefinitionImpl validateDefinitionForAdd(Object definition)
+ {
+ // only non-null definitions supported
+ if (definition == null)
+ {
+ throw new NullPointerException("Unable to add null to list.");
+ }
+ if (!(definition instanceof FolderMenuDefinitionImpl))
+ {
+ // duplicate menu element from equivalent types
+ if (definition instanceof MenuDefinition)
+ {
+ MenuDefinition origDefinition = (MenuDefinition)definition;
+ FolderMenuDefinitionImpl dupDefinition = new FolderMenuDefinitionImpl();
+ // TODO: move this logic to copy methods on implementations
+ dupDefinition.setName(origDefinition.getName());
+ dupDefinition.setOptions(origDefinition.getOptions());
+ dupDefinition.setDepth(origDefinition.getDepth());
+ dupDefinition.setPaths(origDefinition.isPaths());
+ dupDefinition.setRegexp(origDefinition.isRegexp());
+ dupDefinition.setProfile(origDefinition.getProfile());
+ dupDefinition.setOrder(origDefinition.getOrder());
+ dupDefinition.setSkin(origDefinition.getSkin());
+ dupDefinition.setTitle(origDefinition.getTitle());
+ dupDefinition.setShortTitle(origDefinition.getShortTitle());
+ dupDefinition.setMenuElements(origDefinition.getMenuElements());
+ dupDefinition.getMetadata().copyFields(origDefinition.getMetadata().getFields());
+ definition = dupDefinition;
+ }
+ else
+ {
+ throw new ClassCastException("Unable to create menu element list instance from: " + definition.getClass().getName() + ".");
+ }
+ }
+ // make sure element is unique
+ if (folder.accessMenus().contains(definition))
+ {
+ throw new IllegalArgumentException("Unable to add duplicate entry to list: " + ((FolderMenuDefinitionImpl)definition).getName());
+ }
+ // retrieve from removed list to reuse
+ // previously removed element copying
+ // menu definition data
+ if (removedMenuDefinitions != null)
+ {
+ int removedIndex = removedMenuDefinitions.indexOf(definition);
+ if (removedIndex >= 0)
+ {
+ // reuse menu definition with matching name
+ FolderMenuDefinitionImpl addDefinition = (FolderMenuDefinitionImpl)definition;
+ FolderMenuDefinitionImpl removedDefinition = (FolderMenuDefinitionImpl)removedMenuDefinitions.remove(removedIndex);
+ // TODO: move this logic to copy methods on implementations
+ // copy menu definition members
+ removedDefinition.setOptions(addDefinition.getOptions());
+ removedDefinition.setDepth(addDefinition.getDepth());
+ removedDefinition.setPaths(addDefinition.isPaths());
+ removedDefinition.setRegexp(addDefinition.isRegexp());
+ removedDefinition.setProfile(addDefinition.getProfile());
+ removedDefinition.setOrder(addDefinition.getOrder());
+ removedDefinition.setSkin(addDefinition.getSkin());
+ removedDefinition.setTitle(addDefinition.getTitle());
+ removedDefinition.setShortTitle(addDefinition.getShortTitle());
+ removedDefinition.setMenuElements(addDefinition.getMenuElements());
+ // copy menu definition metadata members
+ // TODO: strengthen... this code is not robust
+ // and may fail if multiple edits without a db
+ // update occur and duplicate metadata members
+ // are removed in one operation and reinserted
+ // in a subsequent operation because the
+ // metadata members are required to be unique
+ // and a removal list is not maintained for the
+ // metadata fields collections yet
+ removedDefinition.getMetadata().copyFields(addDefinition.getMetadata().getFields());
+ definition = removedDefinition;
+ }
+ }
+ return (FolderMenuDefinitionImpl)definition;
+ }
+
+ /**
+ * getRemovedMenuDefinitions
+ *
+ * @return removed menu definitions tracking collection
+ */
+ private List getRemovedMenuDefinitions()
+ {
+ if (removedMenuDefinitions == null)
+ {
+ removedMenuDefinitions = new ArrayList(folder.accessMenus().size());
+ }
+ return removedMenuDefinitions;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.List#add(int,java.lang.Object)
+ */
+ public void add(int index, Object element)
+ {
+ // implement for modifiable AbstractList:
+ // validate index
+ if ((index < 0) || (index > folder.accessMenus().size()))
+ {
+ throw new IndexOutOfBoundsException("Unable to add to list at index: " + index);
+ }
+ // verify menu definition
+ FolderMenuDefinitionImpl definition = validateDefinitionForAdd(element);
+ // add to underlying ordered list
+ folder.accessMenus().add(index, definition);
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.List#get(int)
+ */
+ public Object get(int index)
+ {
+ // implement for modifiable AbstractList
+ return folder.accessMenus().get(index);
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.List#remove(int)
+ */
+ public Object remove(int index)
+ {
+ // implement for modifiable AbstractList:
+ // save removed element
+ FolderMenuDefinitionImpl removed = (FolderMenuDefinitionImpl)folder.accessMenus().remove(index);
+ if (removed != null)
+ {
+ getRemovedMenuDefinitions().add(removed);
+ }
+ return removed;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.List#set(int,java.lang.Object)
+ */
+ public Object set(int index, Object element)
+ {
+ // implement for modifiable AbstractList:
+ // verify menu definition
+ FolderMenuDefinitionImpl newDefinition = validateDefinitionForAdd(element);
+ // set in underlying ordered list
+ FolderMenuDefinitionImpl definition = (FolderMenuDefinitionImpl)folder.accessMenus().set(index, newDefinition);
+ // save replaced element
+ getRemovedMenuDefinitions().add(definition);
+ // return menu definition
+ return definition;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.List#size()
+ */
+ public int size()
+ {
+ // implement for modifiable AbstractList
+ return folder.accessMenus().size();
+ }
+}
Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuDefinitionList.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuExcludeDefinitionImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuExcludeDefinitionImpl.java?rev=351770&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuExcludeDefinitionImpl.java (added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuExcludeDefinitionImpl.java Fri Dec 2 08:52:05 2005
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed 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.impl;
+
+import org.apache.jetspeed.om.folder.MenuExcludeDefinition;
+
+/**
+ * FolderMenuExcludeDefinitionImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id:$
+ */
+public class FolderMenuExcludeDefinitionImpl extends BaseMenuExcludeDefinitionImpl implements MenuExcludeDefinition, FolderMenuDefinitionElement
+{
+ // new class defined only to facilitate OJB table/class mapping
+}
Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuExcludeDefinitionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuIncludeDefinitionImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuIncludeDefinitionImpl.java?rev=351770&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuIncludeDefinitionImpl.java (added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuIncludeDefinitionImpl.java Fri Dec 2 08:52:05 2005
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed 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.impl;
+
+import org.apache.jetspeed.om.folder.MenuIncludeDefinition;
+
+/**
+ * FolderMenuIncludeDefinitionImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id:$
+ */
+public class FolderMenuIncludeDefinitionImpl extends BaseMenuIncludeDefinitionImpl implements MenuIncludeDefinition, FolderMenuDefinitionElement
+{
+ // new class defined only to facilitate OJB table/class mapping
+}
Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuIncludeDefinitionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuMetadataLocalizedFieldImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuMetadataLocalizedFieldImpl.java?rev=351770&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuMetadataLocalizedFieldImpl.java (added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuMetadataLocalizedFieldImpl.java Fri Dec 2 08:52:05 2005
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed 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.impl;
+
+import org.apache.jetspeed.om.page.PageLocalizedFieldImpl;
+
+/**
+ * FolderMenuMetadataLocalizedFieldImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+public class FolderMenuMetadataLocalizedFieldImpl extends PageLocalizedFieldImpl
+{
+ // new class defined only to facilitate OJB table/class mapping
+}
Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuMetadataLocalizedFieldImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuOptionsDefinitionImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuOptionsDefinitionImpl.java?rev=351770&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuOptionsDefinitionImpl.java (added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuOptionsDefinitionImpl.java Fri Dec 2 08:52:05 2005
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed 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.impl;
+
+import org.apache.jetspeed.om.folder.MenuOptionsDefinition;
+
+/**
+ * FolderMenuOptionsDefinitionImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id:$
+ */
+public class FolderMenuOptionsDefinitionImpl extends BaseMenuOptionsDefinitionImpl implements MenuOptionsDefinition, FolderMenuDefinitionElement
+{
+ // new class defined only to facilitate OJB table/class mapping
+}
Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuOptionsDefinitionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuSeparatorDefinitionImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuSeparatorDefinitionImpl.java?rev=351770&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuSeparatorDefinitionImpl.java (added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuSeparatorDefinitionImpl.java Fri Dec 2 08:52:05 2005
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed 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.impl;
+
+import java.util.Collection;
+
+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:$
+ */
+public class FolderMenuSeparatorDefinitionImpl extends BaseMenuSeparatorDefinitionImpl implements MenuSeparatorDefinition, FolderMenuDefinitionElement
+{
+ // new class defined only to facilitate OJB table/class mapping
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.folder.impl.BaseMenuDefinitionMetadata#newPageMetadata()
+ */
+ public PageMetadataImpl newPageMetadata(Collection fields)
+ {
+ PageMetadataImpl pageMetadata = new PageMetadataImpl(FolderMenuMetadataLocalizedFieldImpl.class);
+ pageMetadata.setFields(fields);
+ return pageMetadata;
+ }
+}
Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/impl/FolderMenuSeparatorDefinitionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/psml/FolderImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/psml/FolderImpl.java?rev=351770&r1=351769&r2=351770&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/psml/FolderImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/folder/psml/FolderImpl.java Fri Dec 2 08:52:05 2005
@@ -28,6 +28,11 @@
import org.apache.jetspeed.om.common.SecurityConstraints;
import org.apache.jetspeed.om.folder.Folder;
import org.apache.jetspeed.om.folder.FolderNotFoundException;
+import org.apache.jetspeed.om.folder.MenuDefinition;
+import org.apache.jetspeed.om.folder.MenuExcludeDefinition;
+import org.apache.jetspeed.om.folder.MenuIncludeDefinition;
+import org.apache.jetspeed.om.folder.MenuOptionsDefinition;
+import org.apache.jetspeed.om.folder.MenuSeparatorDefinition;
import org.apache.jetspeed.om.folder.Reset;
import org.apache.jetspeed.om.page.Link;
import org.apache.jetspeed.om.page.Page;
@@ -735,6 +740,56 @@
public List getMenuDefinitions()
{
return metadata.getMenuDefinitions();
+ }
+
+ /**
+ * newMenuDefinition - creates a new empty menu definition
+ *
+ * @return a newly created MenuDefinition object for use in Folder
+ */
+ public MenuDefinition newMenuDefinition()
+ {
+ return new MenuDefinitionImpl();
+ }
+
+ /**
+ * newMenuExcludeDefinition - creates a new empty menu exclude definition
+ *
+ * @return a newly created MenuExcludeDefinition object for use in Folder
+ */
+ public MenuExcludeDefinition newMenuExcludeDefinition()
+ {
+ return new MenuExcludeDefinitionImpl();
+ }
+
+ /**
+ * newMenuIncludeDefinition - creates a new empty menu include definition
+ *
+ * @return a newly created MenuIncludeDefinition object for use in Folder
+ */
+ public MenuIncludeDefinition newMenuIncludeDefinition()
+ {
+ return new MenuIncludeDefinitionImpl();
+ }
+
+ /**
+ * newMenuOptionsDefinition - creates a new empty menu options definition
+ *
+ * @return a newly created MenuOptionsDefinition object for use in Folder
+ */
+ public MenuOptionsDefinition newMenuOptionsDefinition()
+ {
+ return new MenuOptionsDefinitionImpl();
+ }
+
+ /**
+ * newMenuSeparatorDefinition - creates a new empty menu separator definition
+ *
+ * @return a newly created MenuSeparatorDefinition object for use in Folder
+ */
+ public MenuSeparatorDefinition newMenuSeparatorDefinition()
+ {
+ return new MenuSeparatorDefinitionImpl();
}
/**
Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java?rev=351770&r1=351769&r2=351770&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java Fri Dec 2 08:52:05 2005
@@ -391,14 +391,6 @@
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#setSecurityConstraints(org.apache.jetspeed.om.common.SecurityConstraints)
- */
- public void setSecurityConstraints(SecurityConstraints constraints)
- {
- fragment.setSecurityConstraints(constraints);
- }
-
- /* (non-Javadoc)
* @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraints()
*/
public SecurityConstraints newSecurityConstraints()
@@ -416,6 +408,14 @@
return fragment.newSecurityConstraint();
}
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.common.SecuredResource#setSecurityConstraints(org.apache.jetspeed.om.common.SecurityConstraints)
+ */
+ public void setSecurityConstraints(SecurityConstraints constraints)
+ {
+ fragment.setSecurityConstraints(constraints);
+ }
+
/**
* Checks the ContentFragment cache for a ContentFragment
* that matches the <code>Id</code> of this fragment. If
Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentPageImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentPageImpl.java?rev=351770&r1=351769&r2=351770&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentPageImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentPageImpl.java Fri Dec 2 08:52:05 2005
@@ -9,6 +9,11 @@
import org.apache.jetspeed.om.common.GenericMetadata;
import org.apache.jetspeed.om.common.SecurityConstraint;
import org.apache.jetspeed.om.common.SecurityConstraints;
+import org.apache.jetspeed.om.folder.MenuDefinition;
+import org.apache.jetspeed.om.folder.MenuExcludeDefinition;
+import org.apache.jetspeed.om.folder.MenuIncludeDefinition;
+import org.apache.jetspeed.om.folder.MenuOptionsDefinition;
+import org.apache.jetspeed.om.folder.MenuSeparatorDefinition;
import org.apache.jetspeed.page.document.Node;
public class ContentPageImpl implements ContentPage
@@ -178,6 +183,46 @@
}
/* (non-Javadoc)
+ * @see org.apache.jetspeed.om.page.Page#newMenuDefinition()
+ */
+ public MenuDefinition newMenuDefinition()
+ {
+ return page.newMenuDefinition();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.page.Page#newMenuExcludeDefinition()
+ */
+ public MenuExcludeDefinition newMenuExcludeDefinition()
+ {
+ return page.newMenuExcludeDefinition();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.page.Page#newMenuIncludeDefinition()
+ */
+ public MenuIncludeDefinition newMenuIncludeDefinition()
+ {
+ return page.newMenuIncludeDefinition();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.page.Page#newMenuOptionsDefinition()
+ */
+ public MenuOptionsDefinition newMenuOptionsDefinition()
+ {
+ return page.newMenuOptionsDefinition();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.page.Page#newMenuSeparatorDefinition()
+ */
+ public MenuSeparatorDefinition newMenuSeparatorDefinition()
+ {
+ return page.newMenuSeparatorDefinition();
+ }
+
+ /* (non-Javadoc)
* @see org.apache.jetspeed.om.page.Page#setMenuDefinitions(java.util.List)
*/
public void setMenuDefinitions(List definitions)
@@ -348,15 +393,6 @@
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#setSecurityConstraints(org.apache.jetspeed.om.common.SecurityConstraints)
- */
- public void setSecurityConstraints(SecurityConstraints constraints)
- {
-
- page.setSecurityConstraints(constraints);
- }
-
- /* (non-Javadoc)
* @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraints()
*/
public SecurityConstraints newSecurityConstraints()
@@ -372,6 +408,15 @@
{
return page.newSecurityConstraint();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.common.SecuredResource#setSecurityConstraints(org.apache.jetspeed.om.common.SecurityConstraints)
+ */
+ public void setSecurityConstraints(SecurityConstraints constraints)
+ {
+
+ page.setSecurityConstraints(constraints);
}
/* (non-Javadoc)
Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/BaseElementImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/BaseElementImpl.java?rev=351770&r1=351769&r2=351770&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/BaseElementImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/BaseElementImpl.java Fri Dec 2 08:52:05 2005
@@ -242,21 +242,6 @@
}
/* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#setSecurityConstraints(org.apache.jetspeed.om.common.SecurityConstraints)
- */
- public void setSecurityConstraints(SecurityConstraints constraints)
- {
- // copy constraints to maintain persistent
- // collection members
- if (this.constraints != null)
- {
- this.constraints.setOwner(constraints.getOwner());
- this.constraints.setSecurityConstraints(constraints.getSecurityConstraints());
- this.constraints.setSecurityConstraintsRefs(constraints.getSecurityConstraintsRefs());
- }
- }
-
- /* (non-Javadoc)
* @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraints()
*/
public SecurityConstraints newSecurityConstraints()
@@ -281,15 +266,31 @@
}
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: " + constraints.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: " + constraints.getSecurityConstraintClass().getName() + ", (" + iae + ").");
}
}
// return universal security constraint instance
return new SecurityConstraintImpl();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.common.SecuredResource#setSecurityConstraints(org.apache.jetspeed.om.common.SecurityConstraints)
+ */
+ public void setSecurityConstraints(SecurityConstraints constraints)
+ {
+ // copy constraints to maintain persistent
+ // collection members
+ if (this.constraints != null)
+ {
+ // TODO: move this logic to copy methods on implementations
+ this.constraints.setOwner(constraints.getOwner());
+ this.constraints.setSecurityConstraints(constraints.getSecurityConstraints());
+ this.constraints.setSecurityConstraintsRefs(constraints.getSecurityConstraintsRefs());
+ }
}
/* (non-Javadoc)
Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageImpl.java?rev=351770&r1=351769&r2=351770&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageImpl.java Fri Dec 2 08:52:05 2005
@@ -20,6 +20,11 @@
import java.util.List;
import org.apache.jetspeed.om.common.SecuredResource;
+import org.apache.jetspeed.om.folder.MenuDefinition;
+import org.apache.jetspeed.om.folder.MenuExcludeDefinition;
+import org.apache.jetspeed.om.folder.MenuIncludeDefinition;
+import org.apache.jetspeed.om.folder.MenuOptionsDefinition;
+import org.apache.jetspeed.om.folder.MenuSeparatorDefinition;
import org.apache.jetspeed.om.page.Fragment;
import org.apache.jetspeed.om.page.Page;
import org.apache.jetspeed.om.page.PageMetadataImpl;
@@ -37,12 +42,32 @@
private String skin;
private String defaultLayoutDecorator;
private String defaultPortletDecorator;
+ private List menus;
+
+ private PageMenuDefinitionList menuDefinitions;
public PageImpl()
{
super(new PageSecurityConstraintsImpl());
}
+ /**
+ * accessMenus
+ *
+ * Access mutable persistent collection member for List wrappers.
+ *
+ * @return persistent collection
+ */
+ List accessMenus()
+ {
+ // create initial collection if necessary
+ if (menus == null)
+ {
+ menus = new ArrayList(2);
+ }
+ return menus;
+ }
+
/* (non-Javadoc)
* @see org.apache.jetspeed.om.page.impl.BaseElementImpl#resetCachedSecurityConstraints()
*/
@@ -215,15 +240,74 @@
*/
public List getMenuDefinitions()
{
- return null; // NYI
+ // return mutable menu definition list
+ // by using list wrapper to manage
+ // element uniqueness
+ if (menuDefinitions == null)
+ {
+ menuDefinitions = new PageMenuDefinitionList(this);
+ }
+ return menuDefinitions;
}
/* (non-Javadoc)
+ * @see org.apache.jetspeed.om.page.Page#newMenuDefinition()
+ */
+ public MenuDefinition newMenuDefinition()
+ {
+ return new PageMenuDefinitionImpl();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.page.Page#newMenuExcludeDefinition()
+ */
+ public MenuExcludeDefinition newMenuExcludeDefinition()
+ {
+ return new PageMenuExcludeDefinitionImpl();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.page.Page#newMenuIncludeDefinition()
+ */
+ public MenuIncludeDefinition newMenuIncludeDefinition()
+ {
+ return new PageMenuIncludeDefinitionImpl();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.page.Page#newMenuOptionsDefinition()
+ */
+ public MenuOptionsDefinition newMenuOptionsDefinition()
+ {
+ return new PageMenuOptionsDefinitionImpl();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.page.Page#newMenuSeparatorDefinition()
+ */
+ public MenuSeparatorDefinition newMenuSeparatorDefinition()
+ {
+ return new PageMenuSeparatorDefinitionImpl();
+ }
+
+ /* (non-Javadoc)
* @see org.apache.jetspeed.om.page.Page#setMenuDefinitions(java.util.List)
*/
public void setMenuDefinitions(List definitions)
{
- // NYI
+ // set menu definitions by replacing
+ // existing entries with new elements if
+ // new collection is specified
+ List menuDefinitions = getMenuDefinitions();
+ if (definitions != menuDefinitions)
+ {
+ // replace all menu definitions
+ menuDefinitions.clear();
+ if (definitions != null)
+ {
+ menuDefinitions.addAll(definitions);
+ }
+ }
}
/* (non-Javadoc)
Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuDefinitionElement.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuDefinitionElement.java?rev=351770&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuDefinitionElement.java (added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuDefinitionElement.java Fri Dec 2 08:52:05 2005
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.om.page.impl;
+
+/**
+ * PageMenuDefinitionElement
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id:$
+ */
+public interface PageMenuDefinitionElement
+{
+ // new interface defined only to facilitate OJB table/class mapping
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.folder.impl.BaseMenuDefinitionElement#getElementOrder()
+ */
+ int getElementOrder();
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.folder.impl.BaseMenuDefinitionElement#setElementOrder(int)
+ */
+ void setElementOrder(int order);
+}
Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuDefinitionElement.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuDefinitionElementList.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuDefinitionElementList.java?rev=351770&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuDefinitionElementList.java (added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuDefinitionElementList.java Fri Dec 2 08:52:05 2005
@@ -0,0 +1,215 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.om.page.impl;
+
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.jetspeed.om.folder.MenuDefinition;
+import org.apache.jetspeed.om.folder.MenuExcludeDefinition;
+import org.apache.jetspeed.om.folder.MenuIncludeDefinition;
+import org.apache.jetspeed.om.folder.MenuOptionsDefinition;
+import org.apache.jetspeed.om.folder.MenuSeparatorDefinition;
+
+/**
+ * PageMenuDefinitionElementList
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+class PageMenuDefinitionElementList extends AbstractList
+{
+ private PageMenuDefinitionImpl menuDefinition;
+
+ PageMenuDefinitionElementList(PageMenuDefinitionImpl menuDefinition)
+ {
+ super();
+ this.menuDefinition = menuDefinition;
+ }
+
+ /**
+ * validateMenuElementForAdd
+ *
+ * Validates element to be added to this list.
+ *
+ * @param menuElement element to add
+ * @return list element to add
+ */
+ private PageMenuDefinitionElement validateMenuElementForAdd(Object menuElement)
+ {
+ // validate element instance class
+ if (menuElement == null)
+ {
+ throw new NullPointerException("Unable to add null to list.");
+ }
+ if (!(menuElement instanceof PageMenuDefinitionElement))
+ {
+ // duplicate menu element from equivalent types
+ if (menuElement instanceof MenuDefinition)
+ {
+ MenuDefinition origMenuElement = (MenuDefinition)menuElement;
+ PageMenuDefinitionImpl dupMenuElement = new PageMenuDefinitionImpl();
+ // TODO: move this logic to copy methods on implementations
+ dupMenuElement.setName(origMenuElement.getName());
+ dupMenuElement.setOptions(origMenuElement.getOptions());
+ dupMenuElement.setDepth(origMenuElement.getDepth());
+ dupMenuElement.setPaths(origMenuElement.isPaths());
+ dupMenuElement.setRegexp(origMenuElement.isRegexp());
+ dupMenuElement.setProfile(origMenuElement.getProfile());
+ dupMenuElement.setOrder(origMenuElement.getOrder());
+ dupMenuElement.setSkin(origMenuElement.getSkin());
+ dupMenuElement.setTitle(origMenuElement.getTitle());
+ dupMenuElement.setShortTitle(origMenuElement.getShortTitle());
+ dupMenuElement.setMenuElements(origMenuElement.getMenuElements());
+ dupMenuElement.getMetadata().copyFields(origMenuElement.getMetadata().getFields());
+ menuElement = dupMenuElement;
+ }
+ else if (menuElement instanceof MenuExcludeDefinition)
+ {
+ MenuExcludeDefinition origMenuElement = (MenuExcludeDefinition)menuElement;
+ PageMenuExcludeDefinitionImpl dupMenuElement = new PageMenuExcludeDefinitionImpl();
+ // TODO: move this logic to copy methods on implementations
+ dupMenuElement.setName(origMenuElement.getName());
+ menuElement = dupMenuElement;
+ }
+ else if (menuElement instanceof MenuIncludeDefinition)
+ {
+ MenuIncludeDefinition origMenuElement = (MenuIncludeDefinition)menuElement;
+ PageMenuIncludeDefinitionImpl dupMenuElement = new PageMenuIncludeDefinitionImpl();
+ // TODO: move this logic to copy methods on implementations
+ dupMenuElement.setName(origMenuElement.getName());
+ dupMenuElement.setNest(origMenuElement.isNest());
+ menuElement = dupMenuElement;
+ }
+ else if (menuElement instanceof MenuOptionsDefinition)
+ {
+ MenuOptionsDefinition origMenuElement = (MenuOptionsDefinition)menuElement;
+ PageMenuOptionsDefinitionImpl dupMenuElement = new PageMenuOptionsDefinitionImpl();
+ // TODO: move this logic to copy methods on implementations
+ dupMenuElement.setOptions(origMenuElement.getOptions());
+ dupMenuElement.setDepth(origMenuElement.getDepth());
+ dupMenuElement.setPaths(origMenuElement.isPaths());
+ dupMenuElement.setRegexp(origMenuElement.isRegexp());
+ dupMenuElement.setProfile(origMenuElement.getProfile());
+ dupMenuElement.setOrder(origMenuElement.getOrder());
+ dupMenuElement.setSkin(origMenuElement.getSkin());
+ menuElement = dupMenuElement;
+ }
+ else if (menuElement instanceof MenuSeparatorDefinition)
+ {
+ MenuSeparatorDefinition origMenuElement = (MenuSeparatorDefinition)menuElement;
+ PageMenuSeparatorDefinitionImpl dupMenuElement = new PageMenuSeparatorDefinitionImpl();
+ // TODO: move this logic to copy methods on implementations
+ dupMenuElement.setSkin(origMenuElement.getSkin());
+ dupMenuElement.setTitle(origMenuElement.getTitle());
+ dupMenuElement.setText(origMenuElement.getText());
+ dupMenuElement.getMetadata().copyFields(origMenuElement.getMetadata().getFields());
+ menuElement = dupMenuElement;
+ }
+ else
+ {
+ throw new ClassCastException("Unable to create menu element list instance from: " + menuElement.getClass().getName() + ".");
+ }
+ }
+ return (PageMenuDefinitionElement)menuElement;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.List#add(int,java.lang.Object)
+ */
+ public void add(int index, Object element)
+ {
+ // implement for modifiable AbstractList:
+ // validate index
+ if ((index < 0) || (index > menuDefinition.accessElements().size()))
+ {
+ throw new IndexOutOfBoundsException("Unable to add to list at index: " + index);
+ }
+ // verify element
+ PageMenuDefinitionElement menuElement = validateMenuElementForAdd(element);
+ // add to underlying ordered list
+ menuDefinition.accessElements().add(index, menuElement);
+ // set element order in added element
+ if (index > 0)
+ {
+ menuElement.setElementOrder(((PageMenuDefinitionElement)menuDefinition.accessElements().get(index-1)).getElementOrder() + 1);
+ }
+ else
+ {
+ menuElement.setElementOrder(0);
+ }
+ // maintain element order in subsequent elements
+ for (int i = index, limit = menuDefinition.accessElements().size() - 1; (i < limit); i++)
+ {
+ PageMenuDefinitionElement nextMenuElement = (PageMenuDefinitionElement)menuDefinition.accessElements().get(i + 1);
+ if (nextMenuElement.getElementOrder() <= menuElement.getElementOrder())
+ {
+ // adjust element order for next element
+ nextMenuElement.setElementOrder(menuElement.getElementOrder() + 1);
+ menuElement = nextMenuElement;
+ }
+ else
+ {
+ // element order maintained for remaining list elements
+ break;
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.List#get(int)
+ */
+ public Object get(int index)
+ {
+ // implement for modifiable AbstractList
+ return menuDefinition.accessElements().get(index);
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.List#remove(int)
+ */
+ public Object remove(int index)
+ {
+ // implement for modifiable AbstractList
+ return menuDefinition.accessElements().remove(index);
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.List#set(int,java.lang.Object)
+ */
+ public Object set(int index, Object element)
+ {
+ // implement for modifiable AbstractList:
+ // verify element
+ PageMenuDefinitionElement newMenuElement = validateMenuElementForAdd(element);
+ // set in underlying ordered list
+ PageMenuDefinitionElement menuElement = (PageMenuDefinitionElement)menuDefinition.accessElements().set(index, newMenuElement);
+ // set element order in new element
+ newMenuElement.setElementOrder(menuElement.getElementOrder());
+ // return element
+ return menuElement;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.List#size()
+ */
+ public int size()
+ {
+ // implement for modifiable AbstractList
+ return menuDefinition.accessElements().size();
+ }
+}
Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuDefinitionElementList.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuDefinitionImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuDefinitionImpl.java?rev=351770&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuDefinitionImpl.java (added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuDefinitionImpl.java Fri Dec 2 08:52:05 2005
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.om.page.impl;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.jetspeed.om.folder.MenuDefinition;
+import org.apache.jetspeed.om.folder.impl.BaseMenuDefinitionImpl;
+import org.apache.jetspeed.om.page.PageMetadataImpl;
+
+/**
+ * PageMenuDefinitionImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id:$
+ */
+public class PageMenuDefinitionImpl extends BaseMenuDefinitionImpl implements MenuDefinition, PageMenuDefinitionElement
+{
+ // new class defined only to facilitate OJB table/class mapping
+
+ private PageMenuDefinitionElementList menuElements;
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.folder.impl.BaseMenuDefinitionMetadata#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.MenuDefinition#getMenuElements()
+ */
+ public List getMenuElements()
+ {
+ // return mutable menu element list
+ // by using list wrapper to manage
+ // element order
+ if (menuElements == null)
+ {
+ menuElements = new PageMenuDefinitionElementList(this);
+ }
+ return menuElements;
+ }
+}
Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuDefinitionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuDefinitionList.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuDefinitionList.java?rev=351770&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuDefinitionList.java (added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuDefinitionList.java Fri Dec 2 08:52:05 2005
@@ -0,0 +1,207 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.om.page.impl;
+
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.jetspeed.om.folder.MenuDefinition;
+
+/**
+ * PageMenuDefinitionList
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+class PageMenuDefinitionList extends AbstractList
+{
+ private PageImpl page;
+
+ private List removedMenuDefinitions;
+
+ PageMenuDefinitionList(PageImpl page)
+ {
+ super();
+ this.page = page;
+ }
+
+ /**
+ * validateDefinitionForAdd
+ *
+ * Validates menu definition to be added to this list.
+ *
+ * @param definition menu definition to add
+ * @return list element to add
+ */
+ private PageMenuDefinitionImpl validateDefinitionForAdd(Object definition)
+ {
+ // only non-null definitions supported
+ if (definition == null)
+ {
+ throw new NullPointerException("Unable to add null to list.");
+ }
+ if (!(definition instanceof PageMenuDefinitionImpl))
+ {
+ // duplicate menu element from equivalent types
+ if (definition instanceof MenuDefinition)
+ {
+ MenuDefinition origDefinition = (MenuDefinition)definition;
+ PageMenuDefinitionImpl dupDefinition = new PageMenuDefinitionImpl();
+ // TODO: move this logic to copy methods on implementations
+ dupDefinition.setName(origDefinition.getName());
+ dupDefinition.setOptions(origDefinition.getOptions());
+ dupDefinition.setDepth(origDefinition.getDepth());
+ dupDefinition.setPaths(origDefinition.isPaths());
+ dupDefinition.setRegexp(origDefinition.isRegexp());
+ dupDefinition.setProfile(origDefinition.getProfile());
+ dupDefinition.setOrder(origDefinition.getOrder());
+ dupDefinition.setSkin(origDefinition.getSkin());
+ dupDefinition.setTitle(origDefinition.getTitle());
+ dupDefinition.setShortTitle(origDefinition.getShortTitle());
+ dupDefinition.setMenuElements(origDefinition.getMenuElements());
+ dupDefinition.getMetadata().copyFields(origDefinition.getMetadata().getFields());
+ definition = dupDefinition;
+ }
+ else
+ {
+ throw new ClassCastException("Unable to create menu element list instance from: " + definition.getClass().getName() + ".");
+ }
+ }
+ // make sure element is unique
+ if (page.accessMenus().contains(definition))
+ {
+ throw new IllegalArgumentException("Unable to add duplicate entry to list: " + ((PageMenuDefinitionImpl)definition).getName());
+ }
+ // retrieve from removed list to reuse
+ // previously removed element copying
+ // menu definition data
+ if (removedMenuDefinitions != null)
+ {
+ int removedIndex = removedMenuDefinitions.indexOf(definition);
+ if (removedIndex >= 0)
+ {
+ // reuse menu definition with matching name
+ PageMenuDefinitionImpl addDefinition = (PageMenuDefinitionImpl)definition;
+ PageMenuDefinitionImpl removedDefinition = (PageMenuDefinitionImpl)removedMenuDefinitions.remove(removedIndex);
+ // TODO: move this logic to copy methods on implementations
+ // copy menu definition members
+ removedDefinition.setOptions(addDefinition.getOptions());
+ removedDefinition.setDepth(addDefinition.getDepth());
+ removedDefinition.setPaths(addDefinition.isPaths());
+ removedDefinition.setRegexp(addDefinition.isRegexp());
+ removedDefinition.setProfile(addDefinition.getProfile());
+ removedDefinition.setOrder(addDefinition.getOrder());
+ removedDefinition.setSkin(addDefinition.getSkin());
+ removedDefinition.setTitle(addDefinition.getTitle());
+ removedDefinition.setShortTitle(addDefinition.getShortTitle());
+ removedDefinition.setMenuElements(addDefinition.getMenuElements());
+ // copy menu definition metadata members
+ // TODO: strengthen... this code is not robust
+ // and may fail if multiple edits without a db
+ // update occur and duplicate metadata members
+ // are removed in one operation and reinserted
+ // in a subsequent operation because the
+ // metadata members are required to be unique
+ // and a removal list is not maintained for the
+ // metadata fields collections yet
+ removedDefinition.getMetadata().copyFields(addDefinition.getMetadata().getFields());
+ definition = removedDefinition;
+ }
+ }
+ return (PageMenuDefinitionImpl)definition;
+ }
+
+ /**
+ * getRemovedMenuDefinitions
+ *
+ * @return removed menu definitions tracking collection
+ */
+ private List getRemovedMenuDefinitions()
+ {
+ if (removedMenuDefinitions == null)
+ {
+ removedMenuDefinitions = new ArrayList(page.accessMenus().size());
+ }
+ return removedMenuDefinitions;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.List#add(int,java.lang.Object)
+ */
+ public void add(int index, Object element)
+ {
+ // implement for modifiable AbstractList:
+ // validate index
+ if ((index < 0) || (index > page.accessMenus().size()))
+ {
+ throw new IndexOutOfBoundsException("Unable to add to list at index: " + index);
+ }
+ // verify menu definition
+ PageMenuDefinitionImpl definition = validateDefinitionForAdd(element);
+ // add to underlying ordered list
+ page.accessMenus().add(index, definition);
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.List#get(int)
+ */
+ public Object get(int index)
+ {
+ // implement for modifiable AbstractList
+ return page.accessMenus().get(index);
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.List#remove(int)
+ */
+ public Object remove(int index)
+ {
+ // implement for modifiable AbstractList:
+ // save removed element
+ PageMenuDefinitionImpl removed = (PageMenuDefinitionImpl)page.accessMenus().remove(index);
+ if (removed != null)
+ {
+ getRemovedMenuDefinitions().add(removed);
+ }
+ return removed;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.List#set(int,java.lang.Object)
+ */
+ public Object set(int index, Object element)
+ {
+ // implement for modifiable AbstractList:
+ // verify menu definition
+ PageMenuDefinitionImpl newDefinition = validateDefinitionForAdd(element);
+ // set in underlying ordered list
+ PageMenuDefinitionImpl definition = (PageMenuDefinitionImpl)page.accessMenus().set(index, newDefinition);
+ // save replaced element
+ getRemovedMenuDefinitions().add(definition);
+ // return menu definition
+ return definition;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.List#size()
+ */
+ public int size()
+ {
+ // implement for modifiable AbstractList
+ return page.accessMenus().size();
+ }
+}
Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuDefinitionList.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuExcludeDefinitionImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuExcludeDefinitionImpl.java?rev=351770&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuExcludeDefinitionImpl.java (added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuExcludeDefinitionImpl.java Fri Dec 2 08:52:05 2005
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.om.page.impl;
+
+import org.apache.jetspeed.om.folder.MenuExcludeDefinition;
+import org.apache.jetspeed.om.folder.impl.BaseMenuExcludeDefinitionImpl;
+
+/**
+ * PageMenuExcludeDefinitionImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id:$
+ */
+public class PageMenuExcludeDefinitionImpl extends BaseMenuExcludeDefinitionImpl implements MenuExcludeDefinition, PageMenuDefinitionElement
+{
+ // new class defined only to facilitate OJB table/class mapping
+}
Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuExcludeDefinitionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuIncludeDefinitionImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuIncludeDefinitionImpl.java?rev=351770&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuIncludeDefinitionImpl.java (added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuIncludeDefinitionImpl.java Fri Dec 2 08:52:05 2005
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.om.page.impl;
+
+import org.apache.jetspeed.om.folder.MenuIncludeDefinition;
+import org.apache.jetspeed.om.folder.impl.BaseMenuIncludeDefinitionImpl;
+
+/**
+ * PageMenuIncludeDefinitionImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id:$
+ */
+public class PageMenuIncludeDefinitionImpl extends BaseMenuIncludeDefinitionImpl implements MenuIncludeDefinition, PageMenuDefinitionElement
+{
+ // new class defined only to facilitate OJB table/class mapping
+}
Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuIncludeDefinitionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuMetadataLocalizedFieldImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuMetadataLocalizedFieldImpl.java?rev=351770&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuMetadataLocalizedFieldImpl.java (added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuMetadataLocalizedFieldImpl.java Fri Dec 2 08:52:05 2005
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.om.page.impl;
+
+import org.apache.jetspeed.om.page.PageLocalizedFieldImpl;
+
+/**
+ * PageMenuMetadataLocalizedFieldImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+public class PageMenuMetadataLocalizedFieldImpl extends PageLocalizedFieldImpl
+{
+ // new class defined only to facilitate OJB table/class mapping
+}
Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuMetadataLocalizedFieldImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuOptionsDefinitionImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuOptionsDefinitionImpl.java?rev=351770&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuOptionsDefinitionImpl.java (added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuOptionsDefinitionImpl.java Fri Dec 2 08:52:05 2005
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.om.page.impl;
+
+import org.apache.jetspeed.om.folder.MenuOptionsDefinition;
+import org.apache.jetspeed.om.folder.impl.BaseMenuOptionsDefinitionImpl;
+
+/**
+ * PageMenuOptionsDefinitionImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id:$
+ */
+public class PageMenuOptionsDefinitionImpl extends BaseMenuOptionsDefinitionImpl implements MenuOptionsDefinition, PageMenuDefinitionElement
+{
+ // new class defined only to facilitate OJB table/class mapping
+}
Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuOptionsDefinitionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuSeparatorDefinitionImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuSeparatorDefinitionImpl.java?rev=351770&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuSeparatorDefinitionImpl.java (added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuSeparatorDefinitionImpl.java Fri Dec 2 08:52:05 2005
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.om.page.impl;
+
+import java.util.Collection;
+
+import org.apache.jetspeed.om.folder.MenuSeparatorDefinition;
+import org.apache.jetspeed.om.folder.impl.BaseMenuSeparatorDefinitionImpl;
+import org.apache.jetspeed.om.page.PageMetadataImpl;
+
+/**
+ * PageMenuSeparatorDefinitionImpl
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id:$
+ */
+public class PageMenuSeparatorDefinitionImpl extends BaseMenuSeparatorDefinitionImpl implements MenuSeparatorDefinition, PageMenuDefinitionElement
+{
+ // new class defined only to facilitate OJB table/class mapping
+
+ /* (non-Javadoc)
+ * @see org.apache.jetspeed.om.folder.impl.BaseMenuDefinitionMetadata#newPageMetadata()
+ */
+ public PageMetadataImpl newPageMetadata(Collection fields)
+ {
+ PageMetadataImpl pageMetadata = new PageMetadataImpl(PageMenuMetadataLocalizedFieldImpl.class);
+ pageMetadata.setFields(fields);
+ return pageMetadata;
+ }
+}
Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageMenuSeparatorDefinitionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageSecurityImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageSecurityImpl.java?rev=351770&r1=351769&r2=351770&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageSecurityImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageSecurityImpl.java Fri Dec 2 08:52:05 2005
@@ -117,6 +117,15 @@
}
/* (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)
@@ -136,15 +145,6 @@
}
// clear cached security constraints definition map
clearSecurityConstraintsDefsMap();
- }
-
- /* (non-Javadoc)
- * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraintsDef()
- */
- public SecurityConstraintsDef newSecurityConstraintsDef()
- {
- // return specific security constraints definition instance
- return new SecurityConstraintsDefImpl();
}
/* (non-Javadoc)
Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintDefList.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintDefList.java?rev=351770&r1=351769&r2=351770&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintDefList.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintDefList.java Fri Dec 2 08:52:05 2005
@@ -57,6 +57,7 @@
// duplicate constraint from equivalent types
SecurityConstraintImpl origConstraint = (SecurityConstraintImpl)constraint;
PageSecuritySecurityConstraintImpl dupConstraint = new PageSecuritySecurityConstraintImpl();
+ // TODO: move this logic to copy methods on implementations
dupConstraint.setUsers(origConstraint.getUsers());
dupConstraint.setRoles(origConstraint.getRoles());
dupConstraint.setGroups(origConstraint.getGroups());
Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintList.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintList.java?rev=351770&r1=351769&r2=351770&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintList.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintList.java Fri Dec 2 08:52:05 2005
@@ -60,6 +60,7 @@
{
SecurityConstraintImpl origConstraint = (SecurityConstraintImpl)constraint;
SecurityConstraintImpl dupConstraint = (SecurityConstraintImpl)constraints.getSecurityConstraintClass().newInstance();
+ // TODO: move this logic to copy methods on implementations
dupConstraint.setUsers(origConstraint.getUsers());
dupConstraint.setRoles(origConstraint.getRoles());
dupConstraint.setGroups(origConstraint.getGroups());
@@ -68,11 +69,11 @@
}
catch (InstantiationException ie)
{
- throw new ClassCastException("Unable to create constraint list element instance: " + constraints.getSecurityConstraintClass().getName() + ", " + ie + ").");
+ throw new ClassCastException("Unable to create constraint list element instance: " + constraints.getSecurityConstraintClass().getName() + ", (" + ie + ").");
}
catch (IllegalAccessException iae)
{
- throw new ClassCastException("Unable to create constraint list element instance: " + constraints.getSecurityConstraintClass().getName() + ", " + iae + ").");
+ throw new ClassCastException("Unable to create constraint list element instance: " + constraints.getSecurityConstraintClass().getName() + ", (" + iae + ").");
}
}
return constraint;
Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsRefList.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsRefList.java?rev=351770&r1=351769&r2=351770&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsRefList.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsRefList.java Fri Dec 2 08:52:05 2005
@@ -68,7 +68,7 @@
}
catch (IllegalAccessException iae)
{
- throw new ClassCastException("Unable to create constraints reference list element instance: " + constraints.getSecurityConstraintsRefClass().getName() + ", " + iae + ").");
+ throw new ClassCastException("Unable to create constraints reference list element instance: " + constraints.getSecurityConstraintsRefClass().getName() + ", (" + iae + ").");
}
}
else
Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/AbstractBaseElement.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/AbstractBaseElement.java?rev=351770&r1=351769&r2=351770&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/AbstractBaseElement.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/AbstractBaseElement.java Fri Dec 2 08:52:05 2005
@@ -171,19 +171,6 @@
/**
* <p>
- * setSecurityConstraints
- * </p>
- *
- * @see org.apache.jetspeed.om.common.SecureResource#setSecurityConstraints(org.apache.jetspeed.om.common.SecurityConstraints)
- * @param constraints
- */
- public void setSecurityConstraints(SecurityConstraints constraints)
- {
- this.constraints = constraints;
- }
-
- /**
- * <p>
* newSecurityConstraints
* </p>
*
@@ -206,6 +193,19 @@
public SecurityConstraint newSecurityConstraint()
{
return new SecurityConstraintImpl();
+ }
+
+ /**
+ * <p>
+ * setSecurityConstraints
+ * </p>
+ *
+ * @see org.apache.jetspeed.om.common.SecureResource#setSecurityConstraints(org.apache.jetspeed.om.common.SecurityConstraints)
+ * @param constraints
+ */
+ public void setSecurityConstraints(SecurityConstraints constraints)
+ {
+ this.constraints = constraints;
}
/**
Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PageImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PageImpl.java?rev=351770&r1=351769&r2=351770&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PageImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/PageImpl.java Fri Dec 2 08:52:05 2005
@@ -22,6 +22,16 @@
import java.util.Stack;
import org.apache.jetspeed.om.folder.psml.MenuDefinitionImpl;
+import org.apache.jetspeed.om.folder.MenuDefinition;
+import org.apache.jetspeed.om.folder.MenuExcludeDefinition;
+import org.apache.jetspeed.om.folder.MenuIncludeDefinition;
+import org.apache.jetspeed.om.folder.MenuOptionsDefinition;
+import org.apache.jetspeed.om.folder.MenuSeparatorDefinition;
+import org.apache.jetspeed.om.folder.psml.MenuDefinitionImpl;
+import org.apache.jetspeed.om.folder.psml.MenuExcludeDefinitionImpl;
+import org.apache.jetspeed.om.folder.psml.MenuIncludeDefinitionImpl;
+import org.apache.jetspeed.om.folder.psml.MenuOptionsDefinitionImpl;
+import org.apache.jetspeed.om.folder.psml.MenuSeparatorDefinitionImpl;
import org.apache.jetspeed.om.page.Fragment;
import org.apache.jetspeed.om.page.Page;
@@ -244,6 +254,56 @@
public List getMenuDefinitions()
{
return menuDefinitions;
+ }
+
+ /**
+ * newMenuDefinition - creates a new empty menu definition
+ *
+ * @return a newly created MenuDefinition object for use in Page
+ */
+ public MenuDefinition newMenuDefinition()
+ {
+ return new MenuDefinitionImpl();
+ }
+
+ /**
+ * newMenuExcludeDefinition - creates a new empty menu exclude definition
+ *
+ * @return a newly created MenuExcludeDefinition object for use in Page
+ */
+ public MenuExcludeDefinition newMenuExcludeDefinition()
+ {
+ return new MenuExcludeDefinitionImpl();
+ }
+
+ /**
+ * newMenuIncludeDefinition - creates a new empty menu include definition
+ *
+ * @return a newly created MenuIncludeDefinition object for use in Page
+ */
+ public MenuIncludeDefinition newMenuIncludeDefinition()
+ {
+ return new MenuIncludeDefinitionImpl();
+ }
+
+ /**
+ * newMenuOptionsDefinition - creates a new empty menu options definition
+ *
+ * @return a newly created MenuOptionsDefinition object for use in Page
+ */
+ public MenuOptionsDefinition newMenuOptionsDefinition()
+ {
+ return new MenuOptionsDefinitionImpl();
+ }
+
+ /**
+ * newMenuSeparatorDefinition - creates a new empty menu separator definition
+ *
+ * @return a newly created MenuSeparatorDefinition object for use in Page
+ */
+ public MenuSeparatorDefinition newMenuSeparatorDefinition()
+ {
+ return new MenuSeparatorDefinitionImpl();
}
/**
Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java?rev=351770&r1=351769&r2=351770&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java Fri Dec 2 08:52:05 2005
@@ -16,7 +16,6 @@
package org.apache.jetspeed.page;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.LinkedList;
@@ -25,7 +24,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jetspeed.exception.JetspeedException;
-import org.apache.jetspeed.om.common.LocalizedField;
import org.apache.jetspeed.om.common.SecurityConstraint;
import org.apache.jetspeed.om.common.SecurityConstraints;
import org.apache.jetspeed.om.folder.Folder;
@@ -678,21 +676,11 @@
return copy;
}
-
public void copyMetadata(Page source, Page dest)
{
if (source.getMetadata() != null)
{
- Collection fields = source.getMetadata().getFields();
- if (fields != null)
- {
- Iterator fieldsIterator = fields.iterator();
- while (fieldsIterator.hasNext())
- {
- LocalizedField field = (LocalizedField)fieldsIterator.next();
- dest.getMetadata().addField(field.getLocale(), field.getName(), field.getValue());
- }
- }
+ dest.getMetadata().copyFields(source.getMetadata().getFields());
}
}
Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java?rev=351770&r1=351769&r2=351770&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java Fri Dec 2 08:52:05 2005
@@ -32,6 +32,11 @@
import org.apache.jetspeed.om.folder.MenuOptionsDefinition;
import org.apache.jetspeed.om.folder.MenuSeparatorDefinition;
import org.apache.jetspeed.om.folder.impl.FolderImpl;
+import org.apache.jetspeed.om.folder.impl.FolderMenuDefinitionImpl;
+import org.apache.jetspeed.om.folder.impl.FolderMenuExcludeDefinitionImpl;
+import org.apache.jetspeed.om.folder.impl.FolderMenuIncludeDefinitionImpl;
+import org.apache.jetspeed.om.folder.impl.FolderMenuOptionsDefinitionImpl;
+import org.apache.jetspeed.om.folder.impl.FolderMenuSeparatorDefinitionImpl;
import org.apache.jetspeed.om.page.ContentPage;
import org.apache.jetspeed.om.page.ContentPageImpl;
import org.apache.jetspeed.om.page.Fragment;
@@ -89,11 +94,11 @@
modelClasses.put("FolderImpl.class", FolderImpl.class);
//modelClasses.put("LinkImpl.class", LinkImpl.class);
modelClasses.put("PageSecurityImpl.class", PageSecurityImpl.class);
- //modelClasses.put("MenuDefinitionImpl.class", MenuDefinitionImpl.class);
- //modelClasses.put("MenuExcludeDefinitionImpl.class", MenuExcludeDefinitionImpl.class);
- //modelClasses.put("MenuIncludeDefinitionImpl.class", MenuIncludeDefinitionImpl.class);
- //modelClasses.put("MenuOptionsDefinitionImpl.class", MenuOptionsDefinitionImpl.class);
- //modelClasses.put("MenuSeparatorDefinitionImpl.class", MenuSeparatorDefinitionImpl.class);
+ modelClasses.put("MenuDefinitionImpl.class", FolderMenuDefinitionImpl.class);
+ modelClasses.put("MenuExcludeDefinitionImpl.class", FolderMenuExcludeDefinitionImpl.class);
+ modelClasses.put("MenuIncludeDefinitionImpl.class", FolderMenuIncludeDefinitionImpl.class);
+ modelClasses.put("MenuOptionsDefinitionImpl.class", FolderMenuOptionsDefinitionImpl.class);
+ modelClasses.put("MenuSeparatorDefinitionImpl.class", FolderMenuSeparatorDefinitionImpl.class);
modelClasses.put("SecurityConstraintsImpl.class", SecurityConstraintsImpl.class);
modelClasses.put("SecurityConstraintImpl.class", SecurityConstraintImpl.class);
modelClasses.put("SecurityConstraintsDefImpl.class", SecurityConstraintsDefImpl.class);
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org