Coverage report

  %line %branch
org.apache.jetspeed.om.folder.psml.FolderImpl
0% 
0% 

 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  * 
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  * 
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.apache.jetspeed.om.folder.psml;
 18  
 
 19  
 import java.security.AccessController;
 20  
 import java.util.Iterator;
 21  
 import java.util.List;
 22  
 import java.util.Locale;
 23  
 
 24  
 import org.apache.commons.logging.Log;
 25  
 import org.apache.commons.logging.LogFactory;
 26  
 import org.apache.jetspeed.JetspeedActions;
 27  
 import org.apache.jetspeed.om.common.GenericMetadata;
 28  
 import org.apache.jetspeed.om.common.SecurityConstraints;
 29  
 import org.apache.jetspeed.om.folder.Folder;
 30  
 import org.apache.jetspeed.om.folder.FolderNotFoundException;
 31  
 import org.apache.jetspeed.om.folder.MenuDefinition;
 32  
 import org.apache.jetspeed.om.folder.MenuExcludeDefinition;
 33  
 import org.apache.jetspeed.om.folder.MenuIncludeDefinition;
 34  
 import org.apache.jetspeed.om.folder.MenuOptionsDefinition;
 35  
 import org.apache.jetspeed.om.folder.MenuSeparatorDefinition;
 36  
 import org.apache.jetspeed.om.folder.Reset;
 37  
 import org.apache.jetspeed.om.page.Link;
 38  
 import org.apache.jetspeed.om.page.Page;
 39  
 import org.apache.jetspeed.om.page.PageSecurity;
 40  
 import org.apache.jetspeed.page.PageManagerUtils;
 41  
 import org.apache.jetspeed.page.PageNotFoundException;
 42  
 import org.apache.jetspeed.page.document.DocumentException;
 43  
 import org.apache.jetspeed.page.document.DocumentHandlerFactory;
 44  
 import org.apache.jetspeed.page.document.DocumentNotFoundException;
 45  
 import org.apache.jetspeed.page.document.FolderHandler;
 46  
 import org.apache.jetspeed.page.document.Node;
 47  
 import org.apache.jetspeed.page.document.NodeException;
 48  
 import org.apache.jetspeed.page.document.NodeNotFoundException;
 49  
 import org.apache.jetspeed.page.document.NodeSet;
 50  
 import org.apache.jetspeed.page.document.UnsupportedDocumentTypeException;
 51  
 import org.apache.jetspeed.page.document.psml.AbstractNode;
 52  
 import org.apache.jetspeed.page.document.psml.NodeOrderCompartaor;
 53  
 import org.apache.jetspeed.page.document.psml.NodeSetImpl;
 54  
 import org.apache.jetspeed.security.FolderPermission;
 55  
 
 56  
 /**
 57  
  * FolderImpl
 58  
  * 
 59  
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
 60  
  * @author <a href="mailto:jford@apache.org">Jeremy Ford </a>
 61  
  * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
 62  
  * @version $Id: FolderImpl.java 553584 2007-07-05 18:09:45Z taylor $
 63  
  */
 64  
 public class FolderImpl extends AbstractNode implements Folder, Reset
 65  
 {
 66  
     
 67  
     private NodeSet allNodes;
 68  
     private FolderMetaDataImpl metadata;
 69  
     private FolderHandler folderHandler;
 70  0
     private int reservedType = RESERVED_FOLDER_NONE;
 71  
     
 72  0
     private static final Log log = LogFactory.getLog(FolderImpl.class);
 73  
 
 74  
     public FolderImpl( String path, FolderMetaDataImpl metadata, DocumentHandlerFactory handlerFactory,
 75  
                        FolderHandler folderHandler )
 76  0
     {
 77  0
         this.metadata = metadata;
 78  0
         this.metadata.setParent(class="keyword">this);
 79  0
         this.folderHandler = folderHandler;
 80  0
         setPath(path);
 81  0
         setReservedType();
 82  0
         setHandlerFactory(handlerFactory);
 83  0
         setPermissionsEnabled(handlerFactory.getPermissionsEnabled());
 84  0
         setConstraintsEnabled(handlerFactory.getConstraintsEnabled());
 85  0
     }
 86  
 
 87  
     public FolderImpl( String path, DocumentHandlerFactory handlerFactory, FolderHandler folderHandler )
 88  0
     {
 89  0
         this.metadata = new FolderMetaDataImpl();
 90  0
         this.metadata.setParent(class="keyword">this);
 91  0
         this.folderHandler = folderHandler;
 92  0
         setPath(path);
 93  0
         setReservedType();
 94  0
         setHandlerFactory(handlerFactory);
 95  0
         setPermissionsEnabled(handlerFactory.getPermissionsEnabled());
 96  0
         setConstraintsEnabled(handlerFactory.getConstraintsEnabled());
 97  0
     }
 98  
 
 99  
     public FolderImpl()
 100  0
     {
 101  0
         this.metadata = new FolderMetaDataImpl();
 102  0
         this.metadata.setParent(class="keyword">this);
 103  0
         setReservedType();
 104  0
     }
 105  
 
 106  
     /* (non-Javadoc)
 107  
      * @see org.apache.jetspeed.om.folder.Folder#getSkin()
 108  
      */
 109  
     public String getSkin()
 110  
     {
 111  0
         return metadata.getSkin();
 112  
     }
 113  
 
 114  
     /* (non-Javadoc)
 115  
      * @see org.apache.jetspeed.om.folder.Folder#setSkin(java.lang.String)
 116  
      */
 117  
     public void setSkin( String skinName )
 118  
     {
 119  0
         metadata.setSkin(skinName);
 120  0
     }
 121  
 
 122  
     /* (non-Javadoc)
 123  
      * @see org.apache.jetspeed.om.folder.Folder#getEffectiveDefaultDecorator(java.lang.String)
 124  
      */
 125  
     public String getEffectiveDefaultDecorator(String fragmentType)
 126  
     {
 127  
         // get locally defined decorator
 128  0
         String decorator = getDefaultDecorator(fragmentType);
 129  0
         if (decorator == null)
 130  
         {
 131  
             // delegate to parent folder
 132  0
             Folder parentFolder = (Folder)getParent();
 133  0
             if (parentFolder != null)
 134  
             {
 135  0
                 return parentFolder.getEffectiveDefaultDecorator(fragmentType);
 136  
             }
 137  
         }
 138  0
         return decorator;
 139  
     }
 140  
 
 141  
     /* (non-Javadoc)
 142  
      * @see org.apache.jetspeed.om.folder.Folder#getDefaultDecorator(java.lang.String)
 143  
      */
 144  
     public String getDefaultDecorator( String fragmentType )
 145  
     {
 146  0
         return metadata.getDefaultDecorator(fragmentType);
 147  
     }
 148  
 
 149  
     /* (non-Javadoc)
 150  
      * @see org.apache.jetspeed.om.folder.Folder#setDefaultDecorator(java.lang.String, java.lang.String)
 151  
      */
 152  
     public void setDefaultDecorator( String decoratorName, String fragmentType )
 153  
     {
 154  0
         metadata.setDefaultDecorator(decoratorName, fragmentType);
 155  0
     }
 156  
 
 157  
     /* (non-Javadoc)
 158  
      * @see org.apache.jetspeed.om.folder.Folder#getDocumentOrder()
 159  
      */
 160  
     public List getDocumentOrder()
 161  
     {
 162  0
         return metadata.getDocumentOrder();
 163  
     }
 164  
     
 165  
     /* (non-Javadoc)
 166  
      * @see org.apache.jetspeed.om.folder.Folder#setDocumentOrder(java.util.List)
 167  
      */
 168  
     public void setDocumentOrder(List docIndexes)
 169  
     {
 170  0
         metadata.setDocumentOrder(docIndexes);
 171  0
     }
 172  
 
 173  
     /* (non-Javadoc)
 174  
      * @see org.apache.jetspeed.om.folder.Folder#getDefaultPage()
 175  
      */
 176  
     public String getDefaultPage()
 177  
     {
 178  0
         return metadata.getDefaultPage();
 179  
     }
 180  
     
 181  
     /*
 182  
      * (non-Javadoc)
 183  
      * 
 184  
      * @see org.apache.jetspeed.om.folder.Folder#setDefaultPage()
 185  
      */
 186  
     public void setDefaultPage( String defaultPage )
 187  
     {
 188  0
         metadata.setDefaultPage(defaultPage);
 189  0
     }
 190  
 
 191  
     /**
 192  
      * <p>
 193  
      * getFolders
 194  
      * </p>
 195  
      * 
 196  
      * @param checkAccess flag
 197  
      * @return folders node set
 198  
      * @throws DocumentException
 199  
      */
 200  
     public NodeSet getFolders(boolean checkAccess) throws DocumentException
 201  
     {
 202  
         // get list of all folders
 203  0
         NodeSet folders = getAllNodes().subset(FOLDER_TYPE);
 204  
 
 205  
         // filter node set by access
 206  0
         if (checkAccess)
 207  
         {
 208  0
             folders = checkAccess(folders, JetspeedActions.VIEW);
 209  
         }
 210  0
         return folders;
 211  
     }
 212  
 
 213  
     /*
 214  
      * (non-Javadoc)
 215  
      * 
 216  
      * @see org.apache.jetspeed.om.folder.Folder#getFolders()
 217  
      */
 218  
     public NodeSet getFolders() throws DocumentException
 219  
     {
 220  
         // by default enable access checks
 221  0
         return getFolders(true);
 222  
     }
 223  
 
 224  
     /**
 225  
      * <p>
 226  
      * getFolder
 227  
      * </p>
 228  
      * 
 229  
      * @param name
 230  
      * @param checkAccess flag
 231  
      * @return folder
 232  
      * @throws FolderNotFoundException
 233  
      * @throws DocumentException
 234  
      */
 235  
     public Folder getFolder(String name, boolean checkAccess) throws FolderNotFoundException, DocumentException
 236  
     {
 237  
         // get folder
 238  0
         Folder folder = (Folder) getAllNodes().subset(FOLDER_TYPE).get(name);
 239  0
         if (folder == null)
 240  
         {
 241  0
             throw new FolderNotFoundException("Jetspeed PSML folder not found: " + name);
 242  
         }
 243  
 
 244  
         // check access
 245  0
         if (checkAccess)
 246  
         {
 247  0
             folder.checkAccess(JetspeedActions.VIEW);
 248  
         }
 249  0
         return folder;
 250  
     }
 251  
 
 252  
     /*
 253  
      * (non-Javadoc)
 254  
      * 
 255  
      * @see org.apache.jetspeed.om.folder.Folder#getFolder(java.lang.String)
 256  
      */
 257  
     public Folder getFolder(String name) throws FolderNotFoundException, DocumentException
 258  
     {
 259  
         // by default enable access checks
 260  0
         return getFolder(name, true);
 261  
     }
 262  
 
 263  
     /**
 264  
      * <p>
 265  
      * getPages
 266  
      * </p>
 267  
      * 
 268  
      * @param checkAccess flag
 269  
      * @return pages node set
 270  
      * @throws NodeException
 271  
      */
 272  
     public NodeSet getPages(boolean checkAccess) throws NodeException
 273  
     {
 274  
         // get list of all pages
 275  0
         NodeSet pages = getAllNodes().subset(Page.DOCUMENT_TYPE);
 276  
 
 277  
         // filter node set by access
 278  0
         if (checkAccess)
 279  
         {
 280  0
             pages = checkAccess(pages, JetspeedActions.VIEW);
 281  
         }
 282  0
         return pages;
 283  
     }
 284  
 
 285  
     /*
 286  
      * (non-Javadoc)
 287  
      * 
 288  
      * @see org.apache.jetspeed.om.folder.Folder#getPages()
 289  
      */
 290  
     public NodeSet getPages() throws NodeException
 291  
     {
 292  
         // by default enable access checks
 293  0
         return getPages(true);
 294  
     }
 295  
 
 296  
     /**
 297  
      * <p>
 298  
      * getPage
 299  
      * </p>
 300  
      * 
 301  
      * @param name
 302  
      * @param checkAccess flag
 303  
      * @return page
 304  
      * @throws PageNotFoundException
 305  
      * @throws NodeException
 306  
      */
 307  
     public Page getPage(String name, boolean checkAccess) throws PageNotFoundException, NodeException
 308  
     {
 309  
         // get page
 310  0
         Page page = (Page) getAllNodes().subset(Page.DOCUMENT_TYPE).get(name);
 311  0
         if (page == null)
 312  
         {
 313  0
             throw new PageNotFoundException("Jetspeed PSML page not found: " + name);
 314  
         }
 315  
 
 316  
         // check access
 317  0
         if (checkAccess)
 318  
         {
 319  0
             page.checkAccess(JetspeedActions.VIEW);
 320  
         }
 321  0
         return page;
 322  
     }
 323  
 
 324  
     /*
 325  
      * (non-Javadoc)
 326  
      * 
 327  
      * @see org.apache.jetspeed.om.folder.Folder#getPage(java.lang.String)
 328  
      */
 329  
     public Page getPage(String name) throws PageNotFoundException, NodeException
 330  
     {
 331  
         // by default enable access checks
 332  0
         return getPage(name, true);
 333  
     }
 334  
 
 335  
     /**
 336  
      * <p>
 337  
      * getLinks
 338  
      * </p>
 339  
      * 
 340  
      * @param checkAccess flag
 341  
      * @return links node set
 342  
      * @throws NodeException
 343  
      */
 344  
     public NodeSet getLinks(boolean checkAccess) throws NodeException
 345  
     {
 346  
         // get list of all links
 347  0
         NodeSet links = getAllNodes().subset(Link.DOCUMENT_TYPE);
 348  
 
 349  
         // filter node set by access
 350  0
         if (checkAccess)
 351  
         {
 352  0
             links = checkAccess(links, JetspeedActions.VIEW);
 353  
         }
 354  0
         return links;
 355  
     }
 356  
 
 357  
     /*
 358  
      * (non-Javadoc)
 359  
      * 
 360  
      * @see org.apache.jetspeed.om.folder.Folder#getLinks()
 361  
      */
 362  
     public NodeSet getLinks() throws NodeException
 363  
     {
 364  
         // by default enable access checks
 365  0
         return getLinks(true);
 366  
     }
 367  
 
 368  
     /**
 369  
      * <p>
 370  
      * getLink
 371  
      * </p>
 372  
      * 
 373  
      * @param name
 374  
      * @param checkAccess flag
 375  
      * @return link
 376  
      * @throws DocumentNotFoundException
 377  
      * @throws NodeException
 378  
      */
 379  
     public Link getLink(String name, boolean checkAccess) throws DocumentNotFoundException, NodeException
 380  
     {
 381  
         // get link
 382  0
         Link link = (Link) getAllNodes().subset(Link.DOCUMENT_TYPE).get(name);
 383  0
         if (link == null)
 384  
         {
 385  0
             throw new DocumentNotFoundException("Jetspeed PSML link not found: " + name);
 386  
         }
 387  
 
 388  
         // check access
 389  0
         if (checkAccess)
 390  
         {
 391  0
             link.checkAccess(JetspeedActions.VIEW);
 392  
         }
 393  0
         return link;
 394  
     }
 395  
 
 396  
     /*
 397  
      * (non-Javadoc)
 398  
      * 
 399  
      * @see org.apache.jetspeed.om.folder.Folder#getLink(java.lang.String)
 400  
      */
 401  
     public Link getLink(String name) throws DocumentNotFoundException, NodeException
 402  
     {
 403  
         // by default enable access checks
 404  0
         return getLink(name, true);
 405  
     }
 406  
 
 407  
     /**
 408  
      * <p>
 409  
      * getPageSecurity
 410  
      * </p>
 411  
      * 
 412  
      * @param checkAccess flag
 413  
      * @return page security
 414  
      * @throws DocumentNotFoundException
 415  
      * @throws NodeException
 416  
      */
 417  
     public PageSecurity getPageSecurity(boolean checkAccess) throws DocumentNotFoundException, NodeException
 418  
     {
 419  
         // check access to this folder in place
 420  
         // of access to page security document
 421  0
         if (checkAccess)
 422  
         {
 423  0
             checkAccess(JetspeedActions.VIEW);
 424  
         }
 425  
 
 426  
         // get pageSecurity
 427  0
         PageSecurity pageSecurity = (PageSecurity) getAllNodes().subset(PageSecurity.DOCUMENT_TYPE).get(PageSecurity.DOCUMENT_TYPE);
 428  0
         if (pageSecurity == null)
 429  
         {
 430  0
             throw new DocumentNotFoundException("Jetspeed PSML page security not found: " + PageSecurity.DOCUMENT_TYPE);
 431  
         }
 432  0
         return pageSecurity;
 433  
     }
 434  
 
 435  
     /*
 436  
      * (non-Javadoc)
 437  
      * 
 438  
      * @see org.apache.jetspeed.om.folder.Folder#getPageSecurity()
 439  
      */
 440  
     public PageSecurity getPageSecurity() throws DocumentNotFoundException, NodeException
 441  
     {
 442  
         // by default disable access checks
 443  0
         return getPageSecurity(false);
 444  
     }
 445  
 
 446  
     /*
 447  
      * (non-Javadoc)
 448  
      * 
 449  
      * @see org.apache.jetspeed.om.folder.Folder#getAll()
 450  
      */
 451  
     public NodeSet getAll() throws DocumentException
 452  
     {
 453  
         // return secure set of all nodes: enforce access checks
 454  
         // on folders and documents while creating filtered nodes
 455  0
         NodeSet nodes = getAllNodes();
 456  0
         NodeSet filteredNodes = null;
 457  0
         Iterator checkAccessIter = nodes.iterator();
 458  0
         while (checkAccessIter.hasNext())
 459  
         {
 460  0
             Node node = (Node)checkAccessIter.next();
 461  
             try
 462  
             {
 463  0
                 ((AbstractNode) node).checkAccess(JetspeedActions.VIEW);
 464  0
                 if (filteredNodes != null)
 465  
                 {
 466  0
                     filteredNodes.add(node);
 467  
                 }
 468  
             }
 469  0
             catch (SecurityException se)
 470  
             {
 471  0
                 if (filteredNodes == null)
 472  
                 {
 473  0
                     filteredNodes = new NodeSetImpl(getPath(), ((NodeSetImpl) nodes).getComparator());
 474  0
                     Iterator copyIter = nodes.iterator();
 475  0
                     while (copyIter.hasNext())
 476  
                     {
 477  0
                         Node copyNode = (Node)copyIter.next();
 478  0
                         if (copyNode != node)
 479  
                         {
 480  0
                             filteredNodes.add(copyNode);
 481  
                         }
 482  
                         else
 483  
                         {
 484  
                             break;
 485  
                         }
 486  0
                     }
 487  
                 }
 488  0
             }
 489  0
         }
 490  0
         if (filteredNodes != null)
 491  
         {
 492  0
             return filteredNodes;
 493  
         }
 494  0
         return nodes;
 495  
     }
 496  
 
 497  
     /**
 498  
      * <p>
 499  
      * getAllNodes
 500  
      * </p>
 501  
      *
 502  
      * @return all nodes immediatley under this
 503  
      * @throws DocumentException
 504  
      */
 505  
     public NodeSet getAllNodes() throws DocumentException
 506  
     {
 507  0
         if((allNodes == null) && (folderHandler != class="keyword">null))
 508  
         {            
 509  0
             if(metadata.getDocumentOrder() != null)
 510  
             {
 511  0
                 if (getPath().endsWith(PATH_SEPARATOR))
 512  
                 {
 513  0
                     allNodes = new NodeSetImpl(getPath(), class="keyword">new NodeOrderCompartaor(metadata.getDocumentOrder(), getPath()));
 514  
                 }
 515  
                 else
 516  
                 {
 517  0
                     allNodes = new NodeSetImpl(getPath(), class="keyword">new NodeOrderCompartaor(metadata.getDocumentOrder(), getPath() + PATH_SEPARATOR));
 518  
                 }
 519  
             }
 520  
             else
 521  
             {
 522  0
                 allNodes = new NodeSetImpl(getPath());
 523  
             }
 524  
 
 525  
             try
 526  
             {
 527  0
                 String[] nodeNames = folderHandler.listAll(getPath());
 528  0
                 for (int i = 0; i < nodeNames.length; i++)
 529  
                 {
 530  0
                     if (!nodeNames[i].equals(FolderMetaDataImpl.DOCUMENT_TYPE))
 531  
                     {
 532  0
                         Node node = null;
 533  
                         try
 534  
                         {
 535  0
                             if (getPath().endsWith(PATH_SEPARATOR))
 536  
                             {
 537  0
                                 String full = PageManagerUtils.concatenatePaths(getPath(), nodeNames[i]); 
 538  0
                                 if (!folderHandler.isFolder(full))
 539  
                                 {
 540  0
                                     node = getHandlerFactory().getDocumentHandlerForPath(nodeNames[i]).getDocument(getPath() + nodeNames[i]);
 541  
                                 }
 542  
                                 else
 543  
                                 {
 544  0
                                     node = folderHandler.getFolder(getPath() + nodeNames[i]);
 545  
                                 }
 546  0
                             }
 547  
                             else
 548  
                             {
 549  0
                                 String full = PageManagerUtils.concatenatePaths(getPath(), nodeNames[i]); 
 550  0
                                 if (!folderHandler.isFolder(full))                                
 551  
                                 //if(nodeNames[i].indexOf(".") > -1)
 552  
                                 {
 553  0
                                     node = getHandlerFactory().getDocumentHandlerForPath(nodeNames[i]).getDocument(getPath() + PATH_SEPARATOR + nodeNames[i]);
 554  
                                 }
 555  
                                 else
 556  
                                 {
 557  0
                                     node = folderHandler.getFolder(getPath() + PATH_SEPARATOR + nodeNames[i]);
 558  
                                 }
 559  
                             }
 560  0
                             node.setParent(this);
 561  0
                             allNodes.add(node);
 562  
                         }               
 563  0
                         catch (UnsupportedDocumentTypeException e)
 564  
                         {
 565  
                             // Skip unsupported documents
 566  0
                             log.info("getAllNodes() Skipping unsupported document: "+nodeNames[i]);
 567  
                         }
 568  0
                         catch (Exception e)
 569  
                         {
 570  0
                             log.warn("getAllNodes() failed to create Node: "+nodeNames[i]+":"+e.toString(), e);
 571  0
                         }
 572  
                     }       
 573  
                 }
 574  
             }
 575  0
             catch (FolderNotFoundException fnfe)
 576  
             {
 577  0
                 log.error("getAllNodes() unexpected missing folder", fnfe);
 578  0
             }
 579  
         }
 580  
         
 581  0
         return allNodes;
 582  
     }
 583  
     
 584  
     /**
 585  
      * <p>
 586  
      * getFolderMetaData
 587  
      * </p>
 588  
      *
 589  
      * @return implementation specific folder metadata
 590  
      */
 591  
     public FolderMetaDataImpl getFolderMetaData()
 592  
     {
 593  0
         return metadata;
 594  
     }
 595  
 
 596  
     /**
 597  
      * <p>
 598  
      * setFolderHandler
 599  
      * </p>
 600  
      *
 601  
      * @param handler folder handler
 602  
      */
 603  
     public void setFolderHandler(FolderHandler handler)
 604  
     {
 605  0
         this.folderHandler = handler;
 606  0
     }
 607  
 
 608  
     /**
 609  
      * <p>
 610  
      * getMetadata
 611  
      * </p>
 612  
      *
 613  
      * @see org.apache.jetspeed.page.document.AbstractNode#getMetadata()
 614  
      * @return metadata
 615  
      */
 616  
     public GenericMetadata getMetadata()
 617  
     {        
 618  0
         return metadata.getMetadata();
 619  
     }
 620  
 
 621  
     /**
 622  
      * <p>
 623  
      * getSecurityConstraints
 624  
      * </p>
 625  
      *
 626  
      * @see org.apache.jetspeed.om.common.SecureResource#getSecurityConstraints()
 627  
      * @return
 628  
      */
 629  
     public SecurityConstraints getSecurityConstraints()
 630  
     {
 631  0
         return metadata.getSecurityConstraints();
 632  
     }
 633  
     /**
 634  
      * <p>
 635  
      * setSecurityConstraints
 636  
      * </p>
 637  
      *
 638  
      * @see org.apache.jetspeed.om.common.SecureResource#setSecurityConstraints(org.apache.jetspeed.om.common.SecurityConstraints)
 639  
      * @param constraints
 640  
      */
 641  
     public void setSecurityConstraints(SecurityConstraints constraints)
 642  
     {
 643  0
         metadata.setSecurityConstraints(constraints);
 644  0
     }
 645  
 
 646  
     /**
 647  
      * getEffectivePageSecurity
 648  
      *
 649  
      * @see org.apache.jetspeed.om.page.psml.AbstractElementImpl#getEffectivePageSecurity()
 650  
      */
 651  
     public PageSecurity getEffectivePageSecurity()
 652  
     {
 653  
         // return single page security if available
 654  0
         PageSecurity pageSecurity = null;
 655  
         try
 656  
         {
 657  0
             pageSecurity = getPageSecurity(false);
 658  0
             if (pageSecurity != null)
 659  
             {
 660  0
                 return pageSecurity;
 661  
             }
 662  
         }
 663  0
         catch (NodeException ne)
 664  
         {
 665  
         }
 666  0
         catch (NodeNotFoundException nnfe)
 667  
         {
 668  0
         }
 669  
 
 670  
         // delegate to parent folder implementation
 671  0
         FolderImpl parentFolderImpl = (FolderImpl)getParent();
 672  0
         if (parentFolderImpl != null)
 673  
         {
 674  0
             return parentFolderImpl.getEffectivePageSecurity();
 675  
         }
 676  0
         return null;
 677  
     }
 678  
 
 679  
     /**
 680  
      * <p>
 681  
      * checkPermissions
 682  
      * </p>
 683  
      *
 684  
      * @param path
 685  
      * @param mask
 686  
      * @param checkNodeOnly
 687  
      * @param checkParentsOnly
 688  
      * @throws SecurityException
 689  
      */
 690  
     public void checkPermissions(String path, int mask, boolean checkNodeOnly, class="keyword">boolean checkParentsOnly) throws SecurityException
 691  
     {
 692  
         // check granted folder permissions unless the check is
 693  
         // to be skipped due to explicity granted access
 694  0
         if (!checkParentsOnly)
 695  
         {
 696  0
             FolderPermission permission = new FolderPermission(path, mask);
 697  0
             AccessController.checkPermission(permission);
 698  
         }
 699  
 
 700  
         // if not checking node only, recursively check
 701  
         // all parent permissions in hierarchy
 702  0
         if (!checkNodeOnly && (getParent() != null))
 703  
         {
 704  0
             ((AbstractNode)getParent()).checkPermissions(mask, false, false);
 705  
         }
 706  0
     }
 707  
 
 708  
     /**
 709  
      * <p>
 710  
      * getTitle
 711  
      * </p>
 712  
      *
 713  
      * @see org.apache.jetspeed.page.document.Node#getTitle(java.util.Locale)
 714  
      * @param locale
 715  
      * @return title in specified locale
 716  
      */
 717  
     public String getTitle( Locale locale )
 718  
     {
 719  0
         return metadata.getTitle(locale);
 720  
     }
 721  
     /**
 722  
      * <p>
 723  
      * getTitle
 724  
      * </p>
 725  
      *
 726  
      * @see org.apache.jetspeed.om.page.BaseElement#getTitle()
 727  
      * @return title
 728  
      */
 729  
     public String getTitle()
 730  
     {
 731  0
         return metadata.getTitle();
 732  
     }
 733  
     /**
 734  
      * <p>
 735  
      * setTitle
 736  
      * </p>
 737  
      *
 738  
      * @see org.apache.jetspeed.om.page.BaseElement#setTitle(java.lang.String)
 739  
      * @param title
 740  
      */
 741  
     public void setTitle( String title )
 742  
     {
 743  0
         metadata.setTitle(title);
 744  0
     }
 745  
     /**
 746  
      * <p>
 747  
      * getShortTitle
 748  
      * </p>
 749  
      *
 750  
      * @see org.apache.jetspeed.page.document.Node#getShortTitle(java.util.Locale)
 751  
      * @param locale
 752  
      * @return short title in supplied locate
 753  
      */
 754  
     public String getShortTitle( Locale locale )
 755  
     {
 756  0
         return metadata.getShortTitle(locale);
 757  
     }
 758  
     /**
 759  
      * <p>
 760  
      * getShortTitle
 761  
      * </p>
 762  
      *
 763  
      * @see org.apache.jetspeed.om.page.BaseElement#getShortTitle()
 764  
      * @return short title
 765  
      */
 766  
     public String getShortTitle()
 767  
     {
 768  0
         return metadata.getShortTitle();
 769  
     }
 770  
     /**
 771  
      * <p>
 772  
      * setShortTitle
 773  
      * </p>
 774  
      *
 775  
      * @see org.apache.jetspeed.om.page.BaseElement#setShortTitle(java.lang.String)
 776  
      * @param title
 777  
      */
 778  
     public void setShortTitle( String title )
 779  
     {
 780  0
         metadata.setShortTitle(title);
 781  0
     }
 782  
     /**
 783  
      * <p>
 784  
      * getType
 785  
      * </p>
 786  
      *
 787  
      * @see org.apache.jetspeed.page.document.Node#getType()
 788  
      * @return type string
 789  
      */
 790  
     public String getType()
 791  
     {
 792  0
         return FOLDER_TYPE;
 793  
     }
 794  
     /**
 795  
      * <p>
 796  
      * isHidden
 797  
      * </p>
 798  
      *
 799  
      * @see org.apache.jetspeed.page.document.Node#isHidden()
 800  
      * @return whether folder is hidden
 801  
      */
 802  
     public boolean isHidden()
 803  
     {
 804  0
         return metadata.isHidden();
 805  
     }
 806  
     /**
 807  
      * <p>
 808  
      * setHidden
 809  
      * </p>
 810  
      *
 811  
      * @see org.apache.jetspeed.page.document.AbstractNode#setHidden(boolean)
 812  
      * @param hidden
 813  
      */
 814  
     public void setHidden( boolean hidden )
 815  
     {        
 816  0
         ((AbstractNode)metadata).setHidden(hidden);
 817  0
     }
 818  
 
 819  
     /* (non-Javadoc)
 820  
      * @see org.apache.jetspeed.om.folder.Reset#reset()
 821  
      */
 822  
     public void reset()
 823  
     {
 824  0
         allNodes = null;
 825  
         
 826  0
     }
 827  
 
 828  
     /**
 829  
      * getMenuDefinitions - get list of menu definitions
 830  
      *
 831  
      * @return definition list
 832  
      */
 833  
     public List getMenuDefinitions()
 834  
     {
 835  0
         return metadata.getMenuDefinitions();
 836  
     }
 837  
 
 838  
     /**
 839  
      * newMenuDefinition - creates a new empty menu definition
 840  
      *
 841  
      * @return a newly created MenuDefinition object for use in Folder
 842  
      */
 843  
     public MenuDefinition newMenuDefinition()
 844  
     {
 845  0
         return new MenuDefinitionImpl();
 846  
     }
 847  
 
 848  
     /**
 849  
      * newMenuExcludeDefinition - creates a new empty menu exclude definition
 850  
      *
 851  
      * @return a newly created MenuExcludeDefinition object for use in Folder
 852  
      */
 853  
     public MenuExcludeDefinition newMenuExcludeDefinition()
 854  
     {
 855  0
         return new MenuExcludeDefinitionImpl();
 856  
     }
 857  
 
 858  
     /**
 859  
      * newMenuIncludeDefinition - creates a new empty menu include definition
 860  
      *
 861  
      * @return a newly created MenuIncludeDefinition object for use in Folder
 862  
      */
 863  
     public MenuIncludeDefinition newMenuIncludeDefinition()
 864  
     {
 865  0
         return new MenuIncludeDefinitionImpl();
 866  
     }
 867  
 
 868  
     /**
 869  
      * newMenuOptionsDefinition - creates a new empty menu options definition
 870  
      *
 871  
      * @return a newly created MenuOptionsDefinition object for use in Folder
 872  
      */
 873  
     public MenuOptionsDefinition newMenuOptionsDefinition()
 874  
     {
 875  0
         return new MenuOptionsDefinitionImpl();
 876  
     }
 877  
 
 878  
     /**
 879  
      * newMenuSeparatorDefinition - creates a new empty menu separator definition
 880  
      *
 881  
      * @return a newly created MenuSeparatorDefinition object for use in Folder
 882  
      */
 883  
     public MenuSeparatorDefinition newMenuSeparatorDefinition()
 884  
     {
 885  0
         return new MenuSeparatorDefinitionImpl();
 886  
     }
 887  
 
 888  
     /**
 889  
      * setMenuDefinitions - set list of menu definitions
 890  
      *
 891  
      * @param definitions definition list
 892  
      */
 893  
     public void setMenuDefinitions(List definitions)
 894  
     {
 895  0
         metadata.setMenuDefinitions(definitions);
 896  0
     }
 897  
 
 898  
     /**
 899  
      * unmarshalled - notification that this instance has been
 900  
      *                loaded from the persistent store
 901  
      */
 902  
     public void unmarshalled()
 903  
     {
 904  
         // notify super class implementation
 905  0
         super.unmarshalled();
 906  
 
 907  
         // default title of pages to name
 908  0
         if (getTitle() == null)
 909  
         {
 910  0
             setTitle(getTitleName());
 911  
         }
 912  0
     }
 913  
     
 914  
     public boolean isReserved()
 915  
     {
 916  0
         return (reservedType > RESERVED_FOLDER_NONE);
 917  
     }
 918  
     
 919  
     public int getReservedType()
 920  
     {
 921  0
         return reservedType;
 922  
     }
 923  
     
 924  
     private void setReservedType()
 925  
     {
 926  0
         String name = getName();
 927  0
         if (name != null)
 928  
         {
 929  0
             if (name.startsWith(RESERVED_SUBSITE_FOLDER_PREFIX))
 930  
             {
 931  0
                 reservedType = RESERVED_FOLDER_SUBSITES;
 932  
             }
 933  0
             else if (name.startsWith(RESERVED_FOLDER_PREFIX))            
 934  
             {
 935  0
                 if (name.equals(RESERVED_USER_FOLDER_NAME))
 936  0
                     reservedType = RESERVED_FOLDER_USERS;
 937  0
                 else if (name.equals(RESERVED_ROLE_FOLDER_NAME))
 938  0
                     reservedType = RESERVED_FOLDER_ROLES;
 939  0
                 else if (name.equals(RESERVED_GROUP_FOLDER_NAME))
 940  0
                     reservedType = RESERVED_FOLDER_GROUPS;
 941  0
                 else if (name.equals(RESERVED_MEDIATYPE_FOLDER_NAME))
 942  0
                     reservedType = RESERVED_FOLDER_MEDIATYPE;
 943  0
                 else if (name.equals(RESERVED_LANGUAGE_FOLDER_NAME))
 944  0
                     reservedType = RESERVED_FOLDER_LANGUAGE;
 945  0
                 else if (name.equals(RESERVED_COUNTRY_FOLDER_NAME))
 946  0
                     reservedType = RESERVED_FOLDER_COUNTRY;
 947  
                 else
 948  0
                     reservedType = RESERVED_FOLDER_OTHER;            
 949  
             }
 950  
         }
 951  0
     }
 952  
     
 953  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.